[PATCH] staging: rtl8723bs: Avoid field-overflowing memcpy()

2021-08-06 Thread Kees Cook
() to correctly reason about the size. "objdump -d" shows no object code changes. Cc: Ross Schmidt Cc: Joe Perches Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- Hi Greg, since I've split out some other patches from my series, it made sense to send this one directl

[PATCH] staging: rtl8192u: Avoid field-overflowing memcpy()

2021-08-06 Thread Kees Cook
-by: Kees Cook --- .../staging/rtl8192u/ieee80211/ieee80211.h| 4 +- .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 4 +- .../staging/rtl8192u/ieee80211/ieee80211_rx.c | 49 ++- 3 files changed, 19 insertions(+), 38 deletions(-) diff --git a/drivers/staging/rtl8192u

[PATCH] staging: rtl8192e: Avoid field-overflowing memcpy()

2021-08-06 Thread Kees Cook
reserved; struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; } __packed; Cc: Darshan D V Cc: Aditya Srivastava Cc: de...@driverdev.osuosl.org Cc: Larry Finger Signed-off-by: Kees Cook --- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 4 +- drivers/staging/rtl8192e/rtllib_rx.c

Re: Re: Re: Re: [PATCH 2/2] binder: Use receive_fd() to receive file from another process

2021-04-02 Thread Kees Cook
; > > > > Why? this is internal things, why does seccomp come into play here? > > > > > > > We already have security_binder_transfer_file() to control the sender > > process. So for the receiver process, do we need the seccomp too? Or > > do I miss something here? > > I do not know, is this something that is a requirement that seccomp > handle all filesystem handles sent to a process? I do not know the > seccomp "guarantee" that well, sorry. This is an extremely confused thread. seccomp _uses_ the receive_fd() API. receive_fd() calls the security_file_receive() LSM hook. The security_binder_*() LSM hooks are different yet. Please, let's wait for Christian to clarify his idea first. -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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 chan

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

Re: [PATCH v3 00/11] Introduce Simple atomic counters

2020-10-16 Thread Kees Cook
can mask finding them. Then, at the end of the day, only the corner cases remain, and those can be seen clearly as they change over time. Since we can never have a one-time audit be anything other than advisory, we need to make it EASY to do those kinds of audits so they can be done regularly. -- Kee

Re: [PATCH v3 00/11] Introduce Simple atomic counters

2020-10-14 Thread Kees Cook
cess of elimination (mark the counters) and direct identification (mark the refcount_t). Then the pool of "unannotated" atomic_t instances continues to shrink. -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH v3 00/11] Introduce Simple atomic counters

2020-10-09 Thread Kees Cook
ich means we have a much lower chance of introducing new flaws (and maybe we'll fix flaws during the conversion, which we've certainly seen before when doing this stricter type/language changes). I don't see why this is an objectionable goal. -- Kees Cook ___

Re: [PATCH v3 00/11] Introduce Simple atomic counters

2020-10-09 Thread Kees Cook
like to take this through mine. I'd mentioned this in the v2, but yes, please take via your trees. :) I'm glad to see this landing! -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH v2 00/11] Introduce Simple atomic counters

2020-10-07 Thread Kees Cook
his was going through Greg's tree since it was touching a lot of drivers.) -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH v2 07/11] drivers/android/binder: convert stats, transaction_log to counter_atomic32

2020-10-07 Thread Kees Cook
on doesn't change the overflow wrap around behavior. > > Reviewed-by: Joel Fernandes (Google) > Signed-off-by: Shuah Khan Yup, seems to be stats-only. Reviewed-by: Kees Cook -- Kees Cook ___ devel mailing list de...@linuxdriverproject.

Re: [PATCH 00/11] Introduce Simple atomic and non-atomic counters

2020-09-28 Thread Kees Cook
On Mon, Sep 28, 2020 at 04:41:47PM -0600, Shuah Khan wrote: > On 9/26/20 10:29 AM, Kees Cook wrote: > > On Fri, Sep 25, 2020 at 05:47:14PM -0600, Shuah Khan wrote: > > > 7. Verified that the test module compiles in kunit env. and test > > >module ca

Re: [PATCH 00/11] Introduce Simple atomic and non-atomic counters

