From: Michal Marek <mmarek@suse.cz>
To: Richard Yao <ryao@gentoo.org>, linux-kernel@vger.kernel.org
Cc: Richard Yao <richard.yao@clusterhq.com>,
Madhuri Yechuri <madhuriyechuri@clusterhq.com>
Subject: Re: [PATCH] genksyms: Duplicate function pointer type definitions segfault
Date: Thu, 20 Aug 2015 14:54:28 +0200 [thread overview]
Message-ID: <55D5CE04.2050705@suse.cz> (raw)
In-Reply-To: <1437436369-46257-1-git-send-email-ryao@gentoo.org>
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
prev parent reply other threads:[~2015-08-20 12:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 23:52 Richard Yao
2015-07-21 1:28 ` Richard Yao
2015-08-20 12:54 ` Michal Marek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55D5CE04.2050705@suse.cz \
--to=mmarek@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=madhuriyechuri@clusterhq.com \
--cc=richard.yao@clusterhq.com \
--cc=ryao@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome