Re: [PATCH] lkdtm/bugs: Improve warning message for compilers without counted_by support

2024-03-21 Thread Kees Cook
On Thu, 21 Mar 2024 13:18:17 -0700, Nathan Chancellor wrote: > The current message for telling the user that their compiler does not > support the counted_by attribute in the FAM_BOUNDS test does not make > much sense either grammatically or semantically. Fix it to make it > correct in both aspects

Re: [PATCH v2] binfmt: replace deprecated strncpy

2024-03-21 Thread Kees Cook
On Thu, 21 Mar 2024 20:04:08 +, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > There is a _nearly_ identical implementation of fill_psinfo present in > binfmt

Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread Russell King (Oracle)
On Thu, Mar 21, 2024 at 11:43:41PM +0100, Ard Biesheuvel wrote: > Given that this particular issue would just disappear if the compiler > would just insert a BRK after the BL, I'd prefer to explore first > whether we can get this fixed on the compiler side. Arm32 doesn't have a BRK instruction. Wh

[PATCH] hfsplus: refactor copy_name to not use strncpy

2024-03-21 Thread Justin Stitt
me, --- base-commit: 241590e5a1d1b6219c8d3045c167f2fbcc076cbb change-id: 20240321-strncpy-fs-hfsplus-xattr-c-4ebfe67f4c6d Best regards, -- Justin Stitt

Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread Ard Biesheuvel
On Thu, 21 Mar 2024 at 12:24, Russell King (Oracle) wrote: > > On Thu, Mar 21, 2024 at 10:22:30AM +, David Laight wrote: > > How aggressively does the compiler optimise 'noreturn' functions? > > I've seen cases where the compiler emits a BL instruction as the very > last thing in the function,

Re: [PATCH] lkdtm/bugs: Improve warning message for compilers without counted_by support

2024-03-21 Thread Gustavo A. R. Silva
pr_expected_config(CONFIG_UBSAN_TRAP); --- base-commit: 8d8b79685237b15f4bb676781f6bf241beb068a8 change-id: 20240321-lkdtm-improve-lack-of-counted_by-msg-d3b9006bd6e3 Best regards,

[PATCH] lkdtm/bugs: Improve warning message for compilers without counted_by support

2024-03-21 Thread Nathan Chancellor
this %s was built with a compiler that does not support __counted_by\n", lkdtm_kernel_info); else if (IS_ENABLED(CONFIG_UBSAN_BOUNDS)) pr_expected_config(CONFIG_UBSAN_TRAP); --- base-commit: 8d8b79685237b15f4bb676781f6bf241beb068a8 change-id:

[PATCH v2] binfmt: replace deprecated strncpy

2024-03-21 Thread Justin Stitt
_comm (thanks Eric) - Link to v1: https://lore.kernel.org/r/20240321-strncpy-fs-binfmt_elf_fdpic-c-v1-1-fdde26c89...@google.com --- Note: build-tested only. Found with: $ rg "strncpy\(" --- fs/binfmt_elf_fdpic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/binfmt_e

Re: [PATCH] binfmt: replace deprecated strncpy with strscpy_pad

2024-03-21 Thread Justin Stitt
Hi, On Thu, Mar 21, 2024 at 9:23 AM Eric W. Biederman wrote: > > I am perplexed. Why not use get_task_comm fill_psinfo like binfmt_elf > does? > > It seems very silly to copy half the function without locking and then > not copy it's locking as well. > > Given that the more highly tested binfmt_

Re: [PATCH] binfmt: replace deprecated strncpy with strscpy_pad

2024-03-21 Thread Eric W. Biederman
Justin Stitt writes: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > In every other location psinfo->pr_fname is used, it's with strscpy_pad. > It's clear that this field needs to be

Re: [PATCH v3][next] integrity: Avoid -Wflex-array-member-not-at-end warnings