2020-09-28 Thread Kees Cook
the atomic and atomic64 naming currently used (i.e. dropping the '32'). >However that is just my opinion and I am ok with either naming. I had asked that they be size-named to avoid any confusion (i.e. we're making a new API). -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH 00/11] Introduce Simple atomic and non-atomic counters

2020-09-26 Thread Kees Cook
On Fri, Sep 25, 2020 at 06:13:37PM -0600, Shuah Khan wrote: > On 9/25/20 5:52 PM, Kees Cook wrote: > > On Fri, Sep 25, 2020 at 05:47:14PM -0600, Shuah Khan wrote: > > > -- Addressed Kees's comments: > > > 1. Non-atomic counters renamed to counter_simple32

Re: [PATCH 00/11] Introduce Simple atomic and non-atomic counters

2020-09-26 Thread Kees Cook
c/html/latest/dev-tools/kunit/ Though I see the docs are still not updated[1] to reflect the Kconfig (CONFIG_foo_KUNIT_TEST) and file naming conventions (foo_kunit.c). -Kees [1] https://lore.kernel.org/lkml/20200911042404.3598910-1-david...@google.com/ -- Kee

Re: [PATCH 00/11] Introduce Simple atomic and non-atomic counters

2020-09-26 Thread Kees Cook
ps://github.com/KSPP/linux/issues/104 -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH 00/11] Introduce Simple atomic and non-atomic counters

2020-09-25 Thread Kees Cook
an never be used to guard object lifetimes > and state management. I left _return ops for now, inc_return > is necessary for now as per the discussion we had on this topic. I still *really* do not want dec_return() to exist. That is asking for trouble. I'd prefer inc_return() not ex

Re: [RFC PATCH 07/11] drivers/android/binder: convert stats, transaction_log to counter_atomic

2020-09-23 Thread Kees Cook
On Wed, Sep 23, 2020 at 09:31:34PM +0200, Greg KH wrote: > On Wed, Sep 23, 2020 at 12:04:58PM -0700, Kees Cook wrote: > > On Wed, Sep 23, 2020 at 07:10:27AM +0200, Greg KH wrote: > > > On Tue, Sep 22, 2020 at 07:43:36PM -0600, Shuah Khan wrote: > >

Re: [RFC PATCH 07/11] drivers/android/binder: convert stats, transaction_log to counter_atomic

2020-09-23 Thread Kees Cook
counter_atomic br[_IOC_NR(BR_FAILED_REPLY) + 1]; > > + struct counter_atomic bc[_IOC_NR(BC_REPLY_SG) + 1]; > > + struct counter_atomic obj_created[BINDER_STAT_COUNT]; > > + struct counter_atomic obj_deleted[BINDER_STAT_COUNT]; > > These are ju

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

2020-08-26 Thread Kees Cook
> > 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 c

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
ng. > > 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-r

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

2020-08-11 Thread Kees Cook
or 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 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 passi

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

2020-07-16 Thread Kees Cook
On Thu, Jul 16, 2020 at 01:48:20PM -0700, Dmitry Torokhov wrote: > On Thu, Jul 16, 2020 at 12:14 PM Kees Cook wrote: > > > > On Thu, Jul 16, 2020 at 09:57:18AM +0200, Peter Zijlstra wrote: > > > On Wed, Jul 15, 2020 at 08:08:44PM -0700, Kee

Re: [PATCH 1/3] usb: gadget: udc: Avoid tasklet passing a global

2020-07-16 Thread Kees Cook
On Thu, Jul 16, 2020 at 09:28:23AM +0200, Greg Kroah-Hartman wrote: > On Wed, Jul 15, 2020 at 08:08:45PM -0700, Kees Cook wrote: > > There's no reason for the tasklet callback to set an argument since it > > always uses a global. Instead, use the global directly, in preparation >

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

2020-07-16 Thread Kees Cook
e tasklet is scheduled from an interrupt handler. So > we could get rid of these tasklets by using threaded IRQs. Perhaps I can add a comment above the tasklet API area in interrupt.h? -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://dr

Re: [PATCH 3/3] tasklet: Introduce new initialization API

2020-07-16 Thread Kees Cook
On Thu, Jul 16, 2020 at 04:37:04PM +0100, Matthew Wilcox wrote: > On Wed, Jul 15, 2020 at 08:08:47PM -0700, Kees Cook wrote: > > +#define DECLARE_TASKLET(name, _callback) \ > > +struct tasklet_struct name = { \ > > + .

Re: [PATCH 2/3] treewide: Replace DECLARE_TASKLET() with DECLARE_TASKLET_OLD()

2020-07-16 Thread Kees Cook
On Thu, Jul 16, 2020 at 12:29:14PM +0100, Matthew Wilcox wrote: > On Wed, Jul 15, 2020 at 08:08:46PM -0700, Kees Cook wrote: > > This converts all the existing DECLARE_TASKLET() (and ...DISABLED) > > macros with DECLARE_TASKLET_OLD() in preparation for refactoring the > >

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

2020-07-16 Thread Kees Cook
On Thu, Jul 16, 2020 at 09:57:18AM +0200, Peter Zijlstra wrote: > On Wed, Jul 15, 2020 at 08:08:44PM -0700, Kees Cook wrote: > > Hi, > > > > This is the infrastructure changes to prepare the tasklet API for > > conversion to passing the tasklet struct as th

[PATCH 3/3] tasklet: Introduce new initialization API

2020-07-15 Thread Kees Cook
will be removed as well. (On 64-bit this does not grow the struct size as the new member fills the hole after atomic_t, which is also "int" sized.) Signed-off-by: Romain Perier Co-developed-by: Allen Pais Signed-off-by: Allen Pais Co-developed-by: Kees Cook Signed-off-by: Kees Cook --

[PATCH 1/3] usb: gadget: udc: Avoid tasklet passing a global

2020-07-15 Thread Kees Cook
There's no reason for the tasklet callback to set an argument since it always uses a global. Instead, use the global directly, in preparation for converting the tasklet subsystem to modern callback conventions. Signed-off-by: Kees Cook --- drivers/usb/gadget/udc/snps_udc_core.c | 6 ++ 1

[PATCH 2/3] treewide: Replace DECLARE_TASKLET() with DECLARE_TASKLET_OLD()

2020-07-15 Thread Kees Cook
This converts all the existing DECLARE_TASKLET() (and ...DISABLED) macros with DECLARE_TASKLET_OLD() in preparation for refactoring the tasklet callback type. All existing DECLARE_TASKLET() users had a "0" data argument, it has been removed here as well. Signed-off-by: Kees Cook --

[PATCH 0/3] Modernize tasklet callback API

2020-07-15 Thread Kees Cook
of changes is here[1] currently, but to split it up by maintainer the infrastructure changes need to be landed first. Review and Acks appreciated! :) Thanks, -Kees [1] https://github.com/allenpais/tasklets/commits/tasklets_V2 Kees Cook (2): usb: gadget: udc: Avoid tasklet passing a global

