Re: [PATCH 0/5] Improvements of the stackleak gcc plugin

2020-06-04 Thread Kees Cook via Gcc
On Thu, Jun 04, 2020 at 04:49:52PM +0300, Alexander Popov wrote: > In this patch series I collected various improvements of the stackleak > gcc plugin. Great; thank you! I'll take a closer look at this shortly! -- Kees Cook

Re: [PATCH 1/5] gcc-plugins/stackleak: Exclude alloca() from the instrumentation logic

2020-06-09 Thread Kees Cook via Gcc
On Thu, Jun 04, 2020 at 06:23:38PM +0300, Alexander Popov wrote: > On 04.06.2020 17:01, Jann Horn wrote: > > On Thu, Jun 4, 2020 at 3:51 PM Alexander Popov wrote: > >> Some time ago Variable Length Arrays (VLA) were removed from the kernel. > >> The kernel is built with '-Wvla'. Let's exclude allo

Re: [PATCH 3/5] gcc-plugins/stackleak: Add 'verbose' plugin parameter

2020-06-09 Thread Kees Cook via Gcc
On Thu, Jun 04, 2020 at 04:49:55PM +0300, Alexander Popov wrote: > Add 'verbose' plugin parameter for stackleak gcc plugin. > It can be used for printing additional info about the kernel code > instrumentation. > > For using it add the following to scripts/Makefile.gcc-plugins: > gcc-plugin-cfla

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

2020-06-09 Thread Kees Cook via Gcc
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 i3

Re: [PATCH 4/5] gcc-plugins/stackleak: Don't instrument itself

2020-06-09 Thread Kees Cook via Gcc
On Thu, Jun 04, 2020 at 04:49:56PM +0300, Alexander Popov wrote: > There is no need to try instrumenting functions in kernel/stackleak.c. > Otherwise that can cause issues if the cleanup pass of stackleak gcc plugin > is disabled. > > Signed-off-by: Alexander Popov Acked-by: Kees Cook -- Kees

Re: [PATCH 5/5] gcc-plugins/stackleak: Don't instrument vgettimeofday.c in arm64 VDSO

2020-06-09 Thread Kees Cook via Gcc
On Thu, Jun 04, 2020 at 02:58:06PM +0100, Will Deacon wrote: > On Thu, Jun 04, 2020 at 04:49:57PM +0300, Alexander Popov wrote: > > Don't try instrumenting functions in arch/arm64/kernel/vdso/vgettimeofday.c. > > Otherwise that can cause issues if the cleanup pass of stackleak gcc plugin > > is dis

Re: [PATCH 0/5] Improvements of the stackleak gcc plugin

2020-06-09 Thread Kees Cook via Gcc
On Thu, Jun 04, 2020 at 04:49:52PM +0300, Alexander Popov wrote: > In this patch series I collected various improvements of the stackleak > gcc plugin. Thanks! > Alexander Popov (5): > gcc-plugins/stackleak: Exclude alloca() from the instrumentation logic > gcc-plugins/stackleak: Use asm inst

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

2020-06-10 Thread Kees Cook via Gcc
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 spectacula

Re: [PATCH 3/5] gcc-plugins/stackleak: Add 'verbose' plugin parameter

2020-06-10 Thread Kees Cook via Gcc
On Wed, Jun 10, 2020 at 06:52:10PM +0300, Alexander Popov wrote: > On 09.06.2020 21:47, Kees Cook wrote: > > On Thu, Jun 04, 2020 at 04:49:55PM +0300, Alexander Popov wrote: > >> Add 'verbose' plugin parameter for stackleak gcc plugin. > >> It can be used for printing additional info about the kern

Re: [PATCH v2 5/5] gcc-plugins/stackleak: Add 'verbose' plugin parameter

2020-06-24 Thread Kees Cook via Gcc
On Wed, Jun 24, 2020 at 04:09:20PM +0300, Alexander Popov wrote: > On 24.06.2020 15:53, Luis Chamberlain wrote: > > On Wed, Jun 24, 2020 at 03:33:30PM +0300, Alexander Popov wrote: > >> Add 'verbose' plugin parameter for stackleak gcc plugin. > >> It can be used for printing additional info about t

