Re: [PATCH] x86/boot: add prototype for __fortify_panic()

2024-06-01 Thread Nikolay Borisov
On 31.05.24 г. 19:28 ч., Kees Cook wrote: On Thu, May 30, 2024 at 09:23:36AM -0700, Jeff Johnson wrote: On 5/30/2024 8:42 AM, Nikolay Borisov wrote: On 29.05.24 г. 21:09 ч., Jeff Johnson wrote: As discussed in [1] add a prototype for __fortify_panic() to fix the 'make W=1 C=1' warning: a

Re: [PATCH v2] wifi: brcm80211: use sizeof(*pointer) instead of sizeof(type)

2024-06-01 Thread Kalle Valo
Erick Archer wrote: > It is preferred to use sizeof(*pointer) instead of sizeof(type) > due to the type of the variable can change and one needs not > change the former (unlike the latter). This patch has no effect > on runtime behavior. > > At the same time remove some redundant NULL initializa

Re: [PATCH] sctp: annotate struct sctp_assoc_ids with __counted_by()

2024-06-01 Thread Erick Archer
Hi, On Wed, May 01, 2024 at 07:01:22PM +0200, Erick Archer wrote: > Prepare for the coming implementation by GCC and Clang of the > __counted_by attribute. Flexible array members annotated with > __counted_by can have their accesses bounds-checked at run-time via > CONFIG_UBSAN_BOUNDS (for array i

Re: [PATCH v2] x86/traps: Enable UBSAN traps on x86

2024-06-01 Thread Kees Cook
On Sat, Jun 01, 2024 at 03:10:05AM +, Gatlin Newhouse wrote: > +void handle_ubsan_failure(struct pt_regs *regs, int insn) > +{ > + u32 type = 0; > + > + if (insn == INSN_ASOP) { > + type = (*(u16 *)(regs->ip + LEN_ASOP + LEN_UD1)); > + if ((type & 0xFF) == 0x40)

[PATCH v4 0/3] Hardening perf subsystem

2024-06-01 Thread Erick Archer
Hi everyone, This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1][2]. In the first patch, the "struct amd_uncore_ctx" can be refactored to use a flex array for the "events" member. This way, the allocation/ freeing of the memory c

[PATCH v4 1/3] perf/x86/amd/uncore: Add flex array to struct amd_uncore_ctx

2024-06-01 Thread Erick Archer
This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1][2]. The "struct amd_uncore_ctx" can be refactored to use a flex array for the "events" member. This way, the allocation/freeing of the memory can be simplified. Specifically, as

[PATCH v4 2/3] perf/x86/intel/uncore: Prefer struct_size over open coded arithmetic

2024-06-01 Thread Erick Archer
This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1][2]. As the "box" variable is a pointer to "struct intel_uncore_box" and this structure ends in a flexible array: struct intel_uncore_box { [...] struct intel_unc

[PATCH v4 3/3] perf/ring_buffer: Prefer struct_size over open coded arithmetic

2024-06-01 Thread Erick Archer
This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1][2]. As the "rb" variable is a pointer to "struct perf_buffer" and this structure ends in a flexible array: struct perf_buffer { [...] void*data_pages[]; };

Re: [PATCH] kunit/fortify: Remove __kmalloc_node() test

2024-06-01 Thread Vlastimil Babka
On 5/31/24 8:57 PM, Kees Cook wrote: > __kmalloc_node() is considered an "internal" function to the Slab, so > drop it from explicit testing. So is __kmalloc() and so I have the removal of both as part of the cleanup here: https://lore.kernel.org/all/20240527090127.21979-2-vba...@suse.cz/ which