Re: [PATCH] fs: Set file_handle::handle_bytes before referencing file_handle::f_handle

2024-04-04 Thread Jan Kara
On Wed 03-04-24 14:54:03, Kees Cook wrote: > With adding __counted_by(handle_bytes) to struct file_handle, we need > to explicitly set it in the one place it wasn't yet happening prior to > accessing the flex array "f_handle". > > Fixes: 1b43c4629756 ("fs: Annotate struct file_handle with __counte

Re: [PATCH 1/2] [RESEND] wifi: carl9170: re-fix fortified-memset warning

2024-04-04 Thread Kalle Valo
Arnd Bergmann wrote: > The carl9170_tx_release() function sometimes triggers a fortified-memset > warning in my randconfig builds: > > In file included from include/linux/string.h:254, > from drivers/net/wireless/ath/carl9170/tx.c:40: > In function 'fortify_memset_chk', > in

Re: [PATCH v2][next] wifi: wil6210: cfg80211: Use __counted_by() in struct wmi_start_scan_cmd and avoid some -Wfamnae warnings

2024-04-04 Thread Kalle Valo
"Gustavo A. R. Silva" 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 indexing) and CONFIG_FORTIFY_SOURCE >

Re: [PATCH v2][next] wifi: wil6210: wmi: Use __counted_by() in struct wmi_set_link_monitor_cmd and avoid -Wfamnae warning

2024-04-04 Thread Kalle Valo
"Gustavo A. R. Silva" 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 indexing) and CONFIG_FORTIFY_SOURCE >

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

2024-04-04 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. There is currently an object (`hdr)` in `struct ima_max_digest_data` that contains a flexible structure (`struct ima_digest_data`): struct ima_max_digest_data { struct ima_digest_data hdr;

Re: [PATCH] fs: Set file_handle::handle_bytes before referencing file_handle::f_handle

2024-04-04 Thread Chuck Lever
On Thu, Apr 04, 2024 at 11:19:00AM +0200, Jan Kara wrote: > On Wed 03-04-24 14:54:03, Kees Cook wrote: > > With adding __counted_by(handle_bytes) to struct file_handle, we need > > to explicitly set it in the one place it wasn't yet happening prior to > > accessing the flex array "f_handle". > > >

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

2024-04-04 Thread Mimi Zohar
Hi Gustavo, On Thu, 2024-04-04 at 09:00 -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

Re: [PATCH 7/7] arm64: dts: qcom: Add SM8550 Xperia 1 V

2024-04-04 Thread Konrad Dybcio
On 2/12/24 18:26, Neil Armstrong wrote: On 12/02/2024 14:10, Konrad Dybcio wrote: Add support for Sony Xperia 1 V, a.k.a PDX234. This device is a part of the SoMC SM8550 Yodo platform. [...] +/* TODO: Only one SID of PMR735D seems accessible? */ What's reported by the cpuinfo pmic arr

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

2024-04-04 Thread Mimi Zohar
On Thu, 2024-04-04 at 12:49 -0400, Mimi Zohar wrote: > Hi Gustavo, > > On Thu, 2024-04-04 at 09:00 -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

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

2024-04-04 Thread Kees Cook
On Tue, Apr 02, 2024 at 08:39:49PM +, 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. > > data_page wants to be NUL-terminated and NUL-padded, use strscpy_pad to >

[PATCH v2] fs: Set file_handle::handle_bytes before referencing file_handle::f_handle

2024-04-04 Thread Kees Cook
Since __counted_by(handle_bytes) was added to struct file_handle, we need to explicitly set it in the one place it wasn't yet happening prior to accessing the flex array "f_handle". For robustness also check for a negative value for handle_bytes, which is possible for an "int", but nothing appears

Re: [PATCH v2] hfsplus: refactor copy_name to not use strncpy

2024-04-04 Thread Kees Cook
On Mon, Apr 01, 2024 at 06:10:48PM +, Justin Stitt wrote: > strncpy() is deprecated with NUL-terminated destination strings [1]. > > The copy_name() method does a lot of manual buffer manipulation to > eventually arrive with its desired string. If we don't know the > namespace this attr has or

Re: [PATCH v2] fs: Set file_handle::handle_bytes before referencing file_handle::f_handle

2024-04-04 Thread Matthew Wilcox
On Thu, Apr 04, 2024 at 02:12:15PM -0700, Kees Cook wrote: > Since __counted_by(handle_bytes) was added to struct file_handle, we need > to explicitly set it in the one place it wasn't yet happening prior to > accessing the flex array "f_handle". For robustness also check for a > negative value for

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

2024-04-04 Thread Gustavo A. R. Silva
"checkpatch.pl --strict" complains "CHECK: Alignment should match open parenthesis". I'll queue the patch, but how about teaching checkpatch.pl to ignore __struct_group()? I think this would do it: diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9c4c4a61bc83..e229b97f17f6 1