Re: [PATCH] staging: rtl8188eu: include: rtl8188e_xmit.h: fixed multiple blank space coding style issues

2020-07-01 Thread Kees Cook
ne txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1 << > 8)) > #define txrpt_ccx_qtime_88e(txrpt_ccx) \ > - ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) > + ((txrpt_ccx)->ccx_qtime0

Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

2020-03-05 Thread Kees Cook
On Thu, Mar 05, 2020 at 11:07:56AM +0300, Dan Carpenter wrote: > On Wed, Mar 04, 2020 at 10:13:40AM -0800, Kees Cook wrote: > > On Tue, Mar 03, 2020 at 12:38:32PM +0300, Dan Carpenter wrote: > > > The real fix is to initialize everything manually, the automated > > > ini

Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

2020-03-04 Thread Kees Cook
I love that patch." https://lore.kernel.org/lkml/CA+55aFykZL+cSBJjBBts7ebEFfyGPdMzTmLSxKnT_29=j94...@mail.gmail.com/ -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH 2/3] binder: do not initialize locals passed to copy_from_user()

2020-02-26 Thread Kees Cook
On Wed, Feb 26, 2020 at 03:58:41PM +0100, Alexander Potapenko wrote: > On Tue, Feb 25, 2020 at 4:24 PM Alexander Potapenko wrote: > > > > On Tue, Feb 25, 2020 at 5:18 AM Kees Cook wrote: > > > > > > On Mon, Feb 24, 2020 at 04:35:00PM +0100, gli...@google.com wrot