Re: [PATCH v2 3/5] arm64: vdso: Don't use gcc plugins for building vgettimeofday.c

2020-06-24 Thread Kees Cook via Gcc
On Wed, Jun 24, 2020 at 03:33:28PM +0300, Alexander Popov wrote: > Don't use gcc plugins for building arch/arm64/kernel/vdso/vgettimeofday.c > to avoid unneeded instrumentation. > > Signed-off-by: Alexander Popov It looks like Will has taken this already, but: Acked-by: Kees Cook -- Kees Coo

Re: [PATCH v2 1/5] gcc-plugins/stackleak: Don't instrument itself

2020-06-24 Thread Kees Cook via Gcc
On Wed, Jun 24, 2020 at 03:33:26PM +0300, Alexander Popov wrote: > There is no need to try instrumenting functions in kernel/stackleak.c. > Otherwise that can cause issues if the cleanup pass of stackleak gcc plugin > is disabled. > > Signed-off-by: Alexander Popov > Acked-by: Kees Cook Thanks!

Re: [PATCH v2 2/5] ARM: vdso: Don't use gcc plugins for building vgettimeofday.c

2020-06-24 Thread Kees Cook via Gcc
On Wed, Jun 24, 2020 at 03:33:27PM +0300, Alexander Popov wrote: > Don't use gcc plugins for building arch/arm/vdso/vgettimeofday.c to > avoid unneeded instrumentation. > > Signed-off-by: Alexander Popov Applied to for-next/gcc-plugins. -- Kees Cook

Re: [PATCH v2 5/5] gcc-plugins/stackleak: Add 'verbose' plugin parameter

2020-06-24 Thread Kees Cook via Gcc
On Wed, Jun 24, 2020 at 03:33:30PM +0300, Alexander Popov wrote: > Add 'verbose' plugin parameter for stackleak gcc plugin. > It can be used for printing additional info about the kernel code > instrumentation. > > For using it add the following to scripts/Makefile.gcc-plugins: > gcc-plugin-cfla

Re: [wish] Flexible array members in unions

2023-05-11 Thread Kees Cook via Gcc
On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote: > On 5/11/23 18:07, Alejandro Colomar wrote: > [...] > > Would you allow flexible array members in unions? Is there any > > strong reason to disallow them? Yes please!! And alone in a struct, too. AFAICT, there is no mechanical/a

Re: [wish] Flexible array members in unions

2023-05-11 Thread Kees Cook via Gcc
On Thu, May 11, 2023 at 08:53:52PM +, Joseph Myers wrote: > On Thu, 11 May 2023, Kees Cook via Gcc wrote: > > > On Thu, May 11, 2023 at 06:29:10PM +0200, Alejandro Colomar wrote: > > > On 5/11/23 18:07, Alejandro Colomar wrote: > > > [...] > > > >

Re: [wish] Flexible array members in unions

2023-05-11 Thread Kees Cook via Gcc
On Thu, May 11, 2023 at 09:43:49PM +, Joseph Myers wrote: > On Thu, 11 May 2023, Kees Cook via Gcc wrote: > > > Why are zero-sized objects missing in Standard C? Or, perhaps, the better > > question is: what's needed to support the idea of a zero-sized object? >

Re: Question on -fwrapv and -fwrapv-pointer

2023-09-20 Thread Kees Cook via Gcc
On Sat, Sep 16, 2023 at 10:36:52AM +0200, Martin Uecker wrote: > > On Fri, Sep 15, 2023 at 08:18:28AM -0700, Andrew Pinski wrote: > > > On Fri, Sep 15, 2023 at 8:12 AM Qing Zhao wrote: > > > > > > > > > > > > > > > > > On Sep 15, 2023, at 3:43 AM, Xi Ruoyao wrote: > > > > > > > > > > On Thu, 2023

Re: Question on -fwrapv and -fwrapv-pointer

2023-09-23 Thread Kees Cook via Gcc
On Wed, Sep 20, 2023 at 11:16:21PM +0200, Martin Uecker wrote: > I meant something else: Why wasn't an unsigned type > used in the first place? If all "counter" variables were > signed and all "modulo" variables unsigned, one could already  > diagnose overflow reliably. > > I was trying to unde