[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-07 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #65 from Kees Cook --- (In reply to Alejandro Colomar from comment #64) > How about having two macros? One that works for non-attributed pointers, > and other that works for attributed ones. And use the appropriate one for > each o

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-07 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #63 from Kees Cook --- (In reply to Alejandro Colomar from comment #62) > What's the value of returning NULL instead of just failing the compilation > with an error? It's so that the same allocator macros can be used for FAM structs

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-05 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #59 from Kees Cook --- (In reply to Bill Wendling from comment #57) > (In reply to Kees Cook from comment #47) > > So, with the builtin being used within the allocator to set counter, now the > > old code pattern still works (as coun

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-05 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #55 from Kees Cook --- (In reply to Alejandro Colomar from comment #49) > For reading the counted_by value, that is, for reading the number of > elements in the FAM, I'm implementing a __lengthof__ operator, which returns > the value

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-08-01 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #47 from Kees Cook --- Yes, the counter must be manually set until Linux minimum compiler versions are raised to include counted_by support, but this is about making the transition to using counted_by easier and less prone to bugs.

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-30 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #32 from Kees Cook --- (In reply to qinzhao from comment #29) > (In reply to Jakub Jelinek from comment #28) > > Speaking of counted_by, I see support for it in c-family/ and c/, but not in > > cp/ at all, what is the attribute suppo

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-30 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #31 from Kees Cook --- (In reply to Qing Zhao from comment #25) > The source code need to be: > > If (__builtin_get_counted_by (P->FAM)) > __builtin_get_counted_by (P->FAM) = COUNT; > > Yes, I agree that this is good too for the

[Bug c/116016] enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-20 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016 --- Comment #1 from Kees Cook --- Matching Clang feature request: https://github.com/llvm/llvm-project/issues/99774

[Bug c/116016] New: enhancement: add __builtin_set_counted_by(P->FAM, COUNT) or equivalent

2024-07-20 Thread kees at outflux dot net via Gcc-bugs
mal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- With the wonderful addition of the 'counted_by' attribute and its wide roll-out within the Linux kernel, we have found a

[Bug tree-optimization/109071] -Warray-bounds false positive warnings due to code duplication from jump threading

2024-04-22 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109071 --- Comment #8 from Kees Cook --- The warning is about: val = &sg->vals[index]; poc.c:20:20: warning: array subscript 4 is above array bounds of 'int[4]' [-Warray-bounds=] 20 | val = &sg->vals[index]; |~~~

[Bug tree-optimization/109071] -Warray-bounds false positive warnings due to code duplication from jump threading

2024-04-22 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109071 --- Comment #6 from Kees Cook --- (In reply to qinzhao from comment #5) > adding __attribute__ ((noreturn)) to the routine "warn" can eliminate the > false positive warning. But it does return... it's not an assert.

[Bug c/53548] allow flexible array members in unions like zero-length arrays

2024-03-08 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53548 --- Comment #8 from Kees Cook --- Clang bug: https://github.com/llvm/llvm-project/issues/84565

[Bug c/53548] allow flexible array members in unions like zero-length arrays

2024-03-08 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53548 --- Comment #7 from Kees Cook --- There is still no way to use C99 flexible arrays in unions (or alone in structs) without syntactic obfuscation. The extension that already allows 0-sized arrays in unions should be extended to cover C99 arrays. T

[Bug c/53548] allow flexible array members in unions like zero-length arrays

2024-03-08 Thread kees at outflux dot net via Gcc-bugs
, ||kees at outflux dot net, ||ndesaulniers at google dot com, ||qing.zhao at oracle dot com --- Comment #6 from Kees Cook --- There is still no way to use C99 flexible arrays

[Bug c/108896] provide "element_count" attribute to give more context to __builtin_dynamic_object_size() and -fsanitize=bounds

2023-05-03 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 --- Comment #42 from Kees Cook --- Exciting! Are you able to attach the latest patch? I'd love to try it out. I've been testing Clang's version as well: https://reviews.llvm.org/D148381

[Bug tree-optimization/109071] -Warray-bounds warning when array index checked via inline

2023-03-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109071 --- Comment #3 from Kees Cook --- Is there a viable path to a solution here? This seems to cause enough false positives with -Warray-bounds that at least Linux can't enable the flag. I'd really like to have it enabled, though, since it finds ple

[Bug c/109071] New: -Warray-bounds warning when array index checked via inline

2023-03-08 Thread kees at outflux dot net via Gcc-bugs
Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Created attachment 54611 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54611&action=edit PoC for -Warray-bounds false positive Th

[Bug c/108896] provide "element_count" attribute to give more context to __builtin_dynamic_object_size() and -fsanitize=bounds

2023-03-01 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 --- Comment #6 from Kees Cook --- I really want to avoid the changes to sizeof() -- this will confuse a lot of other things. Sizeof is expected to be a constant expression, for example. I think the attribute is best since it avoids colliding wi

[Bug c/108896] provide "element_count" attribute to give more context to __builtin_dynamic_object_size() and -fsanitize=bounds

2023-02-22 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 --- Comment #1 from Kees Cook --- The corresponding Clang feature request is here: https://github.com/llvm/llvm-project/issues/60928

[Bug c/108896] New: provide "element_count" attribute to give more context to __builtin_dynamic_object_size() and -fsanitize=bounds

2023-02-22 Thread kees at outflux dot net via Gcc-bugs
Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Frequently a structure containing a flexible array member

[Bug sanitizer/108894] -fsanitize=bounds missing bounds provided by __builtin_dynamic_object_size()

2023-02-22 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108894 Kees Cook changed: What|Removed |Added Attachment #54508|0 |1 is obsolete|

[Bug sanitizer/108894] -fsanitize=bounds missing bounds provided by __builtin_dynamic_object_size()

2023-02-22 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108894 --- Comment #1 from Kees Cook --- The matching Clang bug is: https://github.com/llvm/llvm-project/issues/60926

[Bug sanitizer/108894] New: -fsanitize=bounds missing bounds provided by __builtin_dynamic_object_size()

2023-02-22 Thread kees at outflux dot net via Gcc-bugs
Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

[Bug tree-optimization/108306] false-positive -Warray-bounds warning emitted with -fsanitize=shift

2023-01-13 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108306 --- Comment #7 from Kees Cook --- (In reply to Kees Cook from comment #6) > Sorry, I forgot to include those details fully! Here's how I'm seeing it: > > $ gcc --version > gcc (GCC) 13.0.0 20230105 (experimental) > ... > $ gcc -O2 -fno-strict-o

[Bug tree-optimization/108306] false-positive -Warray-bounds warning emitted with -fsanitize=shift

2023-01-13 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108306 --- Comment #6 from Kees Cook --- Sorry, I forgot to include those details fully! Here's how I'm seeing it: $ gcc --version gcc (GCC) 13.0.0 20230105 (experimental) ... $ gcc -O2 -fno-strict-overflow -fsanitize=shift -Warray-bounds -c -o /dev/n

[Bug c/108306] false-positive -Warray-bounds warning emitted with -fsanitize=shift

2023-01-05 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108306 Kees Cook changed: What|Removed |Added Attachment #54198|0 |1 is obsolete|

[Bug c/108306] false-positive -Warray-bounds warning emitted with -fsanitize=shift

2023-01-05 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108306 --- Comment #2 from Kees Cook --- Ugh, sorry. The PoC is bad -- the bounds check isn't present. Let me try to get a another PoC.

[Bug c/108306] false-positive -Warray-bounds warning emitted with -fsanitize=shift

2023-01-05 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108306 Kees Cook changed: What|Removed |Added CC||arnd at linaro dot org, |

[Bug c/108306] New: false-positive -Warray-bounds warning emitted with -fsanitize=shift

2023-01-05 Thread kees at outflux dot net via Gcc-bugs
Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Created attachment 54198 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54198&action=edit reduced PoC This seems similar

[Bug tree-optimization/105679] [12 Regression] extra -Warray-bounds warning added with -fsanitize=shift due to jump threading

2022-10-07 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105679 --- Comment #11 from Kees Cook --- (In reply to Richard Biener from comment #10) > I sofar refrained from doing this because of the large amount of fallout and > followup changes and I think those are not warranted on the GCC 12 branch. Totally

[Bug tree-optimization/105679] [12 Regression] extra -Warray-bounds warning added with -fsanitize=shift due to jump threading

2022-10-06 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105679 Kees Cook changed: What|Removed |Added CC||qing.zhao at oracle dot com --- Comment #9

[Bug c/107162] New: -Wmisleading-indentation is blinded by comments

2022-10-05 Thread kees at outflux dot net via Gcc-bugs
Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Hi, Similar to this bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106528 -Wmissing-indentation is blinded by comments: int square(int num) { if (num == 1

[Bug ipa/96503] attribute alloc_size effect lost after inlining

2022-09-29 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96503 Kees Cook changed: What|Removed |Added CC||kees at outflux dot net --- Comment #1 from

[Bug tree-optimization/105679] [12 Regression] extra -Warray-bounds warning added with -fsanitize=shift due to jump threading

2022-07-30 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105679 --- Comment #6 from Kees Cook --- (In reply to Richard Biener from comment #5) > Should be fixed on trunk. Can you check on the original unreduced testcase? Thanks! I've done test builds and can confirm these two false positives have been elim

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-07-22 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #41 from Kees Cook --- (In reply to Bill Wendling from comment #40) > The question then is if `-fstrict-flex-arrays=3' is used, what does a `[0]' > at the end of a struct represent (assuming GCC no longer treats it as an > FAM)? It'

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-07-06 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #34 from Kees Cook --- -fstrict-flex-arrays=3 is still needed. (E.g. for proper FORTIFY coverage, etc.) I don't have an opinion about the -W options, though.(In reply to James Y Knight from comment #33) > (In reply to qinzhao from co

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-13 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #21 from Kees Cook --- (In reply to Martin Sebor from comment #20) > Well, I just "asked" for such an option the same way you asked for > -fstrict-flex-arrays in comment #3, because I believe it would be useful to > make the BOS impr

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-13 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #19 from Kees Cook --- (In reply to Martin Sebor from comment #18) > The zero size case exists (and is documented) solely as a substitute for > flexible array members. Treating is as an ordinary array would disable that > extension.

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-11 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #17 from Kees Cook --- (In reply to qinzhao from comment #16) > additional work are needed in order to make this task complete: > > 1. add one more new gcc option: > > -fstrict-flex-arrays > > when it's on, only treat the followin

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-06-08 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #13 from Kees Cook --- Maybe the enum needs to also be expanded so that [0] can be distinguished from []?

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-05-27 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #11 from Kees Cook --- and with a flex array to compare: https://godbolt.org/z/s9nb4Y7q4

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-05-27 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #10 from Kees Cook --- Here's a slightly reworked example: https://godbolt.org/z/EvehMax84

[Bug middle-end/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2022-05-27 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #9 from Kees Cook --- Just to clarify, __builtin_dynamic_object_size() shouldn't have anything to do with this. What's needed is something like -fstrict-flex-arrays so that all the "trailing array is a flex array" assumptions can be

[Bug c/105679] erroneous -Warray-bounds warning with sanitizer

2022-05-20 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105679 --- Comment #1 from Kees Cook --- The Linux kernel has encountered at least two of these (seen as specifically "array subscript 32", though the root cause may be causing many others: ../drivers/net/wireless/ath/ath9k/mac.c:373:22: warning: arra

[Bug c/105679] New: erroneous -Warray-bounds warning with sanitizer

2022-05-20 Thread kees at outflux dot net via Gcc-bugs
Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Created attachment 53010 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53010&action=edit test case minimized as much as possible Some combination of things

[Bug middle-end/105539] -ftrivial-auto-var-init=zero happening too late?

2022-05-10 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105539 --- Comment #7 from Kees Cook --- Right, perhaps I should rename this bug? The much more surprising thing is the lack of warning about the uninit use. With or without -ftrivial-auto-var-init, I'd want to have the diagnostic that a UB may have ha

[Bug c/105539] -ftrivial-auto-var-init=zero happening too late?

2022-05-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105539 --- Comment #2 from Kees Cook --- https://godbolt.org/z/99Pdro9Te

[Bug c/105539] -ftrivial-auto-var-init=zero happening too late?

2022-05-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105539 --- Comment #1 from Kees Cook --- (Also this doesn't warn about y being used uninitialized.)

[Bug c/105539] New: -ftrivial-auto-var-init=zero happening too late?

2022-05-09 Thread kees at outflux dot net via Gcc-bugs
Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- It looks like some pass is being run before the initializers are added: int x (int z) { int y; if (z) y = 10; return y; } under "gcc -ftrivial-aut

[Bug middle-end/99578] [11/12 Regression] gcc-11 -Warray-bounds or -Wstringop-overread warning when accessing a pointer from integer literal

2022-03-16 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 Kees Cook changed: What|Removed |Added CC||kees at outflux dot net --- Comment #30

[Bug middle-end/102276] -ftrivial-auto-var-init fails to initialize a variable, causes a spurious warning

2022-02-12 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102276 --- Comment #4 from Kees Cook --- The kernel keeps gaining more of these cases, so it'll be important to get this fixed: https://lore.kernel.org/lkml/200fe5cb203ad5cc00c5c60b7ded2cd85c9b85ea.ca...@perches.com/

[Bug middle-end/104504] spurious -Wswitch-unreachable warning with -ftrivial-auto-var-init=zero

2022-02-12 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104504 --- Comment #4 from Kees Cook --- (Ah, I knew this had been reported before. I found it now...) Duplicate of: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102276

[Bug middle-end/104504] spurious -Wswitch-unreachable warning with -ftrivial-auto-var-init=zero

2022-02-11 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104504 --- Comment #2 from Kees Cook --- As mentioned in a Linux kernel thread, isn't it possible to transform this: switch (x) { int y; default: y = x * 2; return y; } into this: { int y; switch (x) { de

[Bug middle-end/104504] spurious -Wswitch-unreachable warning with -ftrivial-auto-var-init=zero

2022-02-11 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104504 Kees Cook changed: What|Removed |Added CC||kees at outflux dot net --- Comment #1

[Bug middle-end/77608] missing protection on trivially detectable runtime buffer overflow

2021-10-13 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77608 Kees Cook changed: What|Removed |Added CC||kees at outflux dot net --- Comment #5 from

[Bug c/94428] Reintroduce -Wzero-length-array

2021-09-24 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94428 --- Comment #2 from Kees Cook --- Note that this needs a struct attribute that will allow structs to be excluded from the diagnostic (since the kernel needs to deal with legacy UAPI headers forever).

[Bug sanitizer/102317] signed integer overflow sanitizer cannot work well with -fno-strict-overflow

2021-09-23 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102317 --- Comment #11 from Kees Cook --- The trouble with "optimize" is that it just doesn't work. The kernel has banned its use because it results in all other optimization options being forgotten for the function in question.

[Bug target/102352] New: Add -mstack-protector-guard=... for arm32

2021-09-15 Thread kees at outflux dot net via Gcc-bugs
: target Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- As done for powerpc (1b3254e4bbe82245421a55324bc8fe34a99c6e3c), aarch64 (cd0b2d361df82c848dc7e1c3078651bb0624c3c6), riscv (c931e8d5a96463427040b0d11f9c4352ac22b2b0), and x86

[Bug sanitizer/102317] signed integer overflow sanitizer cannot work well with -fno-strict-overflow

2021-09-14 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102317 --- Comment #9 from Kees Cook --- (In reply to Jakub Jelinek from comment #8) > So, instead (when building the kernel with sanitization) build with > -fsanitize=signed-integer-overflow and no -fno-strict-overflow, and > the routines where you wa

[Bug middle-end/102276] -ftrivial-auto-var-init fails to initialize a variable, causes a spurious warning

2021-09-14 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102276 Kees Cook changed: What|Removed |Added CC||kees at outflux dot net --- Comment #3

[Bug sanitizer/102317] signed integer overflow sanitizer cannot work well with -fno-strict-overflow

2021-09-14 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102317 --- Comment #7 from Kees Cook --- The problem the kernel needs to solve is basically having our cake and eating it too. :) In _most_ situations, we want signed overflows to trap (i.e. get caught by "-fsanitize=signed-integer-overflow"). In som

[Bug middle-end/101891] New: Adjust -fzero-call-used-regs to always use XOR

2021-08-12 Thread kees at outflux dot net via Gcc-bugs
Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Currently -fzero-call-used-regs will use a pattern of: XOR regA,regA MOV regA,regB MOV regA,regC ... RET However, this introduces both a register ordering dependency

[Bug c/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2021-08-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 --- Comment #3 from Kees Cook --- Eww. That means _FORTIFY_SOURCE doesn't work correctly. Can there please be a -fstrict-flex-arrays or something to turn off all the heuristics so a code base can declare it only uses flex arrays for dynamic tra

[Bug c/101836] New: __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2021-08-09 Thread kees at outflux dot net via Gcc-bugs
MED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Created attachment 51282 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51282&action=edit str

[Bug c/101832] __builtin_object_size(P->M, 1) where M ends with a flex-array behaves like sizeof()

2021-08-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832 --- Comment #5 from Kees Cook --- Perhaps the best question to ask is "given an arbitrary argument, how can code detect the remaining bytes of a member, including if the member contains a flexible array?" Because right now, this does not work:

[Bug c/101832] __builtin_object_size(P->M, 1) where M ends with a flex-array behaves like sizeof()

2021-08-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832 --- Comment #4 from Kees Cook --- It seems like this isn't about crossing field boundaries -- it's asking "how large is this particular member?" and bos can't know the answer because there is a flex-array. Why would __builtin_object_size(

[Bug c/101832] __builtin_object_size(P->M, 1) where M ends with a flex-array behaves like sizeof()

2021-08-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832 --- Comment #2 from Kees Cook --- Created attachment 51280 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51280&action=edit Same PoC, but with malloc to provide non-unlimited bounds

[Bug c/101832] __builtin_object_size(P->M, 1) where M ends with a flex-array behaves like sizeof()

2021-08-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832 --- Comment #1 from Kees Cook --- This is even more visible when the size IS known (via malloc hinting, for example): https://godbolt.org/z/4v5rKbhaf

[Bug c/101832] New: __builtin_object_size(P->M, 1) where M ends with a flex-array behaves like sizeof()

2021-08-09 Thread kees at outflux dot net via Gcc-bugs
MED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Created attachment 51279 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51279&action=edit bos1 fails to

[Bug c/101419] New: collapsing memset() calls can break __builtin_object_size()

2021-07-11 Thread kees at outflux dot net via Gcc-bugs
Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Created attachment 51131 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51131&action=edit memset collapsing breaks __builtin_obje

[Bug sanitizer/96829] New: implement -fsanitize=unsigned-integer-overflow

2020-08-27 Thread kees at outflux dot net
: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone

[Bug c/94428] New: Reintroduce -Wzero-length-array

2020-04-01 Thread kees at outflux dot net
Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- It would be nice to gain "-Wzero-length-array" so we can enforce this standard in the Linux kernel once all conversions have moved struct to flexible array members. Clang supports

[Bug sanitizer/92589] heuristic to avoid flexible array members too liberal

2020-03-31 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92589 --- Comment #8 from Kees Cook --- Created attachment 48153 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48153&action=edit updated PoC

[Bug sanitizer/92589] heuristic to avoid flexible array members too liberal

2020-03-31 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92589 --- Comment #7 from Kees Cook --- (In reply to Kees Cook from comment #6) > (In reply to Jakub Jelinek from comment #4) > > (In reply to Kees Cook from comment #2) > > > Is there anything to enforce a strict "only consider empty array size as > >

[Bug sanitizer/92589] heuristic to avoid flexible array members too liberal

2020-03-31 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92589 --- Comment #6 from Kees Cook --- (In reply to Jakub Jelinek from comment #4) > (In reply to Kees Cook from comment #2) > > Is there anything to enforce a strict "only consider empty array size as > > flexible array member" mode? This is an unfor

[Bug sanitizer/94307] Provide a way to declare the *SAN exception handler -fsanitize-undefined-trap-on-error

2020-03-30 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94307 --- Comment #5 from Kees Cook --- Hi! I recently learned that Clang has -fsanitizer-minimal-runtime that is very close to what I was expecting to use: https://bugs.llvm.org/show_bug.cgi?id=45295 That is close to what you're already suggesting.

[Bug sanitizer/94307] New: Provide a way to declare the *SAN exception handler -fsanitize-undefined-trap-on-error

2020-03-24 Thread kees at outflux dot net
Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot

[Bug sanitizer/92589] heuristic to avoid flexible array members too liberal

2019-11-19 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92589 --- Comment #2 from Kees Cook --- Is there anything to enforce a strict "only consider empty array size as flexible array member" mode? This is an unfortunate weakening of the array bounds checker as there are plenty of structures that have a fix

[Bug sanitizer/92589] New: heuristic to avoid flexible array members too liberal

2019-11-19 Thread kees at outflux dot net
Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target

[Bug middle-end/90673] A problem with 'copy destination size is too small' error in copy_from_user

2019-06-05 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90673 Kees Cook changed: What|Removed |Added CC||kees at outflux dot net --- Comment #5 from

[Bug c/85310] optimization ignoring strlen() results

2018-04-09 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85310 --- Comment #4 from Kees Cook --- But it's optimizing away the check. If strlen() were suddenly acting like strnlen(), that'd be one thing, but the return value from strlen() is being used by the memcpy() without the actual test in between. That'

[Bug c/85310] optimization ignoring strlen() results

2018-04-09 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85310 Kees Cook changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID

[Bug c/85310] New: optimization ignoring strlen() results

2018-04-09 Thread kees at outflux dot net
Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- Created attachment 43889 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43889&action=edit test case Something is gcc 8 is broken when dealing with strlen() results. The

[Bug target/82303] Better PIE/PIC code generation for kernel code (x86_64 & arm64)

2018-01-17 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82303 Kees Cook changed: What|Removed |Added CC||kees at outflux dot net --- Comment #3 from

[Bug target/82411] const is not always read-only

2017-10-04 Thread kees at outflux dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82411 --- Comment #3 from Kees Cook --- To clarify, using -mno-sdata means all things are removed from sdata, not just const, yes? I'd like to be able to leave writable stuff there, to avoid any additional performance penalty.

[Bug c/82411] New: const is not always read-only

2017-10-02 Thread kees at outflux dot net
Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- On powerpc, a const variable may end up in the .sdata section, which is writable. This means authors cannot depend on the "const" marking to mean "read-only", as is required f

[Bug testsuite/39536] add more VERIFY() calls to certain functions in libstdc++-v3 testsuite

2010-06-27 Thread kees at outflux dot net
--- Comment #2 from kees at outflux dot net 2010-06-27 17:55 --- http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02690.html -- kees at outflux dot net changed: What|Removed |Added

[Bug testsuite/39537] overhaul printf formats and type casts in testsuite

2009-03-24 Thread kees at outflux dot net
--- Comment #6 from kees at outflux dot net 2009-03-24 17:39 --- I'm trying to minimize the Ubuntu patch by getting changes accepted for the FSF GCC testsuite. I'm hoping to demonstrate that many of the changes are valid and represent stricter C coding, though none change th

[Bug testsuite/39537] overhaul printf formats and type casts in testsuite

2009-03-24 Thread kees at outflux dot net
--- Comment #3 from kees at outflux dot net 2009-03-24 07:10 --- g++.old-deja/g++.pt/t39.C: It looks like ptr[0],[1],[2] are either int or const char (i.e. ptr is int* or const char*). %p doesn't make much sense in those cases, so I opted for a cast. I'm not sure I followed

[Bug testsuite/39537] overhaul printf formats and type casts in testsuite

2009-03-23 Thread kees at outflux dot net
--- Comment #1 from kees at outflux dot net 2009-03-24 06:34 --- Created an attachment (id=17530) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17530&action=view) testsuite updates for format strings and casts -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39537

[Bug testsuite/39537] New: overhaul printf formats and type casts in testsuite

2009-03-23 Thread kees at outflux dot net
ReportedBy: kees at outflux dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39537

[Bug testsuite/39536] add more VERIFY() calls to certain functions in libstdc++-v3 testsuite

2009-03-23 Thread kees at outflux dot net
--- Comment #1 from kees at outflux dot net 2009-03-24 06:27 --- Created an attachment (id=17529) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17529&action=view) more VERIFY() calls in libstdc++ testsuite -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39536

[Bug testsuite/39536] New: add more VERIFY() calls to certain functions in libstdc++-v3 testsuite

2009-03-23 Thread kees at outflux dot net
: UNCONFIRMED Severity: enhancement Priority: P3 Component: testsuite AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kees at outflux dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39536

[Bug target/38902] __builtin_strcpy doesn't work with -fstack-protector

2009-01-18 Thread kees at outflux dot net
--- Comment #5 from kees at outflux dot net 2009-01-18 18:12 --- Created an attachment (id=17135) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17135&action=view) multiple tests for the regression This contains a series of tests, none of which should fail. --

[Bug c++/38562] [4.3/4.4 regression] mysql miscompiles and causes testsuite failures

2008-12-21 Thread kees at outflux dot net
--- Comment #9 from kees at outflux dot net 2008-12-22 01:01 --- Yes! Adding "-fno-strict-aliasing" to a normal (-O2) build seems to have fixed the problems so far. The full test suite takes a while, but the early failures are not present any more. I will report more once i

[Bug c++/38562] [4.3/4.4 regression] mysql miscompiles and causes testsuite failures

2008-12-17 Thread kees at outflux dot net
--- Comment #7 from kees at outflux dot net 2008-12-18 01:07 --- Created an attachment (id=16925) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16925&action=view) 4.4.0 -E output of log_event.cc (bzip2) $ /usr/lib/gcc-snapshot/bin/g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME=

[Bug c++/38562] mysql miscompiles and causes testsuite failures

2008-12-17 Thread kees at outflux dot net
--- Comment #5 from kees at outflux dot net 2008-12-18 00:40 --- Created an attachment (id=16923) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16923&action=view) obj file from -O2 gcc 4.3.2 -- kees at outflux dot net changed: What|

[Bug c++/38562] mysql miscompiles and causes testsuite failures

2008-12-17 Thread kees at outflux dot net
--- Comment #4 from kees at outflux dot net 2008-12-18 00:39 --- Created an attachment (id=16922) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16922&action=view) obj file from -O2 gcc 4.4.0 20081212 (experimental) [trunk revision 142725] -- kees at outflux dot net

[Bug c++/38562] mysql miscompiles and causes testsuite failures

2008-12-17 Thread kees at outflux dot net
--- Comment #6 from kees at outflux dot net 2008-12-18 00:41 --- Created an attachment (id=16924) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16924&action=view) obj file from -O1 gcc 4.4.0 20081212 (experimental) [trunk revision 142725] -- http://gcc.gnu.org/b

[Bug c++/38562] mysql miscompiles and causes testsuite failures

2008-12-17 Thread kees at outflux dot net
--- Comment #3 from kees at outflux dot net 2008-12-18 00:38 --- Created an attachment (id=16921) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16921&action=view) obj file from -O2 gcc 4.4.0 20081212 (experimental) [trunk revision 142725] -- http://gcc.gnu.org/b

  1   2   >