Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1210486
| From | Michal Marek <mmarek@suse.cz> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] genksyms: Duplicate function pointer type definitions segfault |
| Date | 2015-08-20 15:00 +0200 |
| Message-ID | <pZxBO-5jT-59@gated-at.bofh.it> (permalink) |
| References | <pOt8u-899-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 2015-07-21 01:52, Richard Yao wrote: > From: Richard Yao <richard.yao@clusterhq.com> > > I noticed that genksyms will segfault when it sees duplicate function > pointer type declaration when I placed the same function pointer > definition in two separate headers in a local branch as an intermediate > step of some refactoring. This can be reproduced by piping the following > minimal test case into `genksyms -r /dev/null` or alternatively, putting > it into a C file attempting a build: > > int (*f)(); > int (*f)(); > > Attaching gdb to genksyms to understand this failure is useless without > changing CFLAGS to emit debuginfo. Once you have debuginfo, you will > find that the failure is that `char *s` was NULL and the program > executed `while(*s)`. At which point, further debugging requires > familiarity with compiler front end / parser development. > > What happens is that flex identifies the first instance of the token "f" > as IDENT and the yacc parser adds it to the symbol table. On the second > instance, flex will identify "f" as TYPE, which triggers an error case > in the yacc parser. Given that TYPE would have been IDENT had it not > been in the symbol table, the the segmentaion fault could be avoided by > treating TYPE as IDENT in the affected rule. > > Some might consider placing identical function pointer type declarations > in different headers to be poor style might consider a failure to be > beneficial. However, failing through a segmentation fault makes the > cause non-obvious and can waste the time of anyone who encounters it. > > Signed-off-by: Richard Yao <richard.yao@clusterhq.com> > Acked-by: Madhuri Yechuri <madhuriyechuri@clusterhq.com> Applied to kbuild.git#kbuild. Michal -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH] genksyms: Duplicate function pointer type definitions segfault Michal Marek <mmarek@suse.cz> - 2015-08-20 15:00 +0200
csiph-web