[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How can Autoconf help with the transition to stricter compilation de
From: |
Michael Matz |
Subject: |
Re: How can Autoconf help with the transition to stricter compilation defaults? |
Date: |
Wed, 16 Nov 2022 14:26:52 +0000 (UTC) |
User-agent: |
Alpine 2.20 (LSU 67 2015-01-07) |
Hi,
On Tue, 15 Nov 2022, Paul Eggert wrote:
> On 2022-11-15 11:27, Jonathan Wakely wrote:
> > Another perspective is that autoconf shouldn't get in the way of
> > making the C and C++ toolchain more secure by default.
>
> Can you cite any examples of a real-world security flaw what would be
> found by Clang erroring out because 'char foo(void);' is the wrong
> prototype? Is it plausible that any such security flaw exists?
>
> On the contrary, it's more likely that Clang's erroring out here would
> *introduce* a security flaw, because it would cause 'configure' to
> incorrectly infer that an important security-relevant function is
> missing and that a flawed substitute needs to be used.
>
> Let's focus on real problems rather than worrying about imaginary ones.
I sympathize, and I would think a compiler emitting an error (not a
warning) in the situation at hand (in absence of -Werror) is overly
pedantic. But, could autoconf perhaps avoid the problem? AFAICS the
ac_fn_c_check_func really does only a link test to check for symbol
existence, and the perceived problem is that the call statement in main()
invokes UB. So, let's avoid the call then while retaining the access to
the symbol? Like:
-----
char foobar(void);
int main(void) {
return &foobar != 0;
}
-----
No call involved: no reason for compiler to complain. The prototype decl
itself will still be "wrong", but compilers complaining about that (in
absence of a pre-existing different prototype, which is avoided by
autoconf) seem unlikely.
Obviously this program will also say "foobar exists" if it's a data
symbol, but that's the same with the variant using the call on most
platforms (after all it's not run).
The idea is so obvious that I'm probably missing something, why autoconf
can't use that idiom instead. But perhaps the (historic?) reasons why it
couldn't be used are gone now?
Ciao,
Michael.
- Re: How can Autoconf help with the transition to stricter compilation defaults?, (continued)
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/14
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Aaron Ballman, 2022/11/14
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Florian Weimer, 2022/11/14
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Jonathan Wakely, 2022/11/15
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/15
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Jonathan Wakely, 2022/11/15
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/15
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Aaron Ballman, 2022/11/15
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/15
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Ben Boeckel, 2022/11/15
- Re: How can Autoconf help with the transition to stricter compilation defaults?,
Michael Matz <=
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Alexander Monakov, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Michael Matz, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Richard Biener, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Sam James, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Michael Matz, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Jonathan Wakely, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Michael Matz, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Jonathan Wakely, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Paul Eggert, 2022/11/16
- Re: How can Autoconf help with the transition to stricter compilation defaults?, Jeffrey Walton, 2022/11/16