[lkml]   [2007]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Is there any word about this bug in gcc ?
On Mon, Nov 19, 2007 at 09:10:44PM -0800, H. Peter Anvin wrote:
>WANG Cong wrote:
>>On Tue, Nov 20, 2007 at 10:13:42AM +0800, zhengyi wrote:
>>>Is there any relevance to the kernel ?
>>>I found the folowing code here:
>>>int main( void )
>>> int i=2;
>>> if( -10*abs (i-1) == 10*abs(i-1) )
>>> printf ("OMG,-10==10 in linux!\n");
>>> else
>>> printf ("nothing special here\n") ;
>>> return 0 ;
>>I think no. It is considered a bug in abs(), kernel, of course,
>>doesn't use glibc's abs().
>abs() is internal to gcc, and the above is optimized out at compile
>time, so any user of abs() as a function at all is vulnerable.

This is an urgent bug, I think.

And you mean abs() is not in glibc, then where is it? Built in gcc?
And what's more, why not put it in glibc?


>However, the Linux kernel defines abs() as a macro:
>#define abs(x) ({ \
> int __x = (x); \
> (__x < 0) ? -__x : __x; \
> })
>... which means gcc never sees it. So the kernel isn't affected,
>because it doesn't use *gcc's* abs().

Thanks for clarifying this!


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-11-20 07:09    [from the cache]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site