Message ID | 20230730192605.2423480-1-bugaevc@gmail.com |
---|---|
Headers | show |
Series | fcntl fortification | expand |
On Sun, Jul 30, 2023, at 3:25 PM, Sergey Bugaev via Libc-alpha wrote:
> this is the v4 of the fcntl fortification work.
I apologize if this has already been discussed, but I can't find any mention of it. What does this patch do with code that supplies an *unnecessary* third argument to fcntl and/or open? (For example, `open(fname, O_RDONLY, 0)`.
I have seen this fairly often and it's harmless, so I think it should probably continue to be allowed. I can see an argument for warning about this, but I think that belongs in the compiler, with a dedicated -W option to squelch it.
zw
On 31/07/23 11:40, Zack Weinberg via Libc-alpha wrote: > On Sun, Jul 30, 2023, at 3:25 PM, Sergey Bugaev via Libc-alpha wrote: >> this is the v4 of the fcntl fortification work. > > I apologize if this has already been discussed, but I can't find any mention of it. What does this patch do with code that supplies an *unnecessary* third argument to fcntl and/or open? (For example, `open(fname, O_RDONLY, 0)`. > > I have seen this fairly often and it's harmless, so I think it should probably continue to be allowed. I can see an argument for warning about this, but I think that belongs in the compiler, with a dedicated -W option to squelch it. My understanding reviewing the previous revision is the other way around: like __open_2 the idea is warn if the fcntl requires a third argument based on second argument value. Like fortified open, adding an extra argument where it is not required should not trigger a fortify issue.