Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-08-13 Thread Daniele Buono
Yes, Something like that, probably with a small python script. On 8/10/2020 5:33 PM, Alexander Bulekov wrote: On 200810 2139, Paolo Bonzini wrote: On 10/08/20 21:01, Daniele Buono wrote: So I'm thinking of adding a check in configure. If gold is the linker, automatically create (somehow, still

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-08-10 Thread Alexander Bulekov
On 200810 2139, Paolo Bonzini wrote: > On 10/08/20 21:01, Daniele Buono wrote: > > So I'm thinking of adding a check in configure. If gold is the linker, > > automatically create (somehow, still working on it) the full link script > > by obtaining the default bfd script and add the required parts.

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-08-10 Thread Paolo Bonzini
On 10/08/20 21:01, Daniele Buono wrote: > So I'm thinking of adding a check in configure. If gold is the linker, > automatically create (somehow, still working on it) the full link script > by obtaining the default bfd script and add the required parts. Would > that work for you? Maybe even do it

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-08-10 Thread Daniele Buono
Hi Alex, Paolo Hitting a small issue while adding support for lto (and therefore cfi) to the fuzzer. The fuzzer requires a modified linker script to place all of the stuff that needs to persist across fuzzing runs into a contiguous section of memory. It does that by inserting three new sect

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-16 Thread Daniele Buono
On 7/2/2020 5:52 AM, Daniel P. Berrangé wrote: The need to maintain this list of functions makes me feel very uneasy. How can we have any confidence that this list of functions is accurate ? How will maintainers ensure that they correctly update it as they are writing/changing code, and how will

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Daniele Buono
Hey Alex! I agree, in most cases (possibly all of them), a wrong indirect function call will end up with something that is catched by ASan or UBSan. This way, however, you may catch it earlier and it may make debug easier (especially with --enable-cfi-debug which is printing an error with the

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Daniele Buono
On 7/2/2020 9:12 AM, Daniel P. Berrangé wrote: On Thu, Jul 02, 2020 at 08:50:08AM -0400, Daniele Buono wrote: On 7/2/2020 5:52 AM, Daniel P. Berrangé wrote: On Thu, Jul 02, 2020 at 01:49:48AM -0400, Daniele Buono wrote: This patch adds a flag to enable/disable control flow integrity checks o

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Alexander Bulekov
Can't wait to try this out! On 200702 1459, Paolo Bonzini wrote: > On 02/07/20 14:50, Daniele Buono wrote: > > I also wonder if this is something that could be put in the fuzzing > > environment. It would probably also help in finding coding error in > > corner cases quicker. > > Yes, fuzzing and

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Daniel P . Berrangé
On Thu, Jul 02, 2020 at 08:50:08AM -0400, Daniele Buono wrote: > > > On 7/2/2020 5:52 AM, Daniel P. Berrangé wrote: > > On Thu, Jul 02, 2020 at 01:49:48AM -0400, Daniele Buono wrote: > > > This patch adds a flag to enable/disable control flow integrity checks > > > on indirect function calls. Thi

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Paolo Bonzini
On 02/07/20 14:50, Daniele Buono wrote: > I also wonder if this is something that could be put in the fuzzing > environment. It would probably also help in finding coding error in > corner cases quicker. Yes, fuzzing and tests/docker/test-debug should enable CFI. Also, tests/docker/test-clang sho

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Daniele Buono
On 7/2/2020 5:52 AM, Daniel P. Berrangé wrote: On Thu, Jul 02, 2020 at 01:49:48AM -0400, Daniele Buono wrote: This patch adds a flag to enable/disable control flow integrity checks on indirect function calls. This feature is only provided by LLVM/Clang v3.9 or higher, and only allows indirect

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Daniele Buono
On 7/2/2020 5:45 AM, Paolo Bonzini wrote: On 02/07/20 07:49, Daniele Buono wrote: This patch adds a flag to enable/disable control flow integrity checks on indirect function calls. This feature is only provided by LLVM/Clang v3.9 or higher, and only allows indirect function calls to functions wi

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Daniel P . Berrangé
On Thu, Jul 02, 2020 at 01:49:48AM -0400, Daniele Buono wrote: > This patch adds a flag to enable/disable control flow integrity checks > on indirect function calls. This feature is only provided by LLVM/Clang > v3.9 or higher, and only allows indirect function calls to functions > with compatible

Re: [PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-02 Thread Paolo Bonzini
On 02/07/20 07:49, Daniele Buono wrote: > This patch adds a flag to enable/disable control flow integrity checks > on indirect function calls. This feature is only provided by LLVM/Clang > v3.9 or higher, and only allows indirect function calls to functions > with compatible signatures. > > We als

[PATCH 2/2] configure: add support for Control-Flow Integrity

2020-07-01 Thread Daniele Buono
This patch adds a flag to enable/disable control flow integrity checks on indirect function calls. This feature is only provided by LLVM/Clang v3.9 or higher, and only allows indirect function calls to functions with compatible signatures. We also add an option to enable a debugging version of cfi