Re: [PATCH net-next v5 0/7] introduce DEFINE_FLEX() macro

2023-09-12 Thread Kees Cook
ce_aq_move_sched_elems() > ice: make use of DEFINE_FLEX() in ice_ddp.c > ice: make use of DEFINE_FLEX() for struct ice_aqc_add_tx_qgrp > ice: make use of DEFINE_FLEX() for struct ice_aqc_dis_txq_item > ice: make use of DEFINE_FLEX() in ice_switch.c Looks good to me! Feel free to pick up via netdev. -Kees -- Kees Cook

Re: [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()

2021-04-16 Thread Kees Cook
m/KSPP/linux/issues/109 > Reported-by: kernel test robot > Signed-off-by: Gustavo A. R. Silva Yup! Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH v3 2/2] wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join

2021-04-15 Thread Kees Cook
mp;sig.beacon_period and &this->bss_set[i].beacon_period, because the > address of the new struct object _req_ is used as the destination, > instead. > > This helps with the ongoing efforts to globally enable -Warray-bounds > and get us closer to being able to tighten the FORTIFY_SOURCE routines > on memcpy(). > > Link: https://github.com/KSPP/linux/issues/109 > Reported-by: kernel test robot > Signed-off-by: Gustavo A. R. Silva Awesome! Thank you for this solution. Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH v2 2/2][next] wl3501_cs: Fix out-of-bounds warning in wl3501_mgmt_join

2021-04-07 Thread Kees Cook
.el = { > .id = IW_MGMT_INFO_ELEMENT_DS_PARAMETER_SET, > .len = 1, > @@ -599,7 +599,7 @@ static int wl3501_mgmt_join(struct wl3501_card *this, u16 > stas) > }, > }; > > - memcpy(&a

Re: [PATCH v2 1/2][next] wl3501_cs: Fix out-of-bounds warning in wl3501_send_pkt

2021-04-07 Thread Kees Cook
tps://github.com/KSPP/linux/issues/109 > Reported-by: kernel test robot > Build-tested-by: kernel test robot > Link: https://lore.kernel.org/lkml/60641d9b.2enledogsdcsoav2%25...@intel.com/ > Signed-off-by: Gustavo A. R. Silva Thanks, this makes the code much easier for the compiler to validate at compile time. These cross-field memcpy()s are weird. I like the solution here. Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH RESEND][next] rtl8xxxu: Fix fall-through warnings for Clang

2021-03-10 Thread Kees Cook
On Wed, Mar 10, 2021 at 02:51:24PM -0500, Jes Sorensen wrote: > On 3/10/21 2:45 PM, Kees Cook wrote: > > On Wed, Mar 10, 2021 at 02:31:57PM -0500, Jes Sorensen wrote: > >> On 3/10/21 2:14 PM, Kees Cook wrote: > >>> Hm, this conversation looks like a miscommunicatio

Re: [PATCH RESEND][next] rtl8xxxu: Fix fall-through warnings for Clang

2021-03-10 Thread Kees Cook
On Wed, Mar 10, 2021 at 02:31:57PM -0500, Jes Sorensen wrote: > On 3/10/21 2:14 PM, Kees Cook wrote: > > On Fri, Mar 05, 2021 at 03:40:33PM +0200, Kalle Valo wrote: > >> "Gustavo A. R. Silva" writes: > >> > >>> In preparation to enable -Wimplicit-f

Re: [PATCH RESEND][next] rtl8xxxu: Fix fall-through warnings for Clang

2021-03-10 Thread Kees Cook
t;Clang doesn't parse comments" issue.) This could be a tree-wide patch and not bother you, but Greg KH has generally advised us to send these changes broken out. Anyway, this change still needs to land, so what would be the preferred path? I think Gustavo could just carry it for Linus to m

Re: [PATCH v2] seccomp: Improve performace by optimizing rmb()

2021-02-10 Thread Kees Cook
ptimizing rmb() https://git.kernel.org/kees/c/a381b70a1cf8 -- Kees Cook

Re: [PATCH v1 1/1] Firstly, as Andy mentioned, this should be smp_rmb() instead of rmb(). considering that TSYNC is a cross-thread situation, and rmb() is a mandatory barrier which should not be used

2021-02-02 Thread Kees Cook
BUG(); BUG() should never be used[1]. This is a recoverable situation, I think, and should be handled as such. -Kees [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on > case SECCOMP_MODE_FILTER: > return __seccomp_filter(this_syscall, sd, false); > default: > -- > 2.19.1 > -- Kees Cook

Re: UBSAN: array-index-out-of-bounds in arch_uprobe_analyze_insn

2020-12-01 Thread Kees Cook
aller.appspot.com/x/repro.c?x=164ee6c590 > > Reported-by: syzbot+9b64b619f10f19d19...@syzkaller.appspotmail.com > Fixes: 4b2bd5fec007 ("proc: fix timerslack_ns CAP_SYS_NICE check when > adjusting self") > > For information about bisection process see: https://goo.gl/tpsmEJ#bisection -- Kees Cook

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-25 Thread Kees Cook
-through All switch/case blocks must end in one of: break; fallthrough; continue; goto ; return [expression]; [3] https://cwe.mitre.org/data/definitions/484.html -- Kees Cook

Re: [PATCH] entry: Fix boot for !CONFIG_GENERIC_ENTRY

2020-11-24 Thread Kees Cook
K flags instead of TIF > flags for !CONFIG_GENERIC_ENTRY. Also, add safeguards to catch this at > compilation time. > > Reported-by: Naresh Kamboju > Suggested-by: Jann Horn > Signed-off-by: Gabriel Krisman Bertazi Thanks for getting this fixed! 3136b93c3fb2 ("entry: Expose helpers to migrate TIF to SYSCALL_WORK flags") Reviewed-by: Kees Cook -- Kees Cook

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Kees Cook
inal series may be lower, but there are still bugs being found from it -- we need to finish this and shut the door on it for good.) -- Kees Cook

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Kees Cook
On Mon, Nov 23, 2020 at 05:32:51PM -0800, Nick Desaulniers wrote: > On Sun, Nov 22, 2020 at 8:17 AM Kees Cook wrote: > > > > On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > > > If none of the 140 patches here fix a real bug, and there is no change >

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-22 Thread Kees Cook
On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > On Fri, 20 Nov 2020 11:30:40 -0800 Kees Cook wrote: > > On Fri, Nov 20, 2020 at 10:53:44AM -0800, Jakub Kicinski wrote: > > > On Fri, 20 Nov 2020 12:21:39 -0600 Gustavo A. R. Silva wrote: > > > > This

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-20 Thread Kees Cook
On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > On Fri, 20 Nov 2020 11:30:40 -0800 Kees Cook wrote: > > On Fri, Nov 20, 2020 at 10:53:44AM -0800, Jakub Kicinski wrote: > > > On Fri, 20 Nov 2020 12:21:39 -0600 Gustavo A. R. Silva wrote: > > > > This

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-20 Thread Kees Cook
ngs are supposed to warn about issues that could > be bugs. Falling through to default: break; can hardly be a bug?! It's certainly a place where the intent is not always clear. I think this makes all the cases unambiguous, and doesn't impact the machine code, since the compiler will happily optimize away any behavioral redundancy. -- Kees Cook

Re: [PATCH net] cfg80211: fix callback type mismatches in wext-compat

2020-11-20 Thread Kees Cook
On Tue, Nov 17, 2020 at 02:07:43PM -0800, Sami Tolvanen wrote: > On Tue, Nov 17, 2020 at 1:45 PM Kees Cook wrote: > > > > On Tue, Nov 17, 2020 at 12:59:02PM -0800, Sami Tolvanen wrote: > > > Instead of casting callback functions to type iw_handler, which trips > >

Re: [PATCH net] cfg80211: fix callback type mismatches in wext-compat

2020-11-20 Thread Kees Cook
; Reported-by: Sedat Dilek > Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH net] cfg80211: fix callback type mismatches in wext-compat