Re: [PATCH 2/3] binder: do not initialize locals passed to copy_from_user()

2020-02-24 Thread Kees Cook
eep these markings in sync... -Kees > > Cc: Kees Cook > Cc: Greg Kroah-Hartman > Signed-off-by: Alexander Potapenko > --- > drivers/android/binder.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/android/binder.c b/drive

Re: [PATCH 1/3] compiler.h: define __do_not_initialize

2020-02-24 Thread Kees Cook
ifndef __do_not_initialize > +#define __do_not_initialize > +#endif > + > /* > * The below symbols may be defined for one or more, but not ALL, of the > above > * compilers. We don't consider that to be an error, so set them to nothing. > -- > 2.25.0.265.gbab2e86ba0

[PATCH v2] staging: rtl*: Remove tasklet callback casts

2019-11-15 Thread Kees Cook
of these cases can be found with -Wcast-function-type, which found that the rtl wifi drivers had a bunch of needless function casts. Remove function casts for tasklet callbacks in the various drivers. Signed-off-by: Kees Cook Reviewed-by: Dan Carpenter --- v2: rebased to staging-next, added reviewed

Re: [PATCH] staging: rtl*: Remove tasklet callback casts

2019-11-15 Thread Kees Cook
On Fri, Nov 15, 2019 at 02:16:10PM +0800, Greg Kroah-Hartman wrote: > On Thu, Nov 14, 2019 at 09:39:00PM -0800, Kees Cook wrote: > > In order to make the entire kernel usable under Clang's Control Flow > > Integrity protections, function prototype casts need to be avoi

Re: [PATCH] staging: rtl*: Remove tasklet callback casts

2019-11-15 Thread Kees Cook
On Fri, Nov 15, 2019 at 10:42:35AM +0300, Dan Carpenter wrote: > On Fri, Nov 15, 2019 at 10:40:03AM +0300, Dan Carpenter wrote: > > On Thu, Nov 14, 2019 at 09:39:00PM -0800, Kees Cook wrote: > > > In order to make the entire kernel usable under Clang's Control Flow > >

[PATCH] staging: rtl*: Remove tasklet callback casts

2019-11-14 Thread Kees Cook
of these cases can be found with -Wcast-function-type, which found that the rtl wifi drivers had a bunch of needless function casts. Remove function casts for tasklet callbacks in the various drivers. Signed-off-by: Kees Cook --- drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c| 3

Re: [PATCH RFC v1 02/12] mm/usercopy.c: Prepare check_page_span() for PG_reserved changes

2019-10-23 Thread Kees Cook
. Once we no > > longer set these pages to reserved, we can rework this function to > > perform separate checks for ZONE_DEVICE (split from PG_reserved checks). > > > > Cc: Kees Cook > > Cc: Andrew Morton > > Cc: Kate Stewart > > Cc: Allison Randal &g

Re: [PATCH 1/4] [v2] structleak: disable STRUCTLEAK_BYREF in combination with KASAN_STACK

2019-06-28 Thread Kees Cook
presumably the overall stack usage is still > significantly higher than in other configurations, so this would not > address the full problem. > > I could not test this with CONFIG_INIT_STACK_ALL, which may or may not > suffer from a similar problem. > > Fixes: 81a56f6dc

Re: [PATCH] fix error handling in drivers/staging/rtl8192u/ieee80211/ieee80211_module.c

2018-09-27 Thread Kees Cook
struct ieee80211_device *ieee = NULL; struct net_device *dev; int i, err; @@ -180,6 +180,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) return dev; failed: + ieee80211_networks_free(ieee); if (dev) free_netdev(dev); Valdis, can you respin the patch? -Kees -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH] fix error handling in drivers/staging/rtl8192u/ieee80211/ieee80211_module.c

