Re: [PATCH] printk: cleanup deprecated uses of strncpy/strcpy

2024-05-01 Thread Christophe JAILLET
Le 02/05/2024 à 01:18, Justin Stitt a écrit : On Wed, May 1, 2024 at 2:39 PM Christophe JAILLET wrote: Hi, Nit: The { } around each branch can now also be removed. There was one line before and there's one line now. In the block after the "else", yes, but now the block after the "if" is

RE: [PATCH][next] wifi: rtlwifi: Remove unused structs and avoid multiple -Wfamnae warnings

2024-05-01 Thread Ping-Ke Shih
Gustavo A. R. Silva wrote: > Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. > > So, remove unused structs and fix the following > -Wflex-array-member-not-at-end warnings: > > Signed-off-by: Gustavo A. R. Silva Acked-by: Ping-Ke Shih

Re: [PATCH][next] wifi: rtlwifi: Remove unused structs and avoid multiple -Wfamnae warnings

2024-05-01 Thread Kees Cook
On Wed, May 01, 2024 at 04:41:37PM -0600, Gustavo A. R. Silva wrote: > Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. > > So, remove unused structs and fix the following > -Wflex-array-member-not-at-end warnings: Heh. Yes! Very effective. :)

Re: [PATCH v3] scsi: csiostor: Use kcalloc() instead of kzalloc()

