Re: [PATCH 2/5] gcc-plugins/stackleak: Use asm instrumentation to avoid useless register saving

2020-06-11 Thread Alexander Popov
On 10.06.2020 23:03, Kees Cook wrote: > On Wed, Jun 10, 2020 at 06:47:14PM +0300, Alexander Popov wrote: >> On 09.06.2020 21:46, Kees Cook wrote: >> The inline asm statement that is used for instrumentation is arch-specific. >> Trying to add >> asm volatile("call stackleak_track_stack") >> in

Re: [PATCH 2/5] gcc-plugins/stackleak: Use asm instrumentation to avoid useless register saving

2020-06-10 Thread Kees Cook
On Wed, Jun 10, 2020 at 06:47:14PM +0300, Alexander Popov wrote: > On 09.06.2020 21:46, Kees Cook wrote: > The inline asm statement that is used for instrumentation is arch-specific. > Trying to add > asm volatile("call stackleak_track_stack") > in gcc plugin on aarch64 makes gcc break

Re: [PATCH 2/5] gcc-plugins/stackleak: Use asm instrumentation to avoid useless register saving

2020-06-10 Thread Alexander Popov
On 09.06.2020 21:46, Kees Cook wrote: > On Thu, Jun 04, 2020 at 04:49:54PM +0300, Alexander Popov wrote: >> Let's improve the instrumentation to avoid this: >> >> 1. Make stackleak_track_stack() save all register that it works with. >> Use no_caller_saved_registers attribute for that function.

Re: [PATCH 2/5] gcc-plugins/stackleak: Use asm instrumentation to avoid useless register saving

2020-06-09 Thread Kees Cook
On Thu, Jun 04, 2020 at 04:49:54PM +0300, Alexander Popov wrote: > Let's improve the instrumentation to avoid this: > > 1. Make stackleak_track_stack() save all register that it works with. > Use no_caller_saved_registers attribute for that function. This attribute > is available for x86_64 and

Re: [PATCH 2/5] gcc-plugins/stackleak: Use asm instrumentation to avoid useless register saving

2020-06-04 Thread Miguel Ojeda
Hi Alexander, On Thu, Jun 4, 2020 at 3:50 PM Alexander Popov wrote: > > diff --git a/include/linux/compiler_attributes.h > b/include/linux/compiler_attributes.h > index cdf016596659..522d57ae8532 100644 > --- a/include/linux/compiler_attributes.h > +++ b/include/linux/compiler_attributes.h > @@

[PATCH 2/5] gcc-plugins/stackleak: Use asm instrumentation to avoid useless register saving

2020-06-04 Thread Alexander Popov
The kernel code instrumentation in stackleak gcc plugin works in two stages. At first, stack tracking is added to GIMPLE representation of every function (except some special cases). And later, when stack frame size info is available, stack tracking is removed from the RTL representation of the