2018-09-26 Thread Kees Cook
Kletnieks Reviewed-by: Kees Cook (And this seems to be the only case of this -- I don't see this code trivially copy/pasted in other 80211 stacks.) -Kees > --- > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c > b/drivers/staging/rtl8192u/ieee80211/ieee80211

Re: [PATCH v6 10/18] x86/power/64: Remove VLA usage

2018-07-25 Thread Kees Cook
On Wed, Jul 25, 2018 at 4:32 AM, Rafael J. Wysocki wrote: > On Tue, Jul 24, 2018 at 6:49 PM, Kees Cook wrote: >> In the quest to remove all stack VLA usage from the kernel[1], this >> removes the discouraged use of AHASH_REQUEST_ON_STACK by switching to >> shash di

Re: [PATCH v6 18/18] crypto: Remove AHASH_REQUEST_ON_STACK

2018-07-24 Thread Kees Cook
On Tue, Jul 24, 2018 at 10:31 AM, Joe Perches wrote: > On Tue, 2018-07-24 at 09:49 -0700, Kees Cook wrote: >> All users of AHASH_REQUEST_ON_STACK have been removed from the kernel, so >> drop it entirely so no VLAs get reintroduced by future users. > > checkpatch has a test

Re: [PATCH v6 17/18] crypto: ccm: Remove VLA usage

2018-07-24 Thread Kees Cook
On Tue, Jul 24, 2018 at 9:57 AM, Ard Biesheuvel wrote: > On 24 July 2018 at 18:49, Kees Cook wrote: >> From: Ard Biesheuvel >> >> In the quest to remove all stack VLA usage from the kernel[1], this >> drops AHASH_REQUEST_ON_STACK by preallocated the ahash request are

[PATCH v6 13/18] wireless/lib80211: Convert from ahash to shash

2018-07-24 Thread Kees Cook
and reduces stack usage. The stack allocation will be made a fixed size in a later patch to the crypto subsystem. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- net/wireless/lib80211_crypt_tkip.c | 58

[PATCH v6 04/18] dm: Remove VLA usage from hashes

2018-07-24 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the new HASH_MAX_DIGESTSIZE from the crypto layer to allocate the upper bounds on stack usage. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook

[PATCH v6 14/18] staging: rtl8192u: ieee80211: Convert from ahash to shash

2018-07-24 Thread Kees Cook
. By removing a layer of indirection this both improves performance and reduces stack usage. The stack allocation will be made a fixed size in a later patch to the crypto subsystem. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook

[PATCH v6 12/18] drbd: Convert from ahash to shash

2018-07-24 Thread Kees Cook
and reduces stack usage. The stack allocation will be made a fixed size in a later patch to the crypto subsystem. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- drivers/block/drbd/drbd_int.h | 13 +++ drivers/block

[PATCH v6 02/18] crypto: cbc: Remove VLA usage

2018-07-24 Thread Kees Cook
-by: Kees Cook --- include/crypto/cbc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/crypto/cbc.h b/include/crypto/cbc.h index f5b8bfc22e6d..47db0aac2ab9 100644 --- a/include/crypto/cbc.h +++ b/include/crypto/cbc.h @@ -113,7 +113,9 @@ static inline int

[PATCH v6 15/18] staging: rtl8192e: ieee80211: Convert from ahash to shash

2018-07-24 Thread Kees Cook
. By removing a layer of indirection this both improves performance and reduces stack usage. The stack allocation will be made a fixed size in a later patch to the crypto subsystem. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook

[PATCH v6 17/18] crypto: ccm: Remove VLA usage

2018-07-24 Thread Kees Cook
=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Ard Biesheuvel Signed-off-by: Kees Cook --- crypto/ccm.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crypto/ccm.c b/crypto/ccm.c index 0a083342ec8c..b242fd0d3262 100644 --- a/crypto/ccm.c +++ b/crypto/ccm.c @@ -50,7 +50,10

[PATCH v6 18/18] crypto: Remove AHASH_REQUEST_ON_STACK

2018-07-24 Thread Kees Cook
All users of AHASH_REQUEST_ON_STACK have been removed from the kernel, so drop it entirely so no VLAs get reintroduced by future users. Signed-off-by: Kees Cook --- include/crypto/hash.h | 5 - 1 file changed, 5 deletions(-) diff --git a/include/crypto/hash.h b/include/crypto/hash.h index

[PATCH v6 05/18] crypto alg: Introduce generic max blocksize and alignmask

2018-07-24 Thread Kees Cook
cra_blocksize is 144 (SHA3_224_BLOCK_SIZE, 18 8-byte words). For the new blocksize limit, I went with 160 (20 8-byte words). [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/algapi.c | 7 ++- include

[PATCH v6 09/18] ppp: mppe: Remove VLA usage

2018-07-24 Thread Kees Cook
+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook Acked-by: Arnd Bergmann --- drivers/net/ppp/ppp_mppe.c | 56 -- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp

[PATCH v6 10/18] x86/power/64: Remove VLA usage

2018-07-24 Thread Kees Cook
/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook Acked-by: Pavel Machek --- arch/x86/power/hibernate_64.c | 36 --- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/arch/x86/power/hibernate_64.c b/arch

[PATCH v6 03/18] crypto: hash: Remove VLA usage

2018-07-24 Thread Kees Cook
...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/ahash.c| 4 ++-- crypto/algif_hash.c | 2 +- crypto/shash.c| 6 +++--- include/crypto/hash.h | 6 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/crypto/ahash.c b/crypto/ahash.c index a64c143165b1..78aaf2158c43

[PATCH v6 16/18] rxrpc: Reuse SKCIPHER_REQUEST_ON_STACK buffer

2018-07-24 Thread Kees Cook
: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=] This passes the initial SKCIPHER_REQUEST_ON_STACK allocation to the leaf functions for reuse. Two requests allocated on the stack is not needed when only one is used at a time. Signed-off-by: Kees Cook Acked-by: Arnd Bergmann

[PATCH v6 07/18] crypto: shash: Remove VLA usage in unaligned hashing

2018-07-24 Thread Kees Cook
this helper was the only user. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/shash.c | 27 --- include/linux/compiler-gcc.h | 1 - 2 files changed, 16 insertions(+), 12

[PATCH v6 06/18] crypto: qat: Remove VLA usage

2018-07-24 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the new upper bound for the stack buffer. Also adds a sanity check. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- drivers/crypto/qat

[PATCH v6 08/18] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-07-24 Thread Kees Cook
crypto_skcipher_set_reqsize: 88 crypto_skcipher_set_reqsize: 472 [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- include/crypto/internal/skcipher.h | 1 + include/crypto/skcipher.h | 4

[PATCH v6 00/18] crypto: Remove VLA usage

2018-07-24 Thread Kees Cook
@mail.gmail.com Ard Biesheuvel (1): crypto: ccm: Remove VLA usage Kees Cook (17): crypto: xcbc: Remove VLA usage crypto: cbc: Remove VLA usage crypto: hash: Remove VLA usage dm: Remove VLA usage from hashes crypto alg: Introduce generic max blocksize and alignmask crypto: qat: Remove VLA u

[PATCH v6 11/18] dm crypt: Convert essiv from ahash to shash

2018-07-24 Thread Kees Cook
and reduces stack usage. The stack allocation will be made a fixed size in a later patch to the crypto subsystem. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook Reviewed-by: Eric Biggers --- drivers/md/dm-crypt.c | 31

[PATCH v6 01/18] crypto: xcbc: Remove VLA usage

2018-07-24 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/xcbc.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crypto/xcbc.c b/crypto/xcbc.c index 25c75af50d3f..c055f57fab11 100644 --- a/crypto/xcbc.c +++ b/crypto/xcbc.c @@ -57,15 +57,17 @@ struct

[PATCH] drivers/staging/gasket: Use 2-factor allocator calls

2018-07-04 Thread Kees Cook
As already done treewide, switch from open-coded multiplication to using 2-factor allocator helpers. Signed-off-by: Kees Cook --- drivers/staging/gasket/gasket_core.c | 6 +++--- drivers/staging/gasket/gasket_interrupt.c | 15 +-- drivers/staging/gasket/gasket_page_table.c

Re: [PATCH v3] staging: rtl8192u: add error handling for usb_alloc_urb

2018-06-15 Thread Kees Cook
x_urb = NULL; > - > DMESGE("Endpoint Alloc Failure"); > - return -ENOMEM; > + goto out_release_mem; > } > > netdev_dbg(dev, "End of initendpoints\n"); >

Re: [PATCH v2] staging: rtl8192u: add error handling for usb_alloc_urb

2018-06-15 Thread Kees Cook
On Fri, Jun 15, 2018 at 9:47 AM, Kees Cook wrote: > On Fri, Jun 15, 2018 at 9:33 AM, Greg Kroah-Hartman > wrote: >> On Sat, Jun 16, 2018 at 12:25:23AM +0800, Zhouyang Jia wrote: >>> When usb_alloc_urb fails, the lack of error-handling code may >>> cause unexpect

Re: [PATCH v2] staging: rtl8192u: add error handling for usb_alloc_urb

2018-06-15 Thread Kees Cook
; kfree(priv->rx_urb); I think you need some kind of helper to do this, and you can call into it from your error paths... -Kees > {sigh} > > No, you are still leaking memory on all of these changes that you just > made :( > > greg k-h -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH] staging: vchiq_arm: Clear VLA warning

2018-03-09 Thread Kees Cook
ay need changing, there is already a >> pre-processor constant VCHIQ_MAX_SERVICES > > Maybe just use ARRAY_SIZE(local_max_services) and not have the #define? I think you mean ARRAY_SIZE(service_data) ? In that case, yeah, it seems like a raw "64" for the array size can b

[PATCH v2] staging: lustre: Remove VLA usage

2018-03-07 Thread Kees Cook
-by: Kees Cook <keesc...@chromium.org> Reviewed-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/staging/lustre/lustre/llite/xattr.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/st

Re: [PATCH] staging: lustre: Remove VLA usage

2018-03-07 Thread Kees Cook
On Wed, Mar 7, 2018 at 5:10 AM, Rasmus Villemoes <rasmus.villem...@prevas.dk> wrote: > On 2018-03-07 06:46, Kees Cook wrote: >> The kernel would like to remove all VLA usage. This switches to a >> simple kasprintf() instead. >> >> Signed-off-by: Kees Cook <keesc

[PATCH] staging: lustre: Remove VLA usage

2018-03-06 Thread Kees Cook
The kernel would like to remove all VLA usage. This switches to a simple kasprintf() instead. Signed-off-by: Kees Cook <keesc...@chromium.org> --- drivers/staging/lustre/lustre/llite/xattr.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/s

[PATCH] staging/irda/net: Drop extraneous parentheses around test

2017-11-22 Thread Kees Cook
Noticed during Clang builds. This drops the redundant parentheses. Cc: Samuel Ortiz <sam...@sortiz.org> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook <keesc...@chromium.org> --- drivers/staging/irda/net/irlmp.

Re: [PATCH v2] staging: greybus: Convert timers to use timer_setup()

2017-11-03 Thread Kees Cook
On Fri, Nov 3, 2017 at 2:49 PM, Bryan O'Donoghue <bryan.odonog...@linaro.org> wrote: > > > On 03/11/17 20:21, Kees Cook wrote: >> >> On Mon, Oct 30, 2017 at 5:05 PM, Kees Cook <keesc...@chromium.org> wrote: >>> >>> On Mon, Oct 30, 201

Re: [PATCH v2] staging: greybus: Convert timers to use timer_setup()

2017-11-03 Thread Kees Cook
On Mon, Oct 30, 2017 at 5:05 PM, Kees Cook <keesc...@chromium.org> wrote: > On Mon, Oct 30, 2017 at 5:01 PM, <pure.lo...@nexus-software.ie> wrote: >> There's a separate change to loopback.c an old patch ARAIR that will >> subtract use of the timer from loopback

Re: [PATCH] staging: rtlwifi: remove an unused variable

2017-11-02 Thread Kees Cook
rtlpriv->works.rtl_wq, >>works.watchdog_wq, 0); > -- > 2.9.0 > Acked-by: Kees Cook <keesc...@chromium.org> Thanks for catching this! (sfr reported this too.) -Kees -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH v2] staging: greybus: Convert timers to use timer_setup()