2020-11-17 Thread Kees Cook
wer, > + [IW_IOCTL_IDX(SIOCSIWGENIE)]= __cfg80211_wext_siwgenie, > + [IW_IOCTL_IDX(SIOCSIWAUTH)] = __cfg80211_wext_siwauth, > + [IW_IOCTL_IDX(SIOCGIWAUTH)] = __cfg80211_wext_giwauth, > + [IW_IOCTL_IDX(SIOCSIWENCODEEXT)]= __cfg80211_wext_siwencodeext, > + [IW_IOCTL_IDX(SIOCSIWPMKSA)]= __cfg80211_wext_siwpmksa, > }; > > const struct iw_handler_def cfg80211_wext_handler = { > > base-commit: 9c87c9f41245baa3fc4716cf39141439cf405b01 > -- > 2.29.2.299.gdc1121823c-goog > -- Kees Cook

Re: [PATCH] tracepoint: Do not fail unregistering a probe due to memory allocation

2020-11-17 Thread Kees Cook
ot discussed in the thread, what you had here wouldn't work in a CFI build if the function prototype of the call site and the function don't match. (Though I can't tell if .func() is ever called?) i.e. .func's prototype must match tp_stub_func()'s. -- Kees Cook

Re: [PATCH v5 0/3] Fix inefficiences and rename nla_strlcpy

2020-11-13 Thread Kees Cook
| 2 +- > net/sched/sch_api.c| 2 +- > net/tipc/netlink_compat.c | 2 +- > 29 files changed, 73 insertions(+), 61 deletions(-) > > -- > 2.20.1 > -- Kees Cook

Re: [PATCH v4 2/3] Modify return value of nla_strlcpy to match that of strscpy.

2020-10-30 Thread Kees Cook
> 0) { > /* We dropped the RTNL semaphore in order to >* perform the module load. So, even if we >* succeeded in loading the module we have to Oops, I think this should be >= 0 ? -- Kees Cook

Re: [RFC][PATCH v3 3/3] Rename nla_strlcpy to nla_strscpy.

2020-10-23 Thread Kees Cook
ht -- this is a very narrow use-case (NLA). I think this series is fine as-is. -- Kees Cook

Re: [RFC][PATCH v3 3/3] Rename nla_strlcpy to nla_strscpy.

2020-10-22 Thread Kees Cook
On Thu, Oct 22, 2020 at 11:41:31AM +0200, Francis Laniel wrote: > Le jeudi 22 octobre 2020, 01:49:59 CEST Kees Cook a écrit : > > On Tue, Oct 20, 2020 at 06:47:07PM +0200, > > laniel_fran...@privacyrequired.com > wrote: > > > From: Francis Laniel > > >

Re: [RFC][PATCH v3 3/3] Rename nla_strlcpy to nla_strscpy.

2020-10-21 Thread Kees Cook
also be: "treewide: Rename nla_strlcpy to nla_strscpy" But otherwise, yup, easy mechanical change. Reviewed-by: Kees Cook > --- > drivers/infiniband/core/nldev.c| 10 +- > drivers/net/can/vxcan.c| 4 ++-- > drivers/net/veth.c

Re: [RFC][PATCH v3 2/3] Modify return value of nla_strlcpy to match that of strscpy.

2020-10-21 Thread Kees Cook
d to take into account this > modification. > > Signed-off-by: Francis Laniel This looks correct to me. Thanks for the respin! Reviewed-by: Kees Cook -- Kees Cook

Re: [RFC][PATCH v3 1/3] Fix unefficient call to memset before memcpu in nla_strlcpy.

2020-10-21 Thread Kees Cook
"foo\0" and dst is 5 bytes long, the result will be: > 1. "fooGG" after memcpy (G means garbage). > 2. "foo\0\0" after memset. > > Signed-off-by: Francis Laniel Looks good! (If there are future versions of this series, I think you can drop the RFC part...) Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH] random32: Restore __latent_entropy attribute on net_rand_state

2020-10-05 Thread Kees Cook
On Tue, Oct 06, 2020 at 04:28:09AM +0200, Willy Tarreau wrote: > Hi Kees, > > On Mon, Oct 05, 2020 at 07:12:29PM -0700, Kees Cook wrote: > > On Fri, Oct 02, 2020 at 05:16:11PM +0200, Thibaut Sautereau wrote: > > > From: Thibaut Sautereau > > > > > >

Re: [PATCH] random32: Restore __latent_entropy attribute on net_rand_state

2020-10-05 Thread Kees Cook
Emese Revfy > Signed-off-by: Thibaut Sautereau Yes, that looks correct. Thank you! Acked-by: Kees Cook I'm not sure the best tree for this. Ted, Andrew, Linus? I'll take it via my gcc plugin tree if no one else takes it. :) -- Kees Cook

Re: [PATCH 0/3] xtensa: add seccomp support

2020-09-11 Thread Kees Cook
changes for feedback. I was surprised to find the changes in the seccomp selftests today in Linus's tree. I didn't seem to get CCed on this series, even though get_maintainers shows this: $ ./scripts/get_maintainer.pl 0001-selftests-seccomp-add-xtensa-support.mbox Kees Cook (supporter:

Re: [PATCH -next] selftests/seccomp: Use bitwise instead of arithmetic operator for flags

2020-09-08 Thread Kees Cook
NING: sum of > probable bitmasks, consider | Applied, thanks! [1/1] selftests/seccomp: Use bitwise instead of arithmetic operator for flags https://git.kernel.org/kees/c/76993fe3c1e4 Sorry for the massive delay on this one! I lost this email in my inbox. :) -- Kees Cook

Re: [05/16] atmel: convert tasklets to use new tasklet_setup() API

2020-08-27 Thread Kees Cook
.wiki.kernel.org/en/developers/documentation/submittingpatches FWIW, I don't think a revert is needed here to wait for the from_tasket() -> container_from() API to land since from_tasklet() is already being used by other trees. Let's just get this done so we can get closer to ripping out the old tasklet API. We'll have to do a treewide from_timer(), from_tasklet() -> container_from() anyway... -- Kees Cook

Re: [PATCH] block: convert tasklets to use new tasklet_setup() API

2020-08-26 Thread Kees Cook
t's the same form as container_of() > > > and I think we need urgent agreement to not stall everything else so > > > the most innocuous name is likely to get the widest acceptance. > > > > Kees, > > > > Will you be sending the newly proposed API to Linus? I have V2 > > which uses container_from() > > ready to be sent out. > > I liked that James swapped the first two arguments so that it matches > container_of(). Plus it's nice that when you have: > > struct whatever *foo = container_from(ptr, foo, member); > > Then it means that "ptr == &foo->member". I'm a bit stalled right now -- the merge window was keeping me busy, and this week is the Linux Plumbers Conference. This is on my list, but I haven't gotten back around to it. If you want, feel free to send the container_from() patch; you might be able to unblock this faster than me right now. :) -Kees -- Kees Cook

Re: [PATCH] block: convert tasklets to use new tasklet_setup() API

2020-08-18 Thread Kees Cook
On Tue, Aug 18, 2020 at 01:00:33PM -0700, James Bottomley wrote: > On Mon, 2020-08-17 at 13:02 -0700, Jens Axboe wrote: > > On 8/17/20 12:48 PM, Kees Cook wrote: > > > On Mon, Aug 17, 2020 at 12:44:34PM -0700, Jens Axboe wrote: > > > > On 8/17/20 12:29 PM, Kees Cook w

Re: [PATCH] block: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Kees Cook
On Mon, Aug 17, 2020 at 12:44:34PM -0700, Jens Axboe wrote: > On 8/17/20 12:29 PM, Kees Cook wrote: > > On Mon, Aug 17, 2020 at 06:56:47AM -0700, Jens Axboe wrote: > >> On 8/17/20 2:15 AM, Allen Pais wrote: > >>> From: Allen Pais > >>> > >&

Re: [PATCH] block: convert tasklets to use new tasklet_setup() API

2020-08-17 Thread Kees Cook
let is doing. > > I'd fix that up now before everything else goes in... As I mentioned in the other thread, I think this makes things much more readable. It's the same thing that the timer_struct conversion did (added a container_of wrapper) to avoid the ever-repeating use of typeof(), long lines, etc. -- Kees Cook

Re: [PATCH 0/3] Modernize tasklet callback API

2020-08-11 Thread Kees Cook
. Here's for the refactoring: https://github.com/KSPP/linux/issues/30 and here's for the removal: https://github.com/KSPP/linux/issues/94 if you can added details/examples of how they should be removed, that'd help other folks too, if they wanted to jump in. :) -Kees -- Kees Cook

Re: [PATCH v7 3/9] net/scm: Regularize compat handling of scm_detach_fds()

2020-08-08 Thread Kees Cook
On Fri, Aug 07, 2020 at 05:02:15PM -0700, John Stultz wrote: > On Fri, Aug 7, 2020 at 3:18 PM Kees Cook wrote: > > > > On Fri, Aug 07, 2020 at 01:29:24PM -0700, John Stultz wrote: > > > On Thu, Jul 9, 2020 at 11:28 AM Kees Cook wrote: > > > > > &

Re: [PATCH net-next v1] hinic: fix strncpy output truncated compile warnings

2020-08-07 Thread Kees Cook
u8 fault_type; int err; - if (event->type < FAULT_TYPE_MAX) - strncpy(type_str, fault_type[event->type], strlen(fault_type[event->type])); - else - strncpy(type_str, "Unknown", strlen("Unknown")); - - err = devlink_fmsg_string_pair_put(fmsg, "Fault type", type_str); + fault_type = clamp(event->type, FAULT_TYPE_MAX); + err = devlink_fmsg_string_pair_put(fmsg, "Fault type", type_str[fault_type]); if (err) return err; -Kees [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings -- Kees Cook

Re: [PATCH v7 3/9] net/scm: Regularize compat handling of scm_detach_fds()

2020-08-07 Thread Kees Cook
On Fri, Aug 07, 2020 at 01:29:24PM -0700, John Stultz wrote: > On Thu, Jul 9, 2020 at 11:28 AM Kees Cook wrote: > > > > Duplicate the cleanups from commit 2618d530dd8b ("net/scm: cleanup > > scm_detach_fds") into the compat code. > > > > Replace ope

Re: [PATCH 0/3] Modernize tasklet callback API

2020-07-30 Thread Kees Cook
[heavily trimmed CC list because I think lkml is ignoring this thread...] On Thu, Jul 30, 2020 at 09:03:55AM +0200, Thomas Gleixner wrote: > Kees, > > Kees Cook writes: > > This is the infrastructure changes to prepare the tasklet API for > > conversion to passing the

Re: [PATCH v7 2/9] pidfd: Add missing sock updates for pidfd_getfd()

2020-07-09 Thread Kees Cook
On Thu, Jul 09, 2020 at 10:00:42PM +0200, Jann Horn wrote: > On Thu, Jul 9, 2020 at 8:26 PM Kees Cook wrote: > > The sock counting (sock_update_netprioidx() and sock_update_classid()) > > was missing from pidfd's implementation of received fd installation. Add > > a call

Re: [PATCH v7 2/9] pidfd: Add missing sock updates for pidfd_getfd()

2020-07-09 Thread Kees Cook
On Thu, Jul 09, 2020 at 10:00:42PM +0200, Jann Horn wrote: > On Thu, Jul 9, 2020 at 8:26 PM Kees Cook wrote: > > The sock counting (sock_update_netprioidx() and sock_update_classid()) > > was missing from pidfd's implementation of received fd installation. Add > > a call

[PATCH v7 1/9] net/compat: Add missing sock updates for SCM_RIGHTS

2020-07-09 Thread Kees Cook
agram not set correctly") Fixes: d84295067fc7 ("net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly") Signed-off-by: Kees Cook --- include/net/sock.h | 4 net/compat.c | 1 + net/core/sock.c| 21 + 3 files changed, 26 insertions(+)

[PATCH v7 6/9] pidfd: Replace open-coded receive_fd()

2020-07-09 Thread Kees Cook
Replace the open-coded version of receive_fd() with a call to the new helper. Thanks to Vamshi K Sthambamkadi for catching a missed fput() in an earlier version of this patch. Reviewed-by: Sargun Dhillon Acked-by: Christian Brauner Signed-off-by: Kees Cook --- kernel/pid.c | 15

[PATCH v7 4/9] fs: Move __scm_install_fd() to __receive_fd()

2020-07-09 Thread Kees Cook
receive_fd(). Reviewed-by: Sargun Dhillon Acked-by: Christian Brauner Signed-off-by: Kees Cook --- fs/file.c| 41 + include/linux/file.h | 8 include/net/scm.h| 1 - net/compat.c | 2 +- net/core/scm.c

[PATCH v7 3/9] net/scm: Regularize compat handling of scm_detach_fds()

2020-07-09 Thread Kees Cook
Acked-by: Christian Brauner Signed-off-by: Kees Cook --- include/net/scm.h | 1 + net/compat.c | 56 +-- net/core/scm.c| 27 ++- 3 files changed, 37 insertions(+), 47 deletions(-) diff --git a/include/net/scm.h b/include

[PATCH v7 0/9] Add seccomp notifier ioctl that enables adding fds

2020-07-09 Thread Kees Cook
! -Kees [1] https://lore.kernel.org/lkml/20200603011044.7972-1-sar...@sargun.me/ [2] https://lore.kernel.org/lkml/20200610045214.1175600-1-keesc...@chromium.org/ Kees Cook (7): net/compat: Add missing sock updates for SCM_RIGHTS pidfd: Add missing sock updates for pidfd_getfd() net/scm

[PATCH v7 2/9] pidfd: Add missing sock updates for pidfd_getfd()

2020-07-09 Thread Kees Cook
The sock counting (sock_update_netprioidx() and sock_update_classid()) was missing from pidfd's implementation of received fd installation. Add a call to the new __receive_sock() helper. Cc: sta...@vger.kernel.org Fixes: 8649c322f75c ("pid: Implement pidfd_getfd syscall") Signed-of

[PATCH v7 7/9] fs: Expand __receive_fd() to accept existing fd

2020-07-09 Thread Kees Cook
an earlier version of this patch. Reviewed-by: Sargun Dhillon Acked-by: Christian Brauner Signed-off-by: Kees Cook --- fs/file.c| 25 +++-- include/linux/file.h | 10 +++--- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/fs/file.c b/fs/fi

[PATCH v7 5/9] fs: Add receive_fd() wrapper for __receive_fd()

2020-07-09 Thread Kees Cook
receive_fd() for pidfd and seccomp that does not use the ufd argument. For the new helper, the allocated fd needs to be returned on success. Update the existing callers to handle it. Reviewed-by: Sargun Dhillon Acked-by: Christian Brauner Signed-off-by: Kees Cook --- fs/file.c| 17

[PATCH v7 9/9] selftests/seccomp: Test SECCOMP_IOCTL_NOTIF_ADDFD

2020-07-09 Thread Kees Cook
: Sargun Dhillon Link: https://lore.kernel.org/r/20200603011044.7972-5-sar...@sargun.me Co-developed-by: Kees Cook Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 229 ++ 1 file changed, 229 insertions(+) diff --git a/tools/testing/selftests/seccomp

[PATCH v7 8/9] seccomp: Introduce addfd ioctl to seccomp user notifier

2020-07-09 Thread Kees Cook
dk/ [3]: https://lore.kernel.org/lkml/20200612104629.GA15814@ircssh-2.c.rugged-nimbus-611.internal Suggested-by: Matt Denton Link: https://lore.kernel.org/r/20200603011044.7972-4-sar...@sargun.me Signed-off-by: Sargun Dhillon Co-developed-by: Kees Cook Signed-off-by: Kees Cook --- include/

Re: [PATCH v6 4/7] pidfd: Replace open-coded partial receive_fd()

2020-07-08 Thread Kees Cook
x (going back to 3.6...), so, yeah, for ease of backport, probably an explicit sock_update() implementation (with compat and native scm using it), and a second patch for pidfd. Let me see what I looks best... -- Kees Cook

Re: [PATCH v6 6/7] seccomp: Introduce addfd ioctl to seccomp user notifier

2020-07-08 Thread Kees Cook
fine OPEN_HOW_SIZE_LATEST OPEN_HOW_SIZE_VER0 The ..._SIZE_VER0 and ...LATEST stuff doesn't seem useful to export via UAPI. Above, 2 of the 3 export to uapi. Is there a specific rationale for which should and which shouldn't? > > +#undef EA_IOCTL > > Why is this undefed? :) It was defined "in" a function, so I like to mimic function visibility. But you're right; there's no reason to undef it. -- Kees Cook

Re: [PATCH v6 5/7] fs: Expand __receive_fd() to accept existing fd

2020-07-08 Thread Kees Cook
On Tue, Jul 07, 2020 at 02:38:54PM +0200, Christian Brauner wrote: > On Mon, Jul 06, 2020 at 01:17:18PM -0700, Kees Cook wrote: > > Expand __receive_fd() with support for replace_fd() for the coming seccomp > > "addfd" ioctl(). Add new wrapper receive_fd_replace() for

Re: [PATCH v6 4/7] pidfd: Replace open-coded partial receive_fd()

2020-07-08 Thread Kees Cook
On Tue, Jul 07, 2020 at 02:22:20PM +0200, Christian Brauner wrote: > On Mon, Jul 06, 2020 at 01:17:17PM -0700, Kees Cook wrote: > > The sock counting (sock_update_netprioidx() and sock_update_classid()) was > > missing from pidfd's implementation of received fd installation.

Re: [PATCH v6 3/7] fs: Add receive_fd() wrapper for __receive_fd()

2020-07-08 Thread Kees Cook
On Tue, Jul 07, 2020 at 01:49:23PM +0200, Christian Brauner wrote: > On Mon, Jul 06, 2020 at 01:17:16PM -0700, Kees Cook wrote: > > For both pidfd and seccomp, the __user pointer is not used. Update > > __receive_fd() to make writing to ufd optional via a NULL check. Howev

Re: [PATCH v6 1/7] net/scm: Regularize compat handling of scm_detach_fds()

2020-07-08 Thread Kees Cook
On Tue, Jul 07, 2020 at 01:41:03PM +0200, Christian Brauner wrote: > On Mon, Jul 06, 2020 at 01:17:14PM -0700, Kees Cook wrote: > > Duplicate the cleanups from commit 2618d530dd8b ("net/scm: cleanup > > scm_detach_fds") into the compat code. > > > > Move t

[PATCH v6 1/7] net/scm: Regularize compat handling of scm_detach_fds()

2020-07-06 Thread Kees Cook
atagram not set correctly") Fixes: d84295067fc7 ("net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly") Signed-off-by: Kees Cook --- include/net/scm.h | 1 + net/compat.c | 55 +-- net/core/scm.c| 18 ---

[PATCH v6 3/7] fs: Add receive_fd() wrapper for __receive_fd()

2020-07-06 Thread Kees Cook
receive_fd() for pidfd and seccomp that does not use the ufd argument. For the new helper, the allocated fd needs to be returned on success. Update the existing callers to handle it. Reviewed-by: Sargun Dhillon Signed-off-by: Kees Cook --- fs/file.c| 23 +++ include

[PATCH v6 2/7] fs: Move __scm_install_fd() to __receive_fd()

2020-07-06 Thread Kees Cook
receive_fd(). Reviewed-by: Sargun Dhillon Signed-off-by: Kees Cook --- fs/file.c| 48 include/linux/file.h | 8 include/linux/net.h | 9 + include/net/scm.h| 1 - net/compat.c | 2 +- net/core/scm.c

[PATCH v6 0/7] Add seccomp notifier ioctl that enables adding fds

2020-07-06 Thread Kees Cook
this in the for-next/seccomp tree, unless someone has objections. :) Please review and test! -Kees [1] https://lore.kernel.org/lkml/20200603011044.7972-1-sar...@sargun.me/ [2] https://lore.kernel.org/lkml/20200610045214.1175600-1-keesc...@chromium.org/ Kees Cook (5): net/scm: Regularize compat

[PATCH v6 5/7] fs: Expand __receive_fd() to accept existing fd

2020-07-06 Thread Kees Cook
an earlier version of this patch. Reviewed-by: Sargun Dhillon Signed-off-by: Kees Cook --- fs/file.c| 24 ++-- include/linux/file.h | 10 +++--- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/fs/file.c b/fs/file.c index 0efdcf413210..11313ff36

[PATCH v6 4/7] pidfd: Replace open-coded partial receive_fd()

2020-07-06 Thread Kees Cook
rlier version of this patch. Fixes: 8649c322f75c ("pid: Implement pidfd_getfd syscall") Reviewed-by: Sargun Dhillon Signed-off-by: Kees Cook --- kernel/pid.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/kernel/pid.c b/kernel/pid.c index f1496b757162..a31c

[PATCH v6 6/7] seccomp: Introduce addfd ioctl to seccomp user notifier

2020-07-06 Thread Kees Cook
.kernel.org/lkml/a328b91d-fd8f-4f27-b3c2-91a9c45f1...@rasmusvillemoes.dk/ [3]: https://lore.kernel.org/lkml/20200612104629.GA15814@ircssh-2.c.rugged-nimbus-611.internal Suggested-by: Matt Denton Link: https://lore.kernel.org/r/20200603011044.7972-4-sar...@sargun.me Signed-off-by: Sargun Dhill

[PATCH v6 7/7] selftests/seccomp: Test SECCOMP_IOCTL_NOTIF_ADDFD

2020-07-06 Thread Kees Cook
: Sargun Dhillon Link: https://lore.kernel.org/r/20200603011044.7972-5-sar...@sargun.me Co-developed-by: Kees Cook Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 229 ++ 1 file changed, 229 insertions(+) diff --git a/tools/testing/selftests/seccomp

Re: [PATCH v5 4/7] pidfd: Replace open-coded partial fd_install_received()

2020-07-06 Thread Kees Cook
On Mon, Jul 06, 2020 at 06:12:45PM +0200, Christian Brauner wrote: > On Mon, Jul 06, 2020 at 08:34:06AM -0700, Kees Cook wrote: > > Yup, this was a mistake in my refactoring of the pidfs changes. > > I already did. Er, what? (I had a typo in my quote: s/pidfs/pidfd/.) I was try

Re: [PATCH v5 4/7] pidfd: Replace open-coded partial fd_install_received()

2020-07-06 Thread Kees Cook
On Mon, Jul 06, 2020 at 03:07:13PM +0200, Christian Brauner wrote: > On Wed, Jun 17, 2020 at 03:03:24PM -0700, Kees Cook wrote: > > The sock counting (sock_update_netprioidx() and sock_update_classid()) was > > missing from pidfd's implementation of received fd installation.

Re: use-after-free in Bluetooth: 6lowpan (was Re: KASAN: use-after-free Write in refcount_warn_saturate)

2020-07-05 Thread Kees Cook
the same do_enable_set() path which implies there are racing writes to the debugfs write handler. It seems locking is missing for both listen_chan and enable_6lowpan. The latter seems misused in is_bt_6lowpan(), which should likely just be checking for chan->ops == &bt_6lowpan_chan_ops, I think? I have no way to actually test changes to this code... -- Kees Cook

Re: [PATCH 4/5] kprobes: Do not expose probe addresses to non-CAP_SYSLOG

2020-07-05 Thread Kees Cook
On Sun, Jul 05, 2020 at 01:10:54PM -0700, Linus Torvalds wrote: > On Fri, Jul 3, 2020 at 8:50 AM Kees Cook wrote: > > > > With 67 kthreads on a booted system, this patch does not immediately > > blow up... > > Did you try making read/write inc/dec that thing too? Or do

Re: [PATCH 4/5] kprobes: Do not expose probe addresses to non-CAP_SYSLOG

2020-07-03 Thread Kees Cook
} #ifdef __ARCH_WANT_SYS_FORK -- Kees Cook

Re: [PATCH 2/5] module: Refactor section attr into bin attribute

2020-07-03 Thread Kees Cook
On Fri, Jul 03, 2020 at 08:02:07AM +0200, Greg Kroah-Hartman wrote: > On Thu, Jul 02, 2020 at 04:26:35PM -0700, Kees Cook wrote: > > + sattr->battr.size = 3 /* "0x", "\n" */ + (BITS_PER_LONG / 4); > > They get a correct "size" value now,

Re: [PATCH 4/5] kprobes: Do not expose probe addresses to non-CAP_SYSLOG

2020-07-03 Thread Kees Cook
On Thu, Jul 02, 2020 at 06:00:17PM -0700, Linus Torvalds wrote: > On Thu, Jul 2, 2020 at 4:26 PM Kees Cook wrote: > > > > The kprobe show() functions were using "current"'s creds instead > > of the file opener's creds for kallsyms visibility. Fix to use &

[PATCH 3/5] module: Do not expose section addresses to non-CAP_SYSLOG

2020-07-02 Thread Kees Cook
.kernel.org Reported-by: Dominik Czarnota Fixes: be71eda5383f ("module: Fix display of wrong module .text address") Signed-off-by: Kees Cook --- kernel/module.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 9e2954519259.

[PATCH 0/5] Refactor kallsyms_show_value() users for correct cred

2020-07-02 Thread Kees Cook
that were doing checks during "read" context instead of "open" context. This fixes all of these cases by plumbing the file->f_cred through to their ultimate checks via kallsyms_show_value()'s new cred argument. Testing, reviews, and acks appreciated. :) Thanks!

[PATCH 5/5] bpf: Check correct cred for CAP_SYSLOG in bpf_dump_raw_ok()

2020-07-02 Thread Kees Cook
s callers now that kallsysm_show_value() has been refactored to take struct cred. Cc: sta...@vger.kernel.org Fixes: 7105e828c087 ("bpf: allow for correlation of maps and helpers in dump") Signed-off-by: Kees Cook --- include/linux/filter.h | 4 ++-- kernel/bpf/syscall.c | 37 ++

[PATCH 2/5] module: Refactor section attr into bin attribute

2020-07-02 Thread Kees Cook
In order to gain access to the open file's f_cred for kallsym visibility permission checks, refactor the module section attributes to use the bin_attribute instead of attribute interface. Additionally removes the redundant "name" struct member. Cc: sta...@vger.kernel.org Signed-of

[PATCH 1/5] kallsyms: Refactor kallsyms_show_value() to take cred

2020-07-02 Thread Kees Cook
e fixed in the coming patches. Additionally switch return value to bool, since it is always used as a direct permission check, not a 0-on-success, negative-on-error style function return. Cc: sta...@vger.kernel.org Signed-off-by: Kees Cook --- include/linux/filter.h | 2 +- include/linux/kalls

[PATCH 4/5] kprobes: Do not expose probe addresses to non-CAP_SYSLOG

2020-07-02 Thread Kees Cook
Fixes: ffb9bd68ebdb ("kprobes: Show blacklist addresses as same as kallsyms does") Signed-off-by: Kees Cook --- kernel/kprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index d4de217e4a91..2e97febeef77 100644 --- a/kernel/kprob

Re: [PATCH v2 08/16] spi: davinci: Remove uninitialized_var() usage

2020-07-02 Thread Kees Cook
On Thu, Jul 02, 2020 at 04:23:35PM +0100, Mark Brown wrote: > On Thu, Jul 02, 2020 at 08:21:40AM -0700, Kees Cook wrote: > > On Wed, Jul 01, 2020 at 09:39:20PM +0100, Mark Brown wrote: > > > > Please copy maintainers on patches :( > > > Hi! Sorry about that; the CC

Re: [PATCH v2 08/16] spi: davinci: Remove uninitialized_var() usage

2020-07-02 Thread Kees Cook
On Wed, Jul 01, 2020 at 09:39:20PM +0100, Mark Brown wrote: > On Fri, Jun 19, 2020 at 08:29:59PM -0700, Kees Cook wrote: > > Using uninitialized_var() is dangerous as it papers over real bugs[1] > > (or can in the future), and suppresses unrelated compiler warnings (e.g. > > &

Re: [PATCH v2 04/16] b43: Remove uninitialized_var() usage

2020-06-22 Thread Kees Cook
On Mon, Jun 22, 2020 at 10:04:18AM -0700, Nick Desaulniers wrote: > On Fri, Jun 19, 2020 at 8:30 PM Kees Cook wrote: > > > > Using uninitialized_var() is dangerous as it papers over real bugs[1] > > (or can in the future), and suppresses unrelated compiler warnings (e.g.

Re: [PATCH v2 00/16] Remove uninitialized_var() macro

2020-06-20 Thread Kees Cook
On Sat, Jun 20, 2020 at 09:03:34AM +0200, Sedat Dilek wrote: > On Sat, Jun 20, 2020 at 5:30 AM Kees Cook wrote: > > > > v2: > > - more special-cased fixes > > - add reviews > > v1: > > https://lore.kernel.org/lkml/20200603233203.1695403-1-keesc...@chrom

[PATCH v2 04/16] b43: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
v0ve...@mail.gmail.com/ Fixes: 58619b14d106 ("b43: move under broadcom vendor directory") Signed-off-by: Kees Cook --- drivers/net/wireless/broadcom/b43/phy_n.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless

[PATCH v2 06/16] ide: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
z2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Fixes: ce1e518190ea ("ide: don't disable interrupts during kmap_atomic()") Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook --- drivers/ide/ide-taskfile.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/i

[PATCH v2 03/16] drbd: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
rg/lkml/ca+55afwgbgqhbp1fkxvrkepzyr5j8n1vkt1vzdz9knmpuxh...@mail.gmail.com/ [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Fixes: a29728463b25 ("drbd: Backport the "events2" command") Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook --- d

[PATCH v2 05/16] rtlwifi: rtl8192cu: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
Acked-by: Kalle Valo Signed-off-by: Kees Cook --- drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c index f070f25bb735.

[PATCH v2 02/16] x86/mm/numa: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
rg/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Fixes: 1e01979c8f50 ("x86, numa: Implement pfn -> nid mapping granularity check") Signed-off-by: Kees Cook --- arch/x86/mm/numa.c| 18 +- include/linux/page-flags-layout.h | 4 ++

[PATCH v2 10/16] KVM: PPC: Book3S PR: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
yvju65tplgn_ybynv0ve...@mail.gmail.com/ Suggested-by: Nathan Chancellor Fixes: f05ed4d56e9c ("KVM: PPC: Split out code from book3s.c into book3s_pr.c") Signed-off-by: Kees Cook --- arch/powerpc/kvm/book3s_pr.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/powerpc/kvm/book3s_pr.c

[PATCH v2 01/16] docs: deprecated.rst: Add uninitialized_var()

2020-06-19 Thread Kees Cook
Nothing should be using this macro, and the entire idea of tricking the compiler into silencing such warnings is a mistake. Signed-off-by: Kees Cook --- Documentation/process/deprecated.rst | 18 ++ 1 file changed, 18 insertions(+) diff --git a/Documentation/process

[PATCH v2 12/16] f2fs: Eliminate usage of uninitialized_var() macro

2020-06-19 Thread Kees Cook
+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Suggested-by: Chao Yu Signed-off-by: Jason Yan Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20200615085132.166470-1-yanai...@huawei.com Signed-off-by: Kees Cook --- fs/f2fs/data.c | 4 +--- 1 file changed, 1 insertion(+), 3

[PATCH v2 07/16] clk: st: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
Ax8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Fixes: 5f7aa9071e93 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F") Signed-off-by: Kees Cook --- drivers/clk/st/clkgen-fsyn.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st

[PATCH v2 11/16] media: sur40: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
ence unnecessary noisy debug output") Signed-off-by: Kees Cook --- drivers/input/touchscreen/sur40.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index 34d31c7ec8ba..620cdd7d214a 100644 --- a/drivers

[PATCH v2 14/16] checkpatch: Remove awareness of uninitialized_var() macro

2020-06-19 Thread Kees Cook
/lkml/CA+55aFw+Vbj0i=1tgqcr5vqkczwj0qxk6cernou6eedsuda...@mail.gmail.com/ [3] https://lore.kernel.org/lkml/ca+55afwgbgqhbp1fkxvrkepzyr5j8n1vkt1vzdz9knmpuxh...@mail.gmail.com/ [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Signed-off-by: Kee

[PATCH v2 16/16] compiler: Remove uninitialized_var() macro

2020-06-19 Thread Kees Cook
yvju65tplgn_ybynv0ve...@mail.gmail.com/ Suggested-by: Linus Torvalds Reviewed-by: Bart van Assche Reviewed-by: Miguel Ojeda Tested-by: Nathan Chancellor Tested-by: Sedat Dilek Signed-off-by: Kees Cook --- include/linux/compiler-clang.h | 2 -- include/linux/compiler-gcc.h | 6 -- tools/include/

[PATCH v2 15/16] treewide: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
ttps://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Reviewed-by: Leon Romanovsky # drivers/infiniband and mlx4/mlx5 Acked-by: Jason Gunthorpe # IB Acked-by: Kalle Valo # wireless drivers Reviewed-by: Chao Yu # erofs Signed-off-by: Kees Cook --- arch/arm/mach-sa1100/as

[PATCH v2 13/16] mm/debug_vm_pgtable: Remove uninitialized_var() usage

2020-06-19 Thread Kees Cook
rg/lkml/ca+55afwgbgqhbp1fkxvrkepzyr5j8n1vkt1vzdz9knmpuxh...@mail.gmail.com/ [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yvju65tplgn_ybynv0ve...@mail.gmail.com/ Fixes: 399145f9eb6c ("mm/debug: add tests validating architecture page table helpers") Signed-off-by: Kees Cook --- mm/debug_vm_pgta

  1   2   3   4   5   6   7   8   >