Re: RFC: pass to warn on questionable uses of alloca().

2016-06-30 Thread Martin Sebor
On 06/30/2016 06:01 AM, Aldy Hernandez wrote: On 06/18/2016 07:55 PM, Martin Sebor wrote: On 06/16/2016 02:32 AM, Aldy Hernandez wrote: p.s. The pass currently warns on all uses of VLAs. I'm not completely sold on this idea, so perhaps we could remove it, or gate it with a flag. I also thi

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-30 Thread Aldy Hernandez
On 06/18/2016 07:55 PM, Martin Sebor wrote: On 06/16/2016 02:32 AM, Aldy Hernandez wrote: p.s. The pass currently warns on all uses of VLAs. I'm not completely sold on this idea, so perhaps we could remove it, or gate it with a flag. I also think that VLA diagnostics would be better control

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-28 Thread Szabolcs Nagy
On 21/06/16 17:52, Martin Sebor wrote: > On 06/21/2016 10:00 AM, Jakub Jelinek wrote: >> On Tue, Jun 21, 2016 at 09:57:59AM -0600, Jeff Law wrote: Would a new attribute to annotate async-signal safe functions help? I envision that the attribute on a function definition would turn of

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-28 Thread Martin Sebor
On 06/28/2016 08:40 AM, Aldy Hernandez wrote: Hi. In addressing the issues that were brought up I ran into bounded allocas that are bounded by an unknown size. Should we warn on these?: if (n < SOME_GLOBAL) alloca(n) In my WIP I am warning with: x.c:6:5: warning: alloca

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-28 Thread Aldy Hernandez
Hi. In addressing the issues that were brought up I ran into bounded allocas that are bounded by an unknown size. Should we warn on these?: if (n < SOME_GLOBAL) alloca(n) In my WIP I am warning with: x.c:6:5: warning: alloca bound is unknown [-Walloca] Though

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-21 Thread Martin Sebor
On 06/21/2016 10:00 AM, Jakub Jelinek wrote: On Tue, Jun 21, 2016 at 09:57:59AM -0600, Jeff Law wrote: Would a new attribute to annotate async-signal safe functions help? I envision that the attribute on a function definition would turn off the alloca/VLA to malloc transformation, and could als

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-21 Thread Jakub Jelinek
On Tue, Jun 21, 2016 at 09:57:59AM -0600, Jeff Law wrote: > >Would a new attribute to annotate async-signal safe functions > >help? I envision that the attribute on a function definition > >would turn off the alloca/VLA to malloc transformation, and > >could also diagnose calls to other function w

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-21 Thread Jeff Law
On 06/21/2016 09:51 AM, Martin Sebor wrote: On 06/20/2016 03:41 PM, Jeff Law wrote: On 06/20/2016 08:56 AM, Joseph Myers wrote: On Sat, 18 Jun 2016, Martin Sebor wrote: the function regardless of the value of its argument). At the same time, it seems that an even more reliable solution than

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-21 Thread Martin Sebor
On 06/20/2016 03:41 PM, Jeff Law wrote: On 06/20/2016 08:56 AM, Joseph Myers wrote: On Sat, 18 Jun 2016, Martin Sebor wrote: the function regardless of the value of its argument). At the same time, it seems that an even more reliable solution than pointing out potentially unsafe calls to the

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-20 Thread Jeff Law
On 06/18/2016 05:55 PM, Martin Sebor wrote: I think detecting potentially problematic uses of alloca would be useful, especially when done in an intelligent way like in your patch (as opposed to simply diagnosing every call to the function regardless of the value of its argument). At the same

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-20 Thread Jeff Law
On 06/20/2016 08:56 AM, Joseph Myers wrote: On Sat, 18 Jun 2016, Martin Sebor wrote: the function regardless of the value of its argument). At the same time, it seems that an even more reliable solution than pointing out potentially unsafe calls to the function and relying on users to modify t

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-20 Thread Joseph Myers
On Sat, 18 Jun 2016, Martin Sebor wrote: > the function regardless of the value of its argument). At > the same time, it seems that an even more reliable solution > than pointing out potentially unsafe calls to the function > and relying on users to modify their code to use malloc for > large/unb

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-18 Thread Martin Sebor
On 06/16/2016 02:32 AM, Aldy Hernandez wrote: Hi folks! I've been working on a plugin to warn on unbounded uses of alloca() to help find questionable uses in glibc and other libraries. It occurred to me that the broader community could benefit from it, as it has found quite a few interesting ca

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-17 Thread Jeff Law
On 06/16/2016 02:32 AM, Aldy Hernandez wrote: Hi folks! I've been working on a plugin to warn on unbounded uses of alloca() to help find questionable uses in glibc and other libraries. It occurred to me that the broader community could benefit from it, as it has found quite a few interesting ca

Re: RFC: pass to warn on questionable uses of alloca().

2016-06-16 Thread Jakub Jelinek
On Thu, Jun 16, 2016 at 04:32:57AM -0400, Aldy Hernandez wrote: > p.s. The pass currently warns on all uses of VLAs. I'm not completely sold > on this idea, so perhaps we could remove it, or gate it with a flag. Just random nits, no comments on the idea of the patch. > * walloca.c: New pas

RFC: pass to warn on questionable uses of alloca().

2016-06-16 Thread Aldy Hernandez
Hi folks! I've been working on a plugin to warn on unbounded uses of alloca() to help find questionable uses in glibc and other libraries. It occurred to me that the broader community could benefit from it, as it has found quite a few interesting cases. So, I've reimplemented it as an actual