From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18137 invoked by alias); 5 Jul 2002 01:34:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18101 invoked from network); 5 Jul 2002 01:34:40 -0000 Received: from unknown (HELO mta02ps.bigpond.com) (144.135.25.134) by sources.redhat.com with SMTP; 5 Jul 2002 01:34:40 -0000 Received: from bubble.local ([144.135.25.84]) by mta02ps.bigpond.com (Netscape Messaging Server 4.15 mta02ps Apr 29 2002 13:22:02) with SMTP id GYR5IV00.872 for ; Fri, 5 Jul 2002 11:30:31 +1000 Received: from CPE-144-136-176-14.sa.bigpond.net.au ([144.136.176.14]) by psmam06.mailsvc.email.bigpond.com(MailRouter V3.0n 116/105498); 05 Jul 2002 11:30:30 Received: (qmail 6077 invoked by uid 179); 5 Jul 2002 01:30:29 -0000 Date: Thu, 04 Jul 2002 20:05:00 -0000 From: Alan Modra To: Mark Kettenis Cc: binutils@sources.redhat.com, gdb-patches@sources.redhat.com Subject: Re: [RFA/PATCH] Fix recognition of NT_PRXFREG notes Message-ID: <20020705013029.GC30362@bubble.sa.bigpond.net.au> Mail-Followup-To: Mark Kettenis , binutils@sources.redhat.com, gdb-patches@sources.redhat.com References: <200207041503.g64F3Mj08511@elgar.kettenis.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200207041503.g64F3Mj08511@elgar.kettenis.dyndns.org> User-Agent: Mutt/1.3.25i X-SW-Source: 2002-07/txt/msg00094.txt.bz2 On Thu, Jul 04, 2002 at 05:03:22PM +0200, Mark Kettenis wrote: > Index: elf.c > =================================================================== > RCS file: /cvs/src/src/bfd/elf.c,v > retrieving revision 1.152 > diff -u -p -r1.152 elf.c > --- elf.c 4 Jul 2002 13:26:30 -0000 1.152 > +++ elf.c 4 Jul 2002 14:54:36 -0000 > @@ -6718,8 +6718,7 @@ elfcore_grok_note (abfd, note) > #endif > > case NT_PRXFPREG: /* Linux SSE extension */ > - if (note->namesz == 5 > - && ! strcmp (note->namedata, "LINUX")) > + if (strncmp (note->namedata, "LINUX", 5) == 0) > return elfcore_grok_prxfpreg (abfd, note); > else > return true; Don't the alignment rules require that the name be padded out to a multiple of 4 chars? (or 8 on 64 bit ELF files). So you should have 'L','I','N','U','X','\0','\0','\0' and thus can use strcmp. Also, it's a good idea to check namesz before accessing namedata. I'm sure I can make your strncmp segfault by carefully crafting a non-compliant note. Hmm, on re-reading the ELF standard, I see the pad char isn't specified. :-( But obviously the original strcmp worked, so the pad from the kernel is zero. Please use if (note->namesz >= 5 && strcmp (note->namedata, "LINUX") == 0) and commit the patch. Thanks. -- Alan Modra IBM OzLabs - Linux Technology Centre