Re: [PATCH] udf: Annotate struct udf_bitmap with __counted_by

2023-09-18 Thread Jan Kara
On Fri 15-09-23 14:50:14, Gustavo A. R. Silva wrote: > > > On 9/15/23 14:14, Kees Cook 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 che

Re: [PATCH] aio: Annotate struct kioctx_table with __counted_by

2023-09-18 Thread Christian Brauner
On Fri, 15 Sep 2023 13:14:14 -0700, Kees Cook 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 checking via CONFIG_UBSAN_BOUNDS > (for array indexi

Re: [PATCH][next] mlxsw: Use size_mul() in call to struct_size()

2023-09-18 Thread Ido Schimmel
On Fri, Sep 15, 2023 at 01:01:23PM -0600, Gustavo A. R. Silva wrote: > If, for any reason, the open-coded arithmetic causes a wraparound, the > protection that `struct_size()` adds against potential integer overflows > is defeated. Fix this by hardening call to `struct_size()` with `size_mul()`. >

Re: [PATCH] HID: uhid: refactor deprecated strncpy

2023-09-18 Thread David Rheinsberg
Hey On Fri, Sep 15, 2023, at 10:48 PM, Kees Cook wrote: > On Fri, Sep 15, 2023 at 09:36:23AM +0200, David Rheinsberg wrote: >> Hi >> >> On Fri, Sep 15, 2023, at 7:13 AM, Kees Cook wrote: >> >> - /* @hid is zero-initialized, strncpy() is correct, strlcpy() not */ >> >> - len = min(sizeof(hid->name

[PATCH v4] EDAC/mc_sysfs: refactor deprecated strncpy

2023-09-18 Thread Justin Stitt
`strncpy` is deprecated for use on NUL-terminated destination strings [1]. We've already calculated bounds, possible truncation with '\0' or '\n' and manually NUL-terminated. The situation is now just a literal byte copy from one buffer to another, let's treat it as such and use a less ambiguous i

Re: [PATCH] leds: mt6360: Annotate struct mt6360_priv with __counted_by

2023-09-18 Thread AngeloGioacchino Del Regno
Il 15/09/23 22:10, Kees Cook ha scritto: 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 checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FOR

Re: [PATCH] leds: mt6370: Annotate struct mt6370_priv with __counted_by

2023-09-18 Thread AngeloGioacchino Del Regno
Il 15/09/23 22:10, Kees Cook ha scritto: 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 checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FOR

Re: [PATCH] printk: add cpu id information to printk() output

2023-09-18 Thread John Ogness
On 2023-09-15, Petr Mladek wrote: > The biggest problem is that it would change the format of the > ringbuffer so that it would require updating external tools, > working with crashdump, especially crash but there are also > alternative python extensions for gdb. I already have experience updatin

Re: [PATCH] ceph: Annotate struct ceph_monmap with __counted_by

2023-09-18 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by David S. Miller : On Fri, 15 Sep 2023 13:15:10 -0700 you 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 bou

Re: [PATCH v2][next] RDMA/core: Use size_{add,mul}() in calls to struct_size()

2023-09-18 Thread Leon Romanovsky
On Fri, Sep 15, 2023 at 12:06:21PM -0600, Gustavo A. R. Silva wrote: > > > On 9/14/23 21:29, Kees Cook wrote: > > On Mon, Sep 11, 2023 at 05:27:59PM -0600, Gustavo A. R. Silva wrote: > > > Harden calls to struct_size() with size_add() and size_mul(). > > > > Specifically, make sure that open-cod

Re: [PATCH 06/19] qibfs: use simple_release_fs

2023-09-18 Thread Leon Romanovsky
On Wed, Sep 13, 2023 at 08:10:00AM -0300, Christoph Hellwig wrote: > qibfs currently has convoluted code to allow registering HCAs while qibfs > is not mounted and vice versa. Switch to using simple_release_fs every > time an entry is added to pin the fs instance and remove all the boiler > plate

Re: [PATCH v2][next] RDMA/core: Use size_{add,mul}() in calls to struct_size()

2023-09-18 Thread Gustavo A. R. Silva
On 9/18/23 04:49, Leon Romanovsky wrote: On Fri, Sep 15, 2023 at 12:06:21PM -0600, Gustavo A. R. Silva wrote: On 9/14/23 21:29, Kees Cook wrote: On Mon, Sep 11, 2023 at 05:27:59PM -0600, Gustavo A. R. Silva wrote: Harden calls to struct_size() with size_add() and size_mul(). Specificall

Re: [PATCH] x86/mm/dump_pagetables: Add SLAB_VIRTUAL knowledge

2023-09-18 Thread Matteo Rizzo
On Sat, 16 Sept 2023 at 04:18, Kees Cook wrote: > > Add the markings for the SLAB_VIRTUAL area. > > Feel free to collapse this into the x86 patch from the above series. Thanks! I will add it to the next revision of the series. -- Matteo

Re: [PATCH v2][next] RDMA/core: Use size_{add,mul}() in calls to struct_size()

2023-09-18 Thread Leon Romanovsky
On Sun, Sep 17, 2023 at 01:59:26PM -0600, Gustavo A. R. Silva wrote: > > > On 9/18/23 04:49, Leon Romanovsky wrote: > > On Fri, Sep 15, 2023 at 12:06:21PM -0600, Gustavo A. R. Silva wrote: > > > > > > > > > On 9/14/23 21:29, Kees Cook wrote: > > > > On Mon, Sep 11, 2023 at 05:27:59PM -0600, Gus

Re: [PATCH 15/19] kernfs: split ->kill_sb

2023-09-18 Thread Michal Koutný
On Wed, Sep 13, 2023 at 08:10:09AM -0300, Christoph Hellwig wrote: > Split the kernfs_kill_sb helper into helpers for the new split > shutdown_sb and free_sb methods. Note that resctrl has very odd > locking in ->kill_sb, so this commit only releases the locking > acquired in rdt_shutdown_sb in r

[PATCH v3][next] RDMA/core: Use size_{add,sub,mul}() in calls to struct_size()

2023-09-18 Thread Gustavo A. R. Silva
If, for any reason, the open-coded arithmetic causes a wraparound, the protection that `struct_size()` provides against potential integer overflows is defeated. Fix this by hardening calls to `struct_size()` with `size_add()`, `size_sub()` and `size_mul()`. Fixes: 467f432a521a ("RDMA/core: Split p

Re: [PATCH v2][next] RDMA/core: Use size_{add,mul}() in calls to struct_size()

2023-09-18 Thread Gustavo A. R. Silva
On 9/18/23 06:41, Leon Romanovsky wrote: On Sun, Sep 17, 2023 at 01:59:26PM -0600, Gustavo A. R. Silva wrote: On 9/18/23 04:49, Leon Romanovsky wrote: On Fri, Sep 15, 2023 at 12:06:21PM -0600, Gustavo A. R. Silva wrote: On 9/14/23 21:29, Kees Cook wrote: On Mon, Sep 11, 2023 at 05:27:5

[PATCH v2] hwmon: refactor deprecated strncpy

2023-09-18 Thread Justin Stitt
`strncpy` is deprecated for use on NUL-terminated destination strings [1]. A trailing zero is already handled by the kcalloc | *str = kcalloc(element->string.length + 1, sizeof(u8), GFP_KERNEL); ... which makes memcpy() a suitable replacement to strncpy. Link: https://www.kernel.org/doc/ht

[PATCH v2] hwmon: (ibmpowernv) refactor deprecated strncpy

2023-09-18 Thread Justin Stitt
`strncpy` is deprecated for use on NUL-terminated destination strings [1]. A suitable replacement is `memcpy` as we've already precisely calculated the number of bytes to copy while `buf` has been explicitly zero-initialized: | char buf[8] = { 0 }; Link: https://www.kernel.org/doc/html/lat

Re: [PATCH] xen/efi: refactor deprecated strncpy

2023-09-18 Thread Juergen Gross
On 11.09.23 20:59, Justin Stitt wrote: `strncpy` is deprecated for use on NUL-terminated destination strings [1]. `efi_loader_signature` has space for 4 bytes. We are copying "Xen" (3 bytes) plus a NUL-byte which makes 4 total bytes. With that being said, there is currently not a bug with the cu