2017-10-30 Thread Kees Cook
On Mon, Oct 30, 2017 at 5:01 PM, <pure.lo...@nexus-software.ie> wrote: > On 30 October 2017 9:37:37 p.m. GMT+00:00, Kees Cook <keesc...@chromium.org> > wrote: >>On Mon, Oct 30, 2017 at 4:48 AM, Johan Hovold <jo...@kernel.org> wrote: >>> On Mon, Oct 30, 201

[PATCH v2] staging: vc04_services: Convert timers to use timer_setup()

2017-10-30 Thread Kees Cook
..@driverdev.osuosl.org Signed-off-by: Kees Cook <keesc...@chromium.org> Tested-by: Stefan Wahren <stefan.wah...@i2se.com> --- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 17 +++-- .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 1 + 2 files chang

Re: [PATCH v2] staging: greybus: Convert timers to use timer_setup()

2017-10-30 Thread Kees Cook
. > > That's correct. > >> I'll probably need at least a day to look at that, so it'll be the >> weekend before I can really allocate time. > > Cool. I'm quite sure I just rebased your loopback conversion patch on my > core timeout handling and used that to test the core i

[PATCH v2] staging: greybus: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
.@nexus-software.ie> Cc: Johan Hovold <jo...@kernel.org> Cc: Alex Elder <el...@kernel.org> Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook <keesc...@chromium.org> --- v2: Added back "get" in timer code, thanks to Bryan