2024-03-21 Thread Gustavo A. R. Silva
On 3/21/24 07:58, Mimi Zohar wrote: On Wed, 2024-03-20 at 22:11 -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. There is currently an object (`hdr)` in `struct ima_max_digest_data` that contains a flexible

Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread Russell King (Oracle)
On Thu, Mar 21, 2024 at 03:20:57PM +, David Laight wrote: > From: Russell King > > Sent: 21 March 2024 14:56 > > > > On Thu, Mar 21, 2024 at 02:37:28PM +, David Laight wrote: > > > From: Russell King > > > > Sent: 21 March 2024 13:08 > > > > > > > > On Thu, Mar 21, 2024 at 12:57:07PM +

RE: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread David Laight
From: Russell King > Sent: 21 March 2024 14:56 > > On Thu, Mar 21, 2024 at 02:37:28PM +, David Laight wrote: > > From: Russell King > > > Sent: 21 March 2024 13:08 > > > > > > On Thu, Mar 21, 2024 at 12:57:07PM +, David Laight wrote: > > > > From: Russell King > > > > > Sent: 21 March 2024

Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread Russell King (Oracle)
On Thu, Mar 21, 2024 at 02:37:28PM +, David Laight wrote: > From: Russell King > > Sent: 21 March 2024 13:08 > > > > On Thu, Mar 21, 2024 at 12:57:07PM +, David Laight wrote: > > > From: Russell King > > > > Sent: 21 March 2024 12:23 > > > ... > > > > > That might mean you can get the BL i

RE: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread David Laight
From: Russell King > Sent: 21 March 2024 13:08 > > On Thu, Mar 21, 2024 at 12:57:07PM +, David Laight wrote: > > From: Russell King > > > Sent: 21 March 2024 12:23 > > ... > > > > That might mean you can get the BL in the middle of a function > > > > but where the following instruction is for

Re: [PATCH v3][next] integrity: Avoid -Wflex-array-member-not-at-end warnings

2024-03-21 Thread Mimi Zohar
On Wed, 2024-03-20 at 22:11 -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. > > There is currently an object (`hdr)` in `struct ima_max_digest_data` > that contains a flexible structure (`struct ima_digest_da

Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread Russell King (Oracle)
On Thu, Mar 21, 2024 at 12:57:07PM +, David Laight wrote: > From: Russell King > > Sent: 21 March 2024 12:23 > ... > > > That might mean you can get the BL in the middle of a function > > > but where the following instruction is for the 'no stack frame' > > > side of the branch. > > > That is v

RE: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread David Laight
From: Russell King > Sent: 21 March 2024 12:23 ... > > That might mean you can get the BL in the middle of a function > > but where the following instruction is for the 'no stack frame' > > side of the branch. > > That is very likely to break any stack offset calculations. > > No it can't. At any

Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread Russell King (Oracle)
On Thu, Mar 21, 2024 at 12:07:51PM +, David Laight wrote: > From: Russell King > > Sent: 21 March 2024 11:24 > > > > On Thu, Mar 21, 2024 at 10:22:30AM +, David Laight wrote: > > > How aggressively does the compiler optimise 'noreturn' functions? > > > > I've seen cases where the compiler

RE: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread David Laight
From: Russell King > Sent: 21 March 2024 11:24 > > On Thu, Mar 21, 2024 at 10:22:30AM +, David Laight wrote: > > How aggressively does the compiler optimise 'noreturn' functions? > > I've seen cases where the compiler emits a BL instruction as the very > last thing in the function, and nothin

Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread Russell King (Oracle)
On Thu, Mar 21, 2024 at 10:22:30AM +, David Laight wrote: > How aggressively does the compiler optimise 'noreturn' functions? I've seen cases where the compiler emits a BL instruction as the very last thing in the function, and nothing after it. This is where the problem lies - because the li

RE: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread David Laight
How aggressively does the compiler optimise 'noreturn' functions? Consider: void f(...) { ... if () { ... noreturn(...); } } Without the noreturn() call it is a leaf function. So the compiler doesn't need to save 'lr' on stack (or the save co

Re: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

2024-03-21 Thread Jiangfeng Xiao
On 2024/3/21 3:40, Russell King (Oracle) wrote: > On Wed, Mar 20, 2024 at 11:30:05PM +0800, Jiangfeng Xiao wrote: >> >> >> On 2024/3/20 16:45, Russell King (Oracle) wrote: >>> On Wed, Mar 20, 2024 at 11:44:38AM +0800, Jiangfeng Xiao wrote: This is an off-by-one bug which is common in unwind