2024-05-01 Thread Finn Thain
On Wed, 1 May 2024, James Bottomley wrote: > > The code itself is fine unless you have a 32-bit system with a > > malicious card, so yeah, near zero risk. > > Well, no actually zero: we assume plugged in hardware to operate > correctly (had this argument in the driver hardening thread a while

[PATCH] string: Add additional __realloc_size() annotations for "dup" helpers

2024-05-01 Thread Kees Cook
Several other "dup"-style interfaces could use the __realloc_size() attribute. (As a reminder to myself and others: "realloc" is used here instead of "alloc" because the "alloc_size" attribute implies that the memory contents are uninitialized. Since we're copying contents into the resulting

[PATCH] kunit/fortify: Fix replaced failure path to unbreak __alloc_size

2024-05-01 Thread Kees Cook
The __alloc_size annotation for kmemdup() was getting disabled under KUnit testing because the replaced fortify_panic macro implementation was using "return NULL" as a way to survive the sanity checking. But having the chance to return NULL invalidated __alloc_size, so kmemdup was not passing the

Re: [PATCH] printk: cleanup deprecated uses of strncpy/strcpy

2024-05-01 Thread Justin Stitt
On Wed, May 1, 2024 at 2:39 PM Christophe JAILLET wrote: > Hi, > > Nit: The { } around each branch can now also be removed. There was one line before and there's one line now. I'll remove the brackets but I will briefly wait to see if any other concerns come in. Thanks > > CJ >

[PATCH][next] wifi: rtlwifi: Remove unused structs and avoid multiple -Wfamnae warnings

2024-05-01 Thread Gustavo A. R. Silva
Wflex-array-member-not-at-end is coming in GCC-14, and we are getting ready to enable it globally. So, remove unused structs and fix the following -Wflex-array-member-not-at-end warnings: drivers/net/wireless/realtek/rtlwifi/btcoexist/../wifi.h:1063:30: warning: structure containing a flexible

Re: [PATCH] printk: cleanup deprecated uses of strncpy/strcpy

2024-05-01 Thread Christophe JAILLET
Le 30/04/2024 à 01:06, Justin Stitt a écrit : Cleanup some deprecated uses of strncpy() and strcpy() [1]. There doesn't seem to be any bugs with the current code but the readability of this code could benefit from a quick makeover while removing some deprecated stuff as a benefit. The most

Re: [PATCH] printk: cleanup deprecated uses of strncpy/strcpy

2024-05-01 Thread Kees Cook
On Mon, Apr 29, 2024 at 11:06:54PM +, Justin Stitt wrote: > Cleanup some deprecated uses of strncpy() and strcpy() [1]. > > There doesn't seem to be any bugs with the current code but the > readability of this code could benefit from a quick makeover while > removing some deprecated stuff as

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

2024-05-01 Thread Kees Cook
On Tue, Apr 30, 2024 at 11:15:04AM +0200, Peter Zijlstra wrote: > On Mon, Apr 29, 2024 at 07:40:58PM +0200, Erick Archer wrote: > > This is an effort to get rid of all multiplications from allocation > > functions in order to prevent integer overflows [1][2]. > > So personally I detest

Re: [PATCH] x86/alternatives: Make FineIBT mode Kconfig selectable

2024-05-01 Thread Sami Tolvanen
On Tue, Apr 30, 2024 at 5:02 PM Kees Cook wrote: > > Since FineIBT performs checking at the destination, it is weaker against > attacks that can construct arbitrary executable memory contents. As such, > some system builders want to run with FineIBT disabled by default. Allow > the "cfi=kcfi"

Re: [PATCH] x86/alternatives: Make FineIBT mode Kconfig selectable

2024-05-01 Thread Kees Cook
On Wed, May 01, 2024 at 09:33:14AM -0700, Nathan Chancellor wrote: > On Tue, Apr 30, 2024 at 05:02:22PM -0700, Kees Cook wrote: > > Since FineIBT performs checking at the destination, it is weaker against > > attacks that can construct arbitrary executable memory contents. As such, > > some system

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

2024-05-01 Thread Kees Cook
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

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

2024-05-01 Thread Justin Stitt
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

Re: [PATCH][next] Bluetooth: hci_conn: Use struct_size() in hci_le_big_create_sync()

2024-05-01 Thread patchwork-bot+bluetooth
Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz : On Wed, 1 May 2024 12:09:30 -0600 you wrote: > Use struct_size() instead of the open-coded version. Similarly to > this other patch[1]. > > Link:

Re: [PATCH][next] Bluetooth: hci_sync: Use cmd->num_cis instead of magic number

2024-05-01 Thread patchwork-bot+bluetooth
Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz : On Wed, 1 May 2024 11:50:02 -0600 you wrote: > At the moment of the check, `cmd->num_cis` holds the value of 0x1f, > which is the max number of elements in the `cmd->cis[]` array at > declaration,

[PATCH v3] hardening: Enable KCFI and some other options

2024-05-01 Thread Kees Cook
Add some stuff that got missed along the way: - CONFIG_UNWIND_PATCH_PAC_INTO_SCS=y so SCS vs PAC is hardware selectable. - CONFIG_X86_KERNEL_IBT=y while a default, just be sure. - CONFIG_CFI_CLANG=y globally. - CONFIG_PAGE_TABLE_CHECK=y for userspace mapping sanity. Reviewed-by: Nathan

Re: [PATCH] hardening: Refresh KCFI options, add some more

2024-05-01 Thread Kees Cook
On Wed, May 01, 2024 at 01:06:14PM +0200, Peter Zijlstra wrote: > On Tue, Apr 30, 2024 at 10:48:36AM -0700, Kees Cook wrote: > > On Tue, Apr 30, 2024 at 11:21:40AM +0200, Peter Zijlstra wrote: > > > On Fri, Apr 26, 2024 at 03:29:44PM -0700, Kees Cook wrote: > > > > > > > - CONFIG_CFI_CLANG=y for

Re: [PATCH][next] Bluetooth: hci_sync: Use cmd->num_cis instead of magic number

2024-05-01 Thread Kees Cook
On Wed, May 01, 2024 at 11:50:02AM -0600, Gustavo A. R. Silva wrote: > At the moment of the check, `cmd->num_cis` holds the value of 0x1f, > which is the max number of elements in the `cmd->cis[]` array at > declaration, which is 0x1f. > > So, avoid using 0x1f directly, and instead use

Re: [PATCH][next] Bluetooth: hci_conn: Use struct_size() in hci_le_big_create_sync()

2024-05-01 Thread Kees Cook
On Wed, May 01, 2024 at 12:09:30PM -0600, Gustavo A. R. Silva wrote: > Use struct_size() instead of the open-coded version. Similarly to > this other patch[1]. > > Link: https://lore.kernel.org/linux-hardening/ZiwwPmCvU25YzWek@neat/ [1] > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees

[PATCH][next] Bluetooth: hci_conn: Use struct_size() in hci_le_big_create_sync()

2024-05-01 Thread Gustavo A. R. Silva
Use struct_size() instead of the open-coded version. Similarly to this other patch[1]. Link: https://lore.kernel.org/linux-hardening/ZiwwPmCvU25YzWek@neat/ [1] Signed-off-by: Gustavo A. R. Silva --- net/bluetooth/hci_conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH][next] Bluetooth: hci_sync: Use cmd->num_cis instead of magic number

2024-05-01 Thread Gustavo A. R. Silva
At the moment of the check, `cmd->num_cis` holds the value of 0x1f, which is the max number of elements in the `cmd->cis[]` array at declaration, which is 0x1f. So, avoid using 0x1f directly, and instead use `cmd->num_cis`. Similarly to this other patch[1]. Link:

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

2024-05-01 Thread Erick Archer
On Tue, Apr 30, 2024 at 11:15:04AM +0200, Peter Zijlstra wrote: > On Mon, Apr 29, 2024 at 07:40:58PM +0200, Erick Archer wrote: > > This is an effort to get rid of all multiplications from allocation > > functions in order to prevent integer overflows [1][2]. > > So personally I detest

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

2024-05-01 Thread Erick Archer
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 indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions).

Re: [PATCH] sctp: prefer struct_size over open coded arithmetic

2024-05-01 Thread Erick Archer
Hi Kees and Xin, On Mon, Apr 29, 2024 at 10:45:20AM -0700, Kees Cook wrote: > On Sat, Apr 27, 2024 at 07:23:36PM +0200, Erick Archer wrote: > > This is an effort to get rid of all multiplications from allocation > > functions in order to prevent integer overflows [1][2]. > > > > As the "ids"

Re: [PATCH] x86/alternatives: Make FineIBT mode Kconfig selectable

2024-05-01 Thread Nathan Chancellor
On Tue, Apr 30, 2024 at 05:02:22PM -0700, Kees Cook wrote: > Since FineIBT performs checking at the destination, it is weaker against > attacks that can construct arbitrary executable memory contents. As such, > some system builders want to run with FineIBT disabled by default. Allow > the

Re: [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently

2024-05-01 Thread Mike Rapoport
On Wed, May 01, 2024 at 12:09:04PM -0400, Steven Rostedt wrote: > On Wed, 1 May 2024 18:30:40 +0300 > Mike Rapoport wrote: > > > > > /* > > > > * Parse early_reserve_mem=nn:align:name > > > > */ > > > > static int __init early_reserve_mem(char *p) > > > > { > > > > phys_addr_t start,

Re: [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently

2024-05-01 Thread Steven Rostedt
On Wed, 1 May 2024 18:30:40 +0300 Mike Rapoport wrote: > > > /* > > > * Parse early_reserve_mem=nn:align:name > > > */ > > > static int __init early_reserve_mem(char *p) > > > { > > > phys_addr_t start, size, align; > > > char *oldp; > > > int err; > > > > > > if (!p) > > >

Re: [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently

2024-05-01 Thread Mike Rapoport
On Wed, May 01, 2024 at 10:54:55AM -0400, Steven Rostedt wrote: > On Wed, 1 May 2024 17:45:49 +0300 > Mike Rapoport wrote: > > > > +static void __init memmap_copy(void) > > > +{ > > > + if (!early_mmap_size) > > > + return; > > > + > > > + mmap_list = kcalloc(early_mmap_size + 1,

Re: [PATCH v2 2/3] leds: sy7802: Add support for Silergy SY7802 flash LED controller

2024-05-01 Thread André Apitzsch
Hi Lee Jones, thanks for the feedback. I will address your comments in the next version. I have a few comments/questions though, see below. Best regards, André Am Donnerstag, dem 11.04.2024 um 13:48 +0100 schrieb Lee Jones: > On Mon, 01 Apr 2024, André Apitzsch via B4 Relay wrote: > > > > [..]

Re: [POC][RFC][PATCH 1/2] mm/x86: Add wildcard * option as memmap=nn*align:name

2024-05-01 Thread Mike Rapoport
On Mon, Apr 15, 2024 at 10:22:53AM -0700, Kees Cook wrote: > On Fri, Apr 12, 2024 at 06:19:40PM -0400, Steven Rostedt wrote: > > On Fri, 12 Apr 2024 23:59:07 +0300 > > Mike Rapoport wrote: > > > > > On Tue, Apr 09, 2024 at 04:41:24PM -0700, Kees Cook wrote: > > > > On Tue, Apr 09, 2024 at

Re: [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently

2024-05-01 Thread Steven Rostedt
On Wed, 1 May 2024 17:45:49 +0300 Mike Rapoport wrote: > > +static void __init memmap_copy(void) > > +{ > > + if (!early_mmap_size) > > + return; > > + > > + mmap_list = kcalloc(early_mmap_size + 1, sizeof(mmap_list), > > GFP_KERNEL); > > We can keep early_mmap_size after boot

Re: [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently

2024-05-01 Thread Mike Rapoport
On Fri, Apr 12, 2024 at 01:22:43PM -0400, Steven Rostedt wrote: > On Fri, 12 Apr 2024 09:17:18 -0300 > "Guilherme G. Piccoli" wrote: > > > Thanks Steve, seems a good idea. With that, I could test on kdumpst (the > > tool used on Steam Deck), since it relies on modular pstore/ram. > > Something

Re: [PATCH v3] scsi: csiostor: Use kcalloc() instead of kzalloc()

2024-05-01 Thread James Bottomley
On Mon, 2024-04-29 at 13:13 -0700, Kees Cook wrote: > On Mon, Apr 29, 2024 at 02:31:19PM -0400, Martin K. Petersen wrote: > > > > Kees, > > > > > > This patch seems to be lost. Gustavo reviewed it on January 15, > > > > 2024 but the patch has not been applied since. > > > > > > This looks

Re: [PATCH] hardening: Refresh KCFI options, add some more

2024-05-01 Thread Peter Zijlstra
On Tue, Apr 30, 2024 at 10:48:36AM -0700, Kees Cook wrote: > On Tue, Apr 30, 2024 at 11:21:40AM +0200, Peter Zijlstra wrote: > > On Fri, Apr 26, 2024 at 03:29:44PM -0700, Kees Cook wrote: > > > > > - CONFIG_CFI_CLANG=y for x86 and arm64. (And disable FINEIBT since > > > it isn't as secure as