Re: [PATCH v2] netlink: Return unsigned value for nla_len()

2023-12-04 Thread Nicolas Dichtel
Le 04/12/2023 à 23:21, Kees Cook a écrit : [snip] >>> diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h >>> index f87aaf28a649..270feed9fd63 100644 >>> --- a/include/uapi/linux/netlink.h >>> +++ b/include/uapi/linux/netlink.h >>> @@ -247,7 +247,7 @@ struct nlattr { >>> >>>

Re: [PATCH 2/5] pstore: inode: Convert mutex usage to guard(mutex)

2023-12-04 Thread Dave Chinner
On Sat, Dec 02, 2023 at 01:22:12PM -0800, Kees Cook wrote: > Replace open-coded mutex handling with cleanup.h guard(mutex) and > scoped_guard(mutex, ...). > > Cc: "Guilherme G. Piccoli" > Cc: Tony Luck > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Kees Cook > --- > fs/pstore/inode.c

Re: [PATCH v2 00/18] sysctl: constify sysctl ctl_tables

2023-12-04 Thread Luis Chamberlain
On Mon, Dec 04, 2023 at 08:52:13AM +0100, Thomas Weißschuh wrote: > Tested by booting and with the sysctl selftests on x86. Can I trouble you to rebase on sysctl-next? https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=sysctl-next Luis

Re: [PATCH v2 03/21] KASAN: remove code paths guarded by CONFIG_SLAB

2023-12-04 Thread Hyeonggon Yoo
On Tue, Dec 5, 2023 at 1:27 PM Hyeonggon Yoo <42.hye...@gmail.com> wrote: > > On Mon, Nov 20, 2023 at 07:34:14PM +0100, Vlastimil Babka wrote: > > With SLAB removed and SLUB the only remaining allocator, we can clean up > > some code that was depending on the choice. > > > > Reviewed-by: Kees Cook

Re: [PATCH v2 16/21] mm/slab: move kfree() from slab_common.c to slub.c

2023-12-04 Thread Hyeonggon Yoo
On Mon, Nov 20, 2023 at 07:34:27PM +0100, Vlastimil Babka wrote: > This should result in better code. Currently kfree() makes a function > call between compilation units to __kmem_cache_free() which does its own > virt_to_slab(), throwing away the struct slab pointer we already had in > kfree().

Re: [PATCH v2 03/21] KASAN: remove code paths guarded by CONFIG_SLAB

2023-12-04 Thread Hyeonggon Yoo
On Mon, Nov 20, 2023 at 07:34:14PM +0100, Vlastimil Babka wrote: > With SLAB removed and SLUB the only remaining allocator, we can clean up > some code that was depending on the choice. > > Reviewed-by: Kees Cook > Reviewed-by: Marco Elver > Signed-off-by: Vlastimil Babka > --- >

Re: [PATCH v2 02/21] mm/slab: remove CONFIG_SLAB from all Kconfig and Makefile

2023-12-04 Thread Hyeonggon Yoo
On Mon, Nov 20, 2023 at 07:34:13PM +0100, Vlastimil Babka wrote: > Remove CONFIG_SLAB, CONFIG_DEBUG_SLAB, CONFIG_SLAB_DEPRECATED and > everything in Kconfig files and mm/Makefile that depends on those. Since > SLUB is the only remaining allocator, remove the allocator choice, make > CONFIG_SLUB a

Re: [PATCH v2 01/21] mm/slab, docs: switch mm-api docs generation from slab.c to slub.c

2023-12-04 Thread Hyeonggon Yoo
On Mon, Nov 20, 2023 at 07:34:12PM +0100, Vlastimil Babka wrote: > The SLAB implementation is going to be removed, and mm-api.rst currently > uses mm/slab.c to obtain kerneldocs for some API functions. Switch it to > mm/slub.c and move the relevant kerneldocs of exported functions from > one to

Re: [PATCH 5/5] pstore: inode: Use cleanup.h for struct pstore_private

2023-12-04 Thread Kees Cook
On Sat, Dec 02, 2023 at 10:27:06PM +, Al Viro wrote: > On Sat, Dec 02, 2023 at 01:22:15PM -0800, Kees Cook wrote: > > > static void *pstore_ftrace_seq_start(struct seq_file *s, loff_t *pos) > > { > > @@ -338,9 +339,8 @@ int pstore_mkfile(struct dentry *root, struct > > pstore_record

Re: [PATCH v2] netlink: Return unsigned value for nla_len()

2023-12-04 Thread Kees Cook
On Mon, Dec 04, 2023 at 10:22:25AM +0100, Nicolas Dichtel wrote: > Le 02/12/2023 à 21:25, Kees Cook a écrit : > > The return value from nla_len() is never expected to be negative, and can > > never be more than struct nlattr::nla_len (a u16). Adjust the prototype > > on the function. This will let

Re: [PATCH] md/md-multipath: Convert "struct mpconf" to flexible array

2023-12-04 Thread Kees Cook
On Sun, Dec 03, 2023 at 08:48:06PM +0100, Christophe JAILLET wrote: > The 'multipaths' field of 'struct mpconf' can be declared as a flexible > array. > > The advantages are: >- 1 less indirection when accessing to the 'multipaths' array >- save 1 pointer in the structure >- improve

Re: [PATCH v2 12/18] sysctl: treewide: constify the ctl_table argument of handlers

2023-12-04 Thread Kees Cook
On Mon, Dec 04, 2023 at 08:52:25AM +0100, Thomas Weißschuh wrote: > In a future commit the sysctl core will only use > "const struct ctl_table". As a preparation for that adapt all the proc > handlers. > > Signed-off-by: Thomas Weißschuh Reviewed-by: Kees Cook # security/* -- Kees Cook

Re: [PATCH v2 08/18] stackleak: don't modify ctl_table argument

2023-12-04 Thread Kees Cook
On Mon, Dec 04, 2023 at 08:52:21AM +0100, Thomas Weißschuh wrote: > In a future commit the proc_handlers will change to > "const struct ctl_table". > As a preparation for that adapt the logic to work with a temporary > variable, similar to how it is done in other parts of the kernel. > >

Re: [PATCH v2 05/18] seccomp: constify ctl_table arguments of utility functions

2023-12-04 Thread Kees Cook
On Mon, Dec 04, 2023 at 08:52:18AM +0100, Thomas Weißschuh wrote: > In a future commit the proc_handlers themselves will change to > "const struct ctl_table". As a preparation for that adapt the internal > helpers. > > Signed-off-by: Thomas Weißschuh Acked-by: Kees Cook -- Kees Cook

Re: [PATCH v2 0/2] qnx4: Avoid confusing compiler about buffer lengths

2023-12-04 Thread Kees Cook
On Tue, Dec 05, 2023 at 01:46:27AM +1000, Ronald Monthero wrote: > Cheers Kees, > BR, > ronald Is this a "Tested-by"? :) -Kees > > > On Fri, Dec 1, 2023 at 6:51 AM Kees Cook wrote: > > > > Hi, > > > > This attempts to fix the issue Ronald Monthero found[1]. Avoids using a > > too-short

Re: [PATCH v2] scsi: zfcp: Replace strlcpy() with strscpy()

2023-12-04 Thread Benjamin Block
Hello Kees, Martin, James, On Thu, Nov 30, 2023 at 12:41:00PM -0800, Kees Cook wrote: > strlcpy() reads the entire source buffer first. This read may exceed > the destination size limit. This is both inefficient and can lead > to linear read overflows if a source string is not NUL-terminated[1].

Re: [PATCH v2 0/2] qnx4: Avoid confusing compiler about buffer lengths

2023-12-04 Thread Ronald Monthero
Cheers Kees, BR, ronald On Fri, Dec 1, 2023 at 6:51 AM Kees Cook wrote: > > Hi, > > This attempts to fix the issue Ronald Monthero found[1]. Avoids using a > too-short struct buffer when reading the string, by using the existing > struct union. > > -Kees > > [1] >

Re: [PATCH v2] netlink: Return unsigned value for nla_len()

2023-12-04 Thread Nicolas Dichtel
Le 02/12/2023 à 21:25, Kees Cook a écrit : > The return value from nla_len() is never expected to be negative, and can > never be more than struct nlattr::nla_len (a u16). Adjust the prototype > on the function. This will let GCC's value range optimization passes > know that the return can never

Re: [PATCH RFC 0/7] sysctl: constify sysctl ctl_tables

2023-12-04 Thread Joel Granados
Hey I see that you sent a V2. I'll try to get to it at the end of the week. On Sun, Dec 03, 2023 at 04:37:01PM +0100, Thomas Weißschuh wrote: > Hi Joel, > > On 2023-12-01 17:31:20+0100, Joel Granados wrote: > > Hey Thomas. > > > > Thx for the clarifications. I did more of a deep dive into your

Re: [PATCH][next] wifi: mt76: mt7996: Use DECLARE_FLEX_ARRAY() and fix -Warray-bounds warnings

2023-12-04 Thread Kalle Valo
Kees Cook writes: > On Thu, Nov 16, 2023 at 02:57:24PM -0600, Gustavo A. R. Silva wrote: > >> Transform zero-length arrays `adm_stat` and `msdu_cnt` into proper >> flexible-array members in anonymous union in `struct >> mt7996_mcu_all_sta_info_event` via the DECLARE_FLEX_ARRAY() >> helper; and