* Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
[not found] ` <154e089b0903191151q37ab7b20o43838845af12966f@mail.gmail.com>
@ 2009-03-19 19:07 ` Al Viro
2009-03-19 19:27 ` Ingo Molnar
0 siblings, 1 reply; 12+ messages in thread
From: Al Viro @ 2009-03-19 19:07 UTC (permalink / raw)
To: Vegard Nossum
Cc: Christopher Li, linux-sparse, Hannes Eder, linux-kernel,
Ingo Molnar
On Thu, Mar 19, 2009 at 07:51:22PM +0100, Hannes Eder wrote:
> When currently running sparse agains the current linux-next tree, a
> lot of checks produce error messages like this:
>
> include/linux/skbuff.h:381:9: error: expected preprocessor identifier
Cute. If anything, this kmemcheck_define_bitfield stuff needs to be moved
inside the ifdefs.
Folks, this is not a valid C, period. And no, there's no promise that
gcc won't change its behaviour on such constructs whenever they feel
like that.
Preprocessor directives do not belong in argument lists. Not #ifdef,
not #define, not #include; this is undefined behaviour.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-19 19:07 ` Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case) Al Viro
@ 2009-03-19 19:27 ` Ingo Molnar
2009-03-19 19:39 ` Al Viro
2009-03-19 20:20 ` Vegard Nossum
0 siblings, 2 replies; 12+ messages in thread
From: Ingo Molnar @ 2009-03-19 19:27 UTC (permalink / raw)
To: Al Viro
Cc: Vegard Nossum, Christopher Li, linux-sparse, Hannes Eder,
linux-kernel
* Al Viro <viro@ZenIV.linux.org.uk> wrote:
> On Thu, Mar 19, 2009 at 07:51:22PM +0100, Hannes Eder wrote:
> > When currently running sparse agains the current linux-next tree, a
> > lot of checks produce error messages like this:
> >
> > include/linux/skbuff.h:381:9: error: expected preprocessor identifier
>
> Cute. If anything, this kmemcheck_define_bitfield stuff needs to be moved
> inside the ifdefs.
>
> Folks, this is not a valid C, period. And no, there's no promise
> that gcc won't change its behaviour on such constructs whenever
> they feel like that.
>
> Preprocessor directives do not belong in argument lists. Not
> #ifdef, not #define, not #include; this is undefined behaviour.
Agreed.
Vegard, it's this bit:
kmemcheck_define_bitfield(flags2, {
#ifdef CONFIG_IPV6_NDISC_NODETYPE
__u8 ndisc_nodetype:2;
#endif
#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
__u8 do_not_encrypt:1;
__u8 requeue:1;
#endif
});
Ingo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-19 19:27 ` Ingo Molnar
@ 2009-03-19 19:39 ` Al Viro
2009-03-19 20:20 ` Vegard Nossum
1 sibling, 0 replies; 12+ messages in thread
From: Al Viro @ 2009-03-19 19:39 UTC (permalink / raw)
To: Ingo Molnar
Cc: Vegard Nossum, Christopher Li, linux-sparse, Hannes Eder,
linux-kernel
On Thu, Mar 19, 2009 at 08:27:58PM +0100, Ingo Molnar wrote:
> Vegard, it's this bit:
>
> kmemcheck_define_bitfield(flags2, {
> #ifdef CONFIG_IPV6_NDISC_NODETYPE
> __u8 ndisc_nodetype:2;
> #endif
> #if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
> __u8 do_not_encrypt:1;
> __u8 requeue:1;
> #endif
> });
BTW, there's a related turd: kernel/cred.c
if (
#ifdef CONFIG_KEYS
!p->cred->thread_keyring &&
#endif
clone_flags & CLONE_THREAD
) {
is not only ucking fugly, it's not a valid C if you have PROFILE_ALL_BRANCHES
set. Why? Because then we get if() #defined ;-/
BTW^2, speaking of that ifdef... What happens to
static void put_cred_rcu(struct rcu_head *rcu)
{
struct cred *cred = container_of(rcu, struct cred, rcu);
if (atomic_read(&cred->usage) != 0)
panic("CRED: put_cred_rcu() sees %p with usage %d\n",
cred, atomic_read(&cred->usage));
security_cred_free(cred);
key_put(cred->thread_keyring);
key_put(cred->request_key_auth);
release_tgcred(cred);
put_group_info(cred->group_info);
free_uid(cred->user);
kmem_cache_free(cred_jar, cred);
}
if CONFIG_KEYS is not set?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-19 19:27 ` Ingo Molnar
2009-03-19 19:39 ` Al Viro
@ 2009-03-19 20:20 ` Vegard Nossum
2009-03-19 22:07 ` Stephen Rothwell
2009-03-20 18:08 ` Ingo Molnar
1 sibling, 2 replies; 12+ messages in thread
From: Vegard Nossum @ 2009-03-19 20:20 UTC (permalink / raw)
To: Ingo Molnar, Stephen Rothwell
Cc: Al Viro, Christopher Li, linux-sparse, Hannes Eder, linux-kernel
2009/3/19 Ingo Molnar <mingo@elte.hu>:
>
> * Al Viro <viro@ZenIV.linux.org.uk> wrote:
>
>> On Thu, Mar 19, 2009 at 07:51:22PM +0100, Hannes Eder wrote:
>> > When currently running sparse agains the current linux-next tree, a
>> > lot of checks produce error messages like this:
>> >
>> > include/linux/skbuff.h:381:9: error: expected preprocessor identifier
>>
>> Cute. If anything, this kmemcheck_define_bitfield stuff needs to be moved
>> inside the ifdefs.
>>
>> Folks, this is not a valid C, period. And no, there's no promise
>> that gcc won't change its behaviour on such constructs whenever
>> they feel like that.
>>
>> Preprocessor directives do not belong in argument lists. Not
>> #ifdef, not #define, not #include; this is undefined behaviour.
>
> Agreed.
>
> Vegard, it's this bit:
>
> kmemcheck_define_bitfield(flags2, {
> #ifdef CONFIG_IPV6_NDISC_NODETYPE
> __u8 ndisc_nodetype:2;
> #endif
> #if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
> __u8 do_not_encrypt:1;
> __u8 requeue:1;
> #endif
> });
>
> Ingo
>
Hm.
Is this really not valid C?
It worked with GCC, so I assumed it was. My mistake.
Okay, that puts us in a bit of a tight spot, with regards to kmemcheck, I mean.
Maybe I should just take up GCC development instead, and implement a
-fkmemcheck or something.
(To get rid of the bitfield false positives, I mean.)
I guess this means that kmemcheck branch should be withdrawn from
linux-next, at least temporarily, as I have no immediate
workarounds/alternatives. Stephen, can you drop it?
Vegard
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-19 20:20 ` Vegard Nossum
@ 2009-03-19 22:07 ` Stephen Rothwell
2009-03-20 18:08 ` Ingo Molnar
1 sibling, 0 replies; 12+ messages in thread
From: Stephen Rothwell @ 2009-03-19 22:07 UTC (permalink / raw)
To: Vegard Nossum
Cc: Ingo Molnar, Al Viro, Christopher Li, linux-sparse, Hannes Eder,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 473 bytes --]
Hi Vegard,
On Thu, 19 Mar 2009 21:20:51 +0100 Vegard Nossum <vegard.nossum@gmail.com> wrote:
>
> I guess this means that kmemcheck branch should be withdrawn from
> linux-next, at least temporarily, as I have no immediate
> workarounds/alternatives. Stephen, can you drop it?
OK, I will remove it starting today. Let me know when you want it back
in.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-19 20:20 ` Vegard Nossum
2009-03-19 22:07 ` Stephen Rothwell
@ 2009-03-20 18:08 ` Ingo Molnar
2009-03-20 19:04 ` Al Viro
1 sibling, 1 reply; 12+ messages in thread
From: Ingo Molnar @ 2009-03-20 18:08 UTC (permalink / raw)
To: Vegard Nossum, Alexander Viro
Cc: Stephen Rothwell, Al Viro, Christopher Li, linux-sparse,
Hannes Eder, linux-kernel
* Vegard Nossum <vegard.nossum@gmail.com> wrote:
> I guess this means that kmemcheck branch should be withdrawn from
> linux-next, at least temporarily, as I have no immediate
> workarounds/alternatives. Stephen, can you drop it?
Al Viro, well done :-(
Ingo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-20 18:08 ` Ingo Molnar
@ 2009-03-20 19:04 ` Al Viro
2009-03-20 19:14 ` Al Viro
0 siblings, 1 reply; 12+ messages in thread
From: Al Viro @ 2009-03-20 19:04 UTC (permalink / raw)
To: Ingo Molnar
Cc: Vegard Nossum, Alexander Viro, Stephen Rothwell, Christopher Li,
linux-sparse, Hannes Eder, linux-kernel
On Fri, Mar 20, 2009 at 07:08:53PM +0100, Ingo Molnar wrote:
>
> * Vegard Nossum <vegard.nossum@gmail.com> wrote:
>
> > I guess this means that kmemcheck branch should be withdrawn from
> > linux-next, at least temporarily, as I have no immediate
> > workarounds/alternatives. Stephen, can you drop it?
>
> Al Viro, well done :-(
>
> Ingo
What the fuck?
Al
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-20 19:04 ` Al Viro
@ 2009-03-20 19:14 ` Al Viro
2009-03-20 23:16 ` Vegard Nossum
2009-03-21 8:34 ` Johannes Berg
0 siblings, 2 replies; 12+ messages in thread
From: Al Viro @ 2009-03-20 19:14 UTC (permalink / raw)
To: Ingo Molnar
Cc: Vegard Nossum, Alexander Viro, Stephen Rothwell, Christopher Li,
linux-sparse, Hannes Eder, linux-kernel
On Fri, Mar 20, 2009 at 07:04:09PM +0000, Al Viro wrote:
> On Fri, Mar 20, 2009 at 07:08:53PM +0100, Ingo Molnar wrote:
> >
> > * Vegard Nossum <vegard.nossum@gmail.com> wrote:
> >
> > > I guess this means that kmemcheck branch should be withdrawn from
> > > linux-next, at least temporarily, as I have no immediate
> > > workarounds/alternatives. Stephen, can you drop it?
> >
> > Al Viro, well done :-(
> >
> > Ingo
>
> What the fuck?
While we are at it, there *is* an obvious workaround:
#ifdef ...
#define L1 <list>
#else
#define L1
#endif
#ifdef ...
#define L2 <list>
#else
#define L2
#endif
your_macro(...
L1
L2
...)
#undef L1
#undef L2
Ingo, care to explain what the hell had your reply above been about?
Especially since we both apparently agree that code in question did
need fixing, what with your immediate ACK upthread...
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-20 19:14 ` Al Viro
@ 2009-03-20 23:16 ` Vegard Nossum
2009-03-20 23:44 ` Al Viro
2009-03-21 8:34 ` Johannes Berg
1 sibling, 1 reply; 12+ messages in thread
From: Vegard Nossum @ 2009-03-20 23:16 UTC (permalink / raw)
To: Al Viro, Ingo Molnar
Cc: Stephen Rothwell, Christopher Li, linux-sparse, Hannes Eder,
linux-kernel
[removed duplicate Al Viro from Cc]
2009/3/20 Al Viro <viro@zeniv.linux.org.uk>:
> On Fri, Mar 20, 2009 at 07:04:09PM +0000, Al Viro wrote:
>> On Fri, Mar 20, 2009 at 07:08:53PM +0100, Ingo Molnar wrote:
>> >
>> > * Vegard Nossum <vegard.nossum@gmail.com> wrote:
>> >
>> > > I guess this means that kmemcheck branch should be withdrawn from
>> > > linux-next, at least temporarily, as I have no immediate
>> > > workarounds/alternatives. Stephen, can you drop it?
>> >
>> > Al Viro, well done :-(
[snip]
> Ingo, care to explain what the hell had your reply above been about?
> Especially since we both apparently agree that code in question did
> need fixing, what with your immediate ACK upthread...
>
Hi,
I think it is simply the frustration of discovering this rather
serious flaw just when the dust has settled, and with no capacity to
really fix it in a satisfactory way. But we should be thankful for the
heads up and try again to remember the value of linux-next and those
who test it!
(The solution you sketched is still quite an uglification of the
original code, something we tried to minimize using the construct you
saw.)
So, Ingo: There's no way this could have been merged in mainline with
such a defect, and it would be a lot worse if it wasn't discovered at
this point. We'll just have to be creative (again!) and I'm sure
Stephen can revive the tree when it's been fixed.
Vegard
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-20 23:16 ` Vegard Nossum
@ 2009-03-20 23:44 ` Al Viro
0 siblings, 0 replies; 12+ messages in thread
From: Al Viro @ 2009-03-20 23:44 UTC (permalink / raw)
To: Vegard Nossum
Cc: Ingo Molnar, Stephen Rothwell, Christopher Li, linux-sparse,
Hannes Eder, linux-kernel
On Sat, Mar 21, 2009 at 12:16:17AM +0100, Vegard Nossum wrote:
> (The solution you sketched is still quite an uglification of the
> original code, something we tried to minimize using the construct you
> saw.)
Frankly, I'd suggest expanding that sucker and being done with that.
However, more interesting question is whether you really need the
named field to be a struct. If not, something like
bitfields_start(name)
....
bitfields_end
would work just fine, without all that fun.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-20 19:14 ` Al Viro
2009-03-20 23:16 ` Vegard Nossum
@ 2009-03-21 8:34 ` Johannes Berg
2009-03-27 3:13 ` H. Peter Anvin
1 sibling, 1 reply; 12+ messages in thread
From: Johannes Berg @ 2009-03-21 8:34 UTC (permalink / raw)
To: Al Viro
Cc: Ingo Molnar, Vegard Nossum, Alexander Viro, Stephen Rothwell,
Christopher Li, linux-sparse, Hannes Eder, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 279 bytes --]
On Fri, 2009-03-20 at 19:14 +0000, Al Viro wrote:
> Ingo, care to explain what the hell had your reply above been about?
Yes, please do. You're showing a little confusing behaviour here,
telling me in one thread to show more respect for other people, and ...
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
2009-03-21 8:34 ` Johannes Berg
@ 2009-03-27 3:13 ` H. Peter Anvin
0 siblings, 0 replies; 12+ messages in thread
From: H. Peter Anvin @ 2009-03-27 3:13 UTC (permalink / raw)
To: Johannes Berg
Cc: Al Viro, Ingo Molnar, Vegard Nossum, Alexander Viro,
Stephen Rothwell, Christopher Li, linux-sparse, Hannes Eder,
linux-kernel
Johannes Berg wrote:
> On Fri, 2009-03-20 at 19:14 +0000, Al Viro wrote:
>
>> Ingo, care to explain what the hell had your reply above been about?
>
> Yes, please do. You're showing a little confusing behaviour here,
> telling me in one thread to show more respect for other people, and ...
>
> johannes
I'm not Ingo, but I took his statement at exactly face value...
Well done for catching a serious problem, and :-( for the serious
problem being discovered at this late stage.
-hpa
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-03-27 3:24 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20090319175544.13691.42362.stgit@f10box.hanneseder.net>
[not found] ` <20090319182628.GB28946@ZenIV.linux.org.uk>
[not found] ` <154e089b0903191151q37ab7b20o43838845af12966f@mail.gmail.com>
2009-03-19 19:07 ` Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case) Al Viro
2009-03-19 19:27 ` Ingo Molnar
2009-03-19 19:39 ` Al Viro
2009-03-19 20:20 ` Vegard Nossum
2009-03-19 22:07 ` Stephen Rothwell
2009-03-20 18:08 ` Ingo Molnar
2009-03-20 19:04 ` Al Viro
2009-03-20 19:14 ` Al Viro
2009-03-20 23:16 ` Vegard Nossum
2009-03-20 23:44 ` Al Viro
2009-03-21 8:34 ` Johannes Berg
2009-03-27 3:13 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox