Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-16 Thread Jeff Law
[ I'm catching up on a variety of things... So apologies if y'all have settled these issues. ] On 11/02/2016 01:32 PM, Jakub Jelinek wrote: But obviously not all levels of the warning can/should be enabled with -Wall/-Werror. There are cases which are worth warning by default (the case where

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-06 Thread Martin Sebor
But obviously not all levels of the warning can/should be enabled with -Wall/-Werror. There are cases which are worth warning by default (the case where we want to inform the user if you reach this stmt, you'll get your program killed (will call __chk_fail)) is something that ought like before be

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-04 Thread Martin Sebor
Attached is an update to the patch that takes into consideration the feedback I got. It goes back to adding just one option, -Wstringop-overflow, as in the original, while keeping the Object Size type as an argument. It uses type-1 as the default setting for string functions (strcpy et al.) and,

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-02 Thread Jakub Jelinek
On Wed, Nov 02, 2016 at 10:55:23AM -0600, Martin Sebor wrote: > >That's an unfair assertion in light of the numbers above. > > > >>If you want a warning for suspicious calls, sure, but > >>1) it has to be clearly worded significantly differently from how do you > >> word it, so that users really

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-02 Thread Martin Sebor
Sure, they might and in that case the warning would be a false positive. It wouldn't be the first such warning that wasn't 100% free of them. But my testing with Binutils, GCC, and the Linux kernel has exposed only 10 instances of new warnings and I don't think I saw this idiom among them. But

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-02 Thread Martin Sebor
On 11/02/2016 01:37 AM, Jakub Jelinek wrote: On Tue, Nov 01, 2016 at 08:55:03PM -0600, Martin Sebor wrote: struct S { int a, b, c, d; }; #define bos(p, t) __builtin_object_size (p, t) #define memset0(p, i, n) __builtin___memset_chk (p, i, n, bos (p, 0)) #define memset1(p, i, n) __builtin___me

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-02 Thread Jakub Jelinek
On Tue, Nov 01, 2016 at 08:55:03PM -0600, Martin Sebor wrote: > struct S { > int a, b, c, d; > }; > > #define bos(p, t) __builtin_object_size (p, t) > #define memset0(p, i, n) __builtin___memset_chk (p, i, n, bos (p, 0)) > #define memset1(p, i, n) __builtin___memset_chk (p, i, n, bos (p, 1)) >

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-01 Thread Martin Sebor
On 11/01/2016 01:14 PM, Jakub Jelinek wrote: On Tue, Nov 01, 2016 at 01:12:55PM -0600, Jeff Law wrote: On 11/01/2016 08:10 AM, Jakub Jelinek wrote: On Mon, Oct 31, 2016 at 08:39:15PM -0600, Martin Sebor wrote: Attached is an updated patch that works around the problem with the definition of th

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-01 Thread Jakub Jelinek
On Tue, Nov 01, 2016 at 01:12:55PM -0600, Jeff Law wrote: > On 11/01/2016 08:10 AM, Jakub Jelinek wrote: > >On Mon, Oct 31, 2016 at 08:39:15PM -0600, Martin Sebor wrote: > >>Attached is an updated patch that works around the problem with > >>the definition of the NOTE_DATA macro discussed below. I

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-01 Thread Jeff Law
On 11/01/2016 08:10 AM, Jakub Jelinek wrote: On Mon, Oct 31, 2016 at 08:39:15PM -0600, Martin Sebor wrote: Attached is an updated patch that works around the problem with the definition of the NOTE_DATA macro discussed below. I've raised bug 78174 for it and temporarily worked around it in the

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-11-01 Thread Jakub Jelinek
On Mon, Oct 31, 2016 at 08:39:15PM -0600, Martin Sebor wrote: > Attached is an updated patch that works around the problem with > the definition of the NOTE_DATA macro discussed below. I've > raised bug 78174 for it and temporarily worked around it in > the patch. I'll see if I can come up with a

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-10-31 Thread Martin Sebor
Attached is an updated patch that works around the problem with the definition of the NOTE_DATA macro discussed below. I've raised bug 78174 for it and temporarily worked around it in the patch. I'll see if I can come up with a patch to fix the macro the "right way" but would prefer to do that s

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-10-31 Thread Martin Sebor
On 10/31/2016 06:39 AM, Tobias Burnus wrote: Martin Sebor wrote: Attached is an updated patch that adds checks for excessive sizes and bounds (those in excess of SIZE_MAX / 2), and also enables the same checking for strcat and strncat). This version also fixes an issue with the interpretation o

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-10-31 Thread Tobias Burnus
Martin Sebor wrote: > Attached is an updated patch that adds checks for excessive sizes > and bounds (those in excess of SIZE_MAX / 2), and also enables > the same checking for strcat and strncat). This version also > fixes an issue with the interpretation of anti-ranges in the > first patch. The

Re: [PATCH] enhance buffer overflow warnings (and c/53562)

2016-10-30 Thread Martin Sebor
Attached is an updated patch that adds checks for excessive sizes and bounds (those in excess of SIZE_MAX / 2), and also enables the same checking for strcat and strncat). This version also fixes an issue with the interpretation of anti-ranges in the first patch. The improvements exposed two bug