Re: [PATCH] staging: greybus: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
On Tue, Oct 24, 2017 at 6:30 AM, Bryan O'Donoghue <pure.lo...@nexus-software.ie> wrote: > On 24/10/17 14:14, Kees Cook wrote: >> >> On Tue, Oct 24, 2017 at 5:52 AM, Bryan O'Donoghue >> <pure.lo...@nexus-software.ie> wrote: >>> >>> On 24/10/17 13

Re: [PATCH] staging: greybus: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
On Tue, Oct 24, 2017 at 5:52 AM, Bryan O'Donoghue <pure.lo...@nexus-software.ie> wrote: > On 24/10/17 13:47, Kees Cook wrote: >> >> On Tue, Oct 24, 2017 at 2:40 AM, Bryan O'Donoghue >> <pure.lo...@nexus-software.ie> wrote: >>> >>> On 24/10/17 10:

Re: [PATCH] staging: greybus: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
On Tue, Oct 24, 2017 at 2:40 AM, Bryan O'Donoghue <pure.lo...@nexus-software.ie> wrote: > On 24/10/17 10:35, Bryan O'Donoghue wrote: >> >> On 24/10/17 09:25, Kees Cook wrote: >>> >>> In preparation for unconditionally passing the struct timer_list pointer

[PATCH] staging: rtl8723bs: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
linyu.y...@alcatel-sbell.com.cn> Cc: Johannes Berg <johannes.b...@intel.com> Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook <keesc...@chromium.org> --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 10 +-- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 1

[PATCH] staging: vc04_services: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
tefan Wahren <stefan.wah...@i2se.com> Cc: Michael Zoran <mzo...@crowfest.net> Cc: Keerthi Reddy <keerthigd4...@gmail.com> Cc: linux-rpi-ker...@lists.infradead.org Cc: linux-arm-ker...@lists.infradead.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook <keesc...@chromium.or

[PATCH] staging: ks7010: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
..@tobin.cc> Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook <keesc...@chromium.org> --- drivers/staging/ks7010/ks_wlan_net.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index b82b5

[PATCH] staging: greybus: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
.@nexus-software.ie> Cc: Johan Hovold <jo...@kernel.org> Cc: Alex Elder <el...@kernel.org> Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook <keesc...@chromium.org> --- drivers/staging/greybus/loopback.c | 14 -- drivers/sta

[PATCH] staging: atomisp: i2c: Convert timers to use timer_setup()

2017-10-24 Thread Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Signed-off-by: Kees Cook <keesc...@chromium.org> --- drivers/staging/media/atomisp/i2c/lm3554

[PATCH] staging: wlan-ng: Convert timers to use timer_setup()

2017-10-18 Thread Kees Cook
gmail.com> Cc: Adrien Descamps <adrien.desca...@gmail.com> Cc: Thibaut SAUTEREAU <thibaut.sauter...@telecom-sudparis.eu> Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook <keesc...@chromium.org> --- drivers/staging/wlan-ng/hfa384x_usb.c | 29 +---

Re: [PATCH] staging/atomisp: Convert timers to use timer_setup()

2017-10-17 Thread Kees Cook
On Tue, Oct 17, 2017 at 1:23 AM, Sakari Ailus <sakari.ai...@iki.fi> wrote: > On Mon, Oct 16, 2017 at 04:24:56PM -0700, Kees Cook wrote: >> In preparation for unconditionally passing the struct timer_list pointer to >> all timer callbacks, switch to using the new timer_s

  1   2   >