Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 16 Jul 2020 09:30:10 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Kees Cook <keescook@...omium.org>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Oscar Carter <oscar.carter@....com>,
	Mitchell Blank Jr <mitch@...oth.com>,
	kernel-hardening@...ts.openwall.com,
	Peter Zijlstra <peterz@...radead.org>,
	kgdb-bugreport@...ts.sourceforge.net,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	alsa-devel@...a-project.org, Allen Pais <allen.lkml@...il.com>,
	Christian Gromm <christian.gromm@...rochip.com>,
	Will Deacon <will@...nel.org>, devel@...verdev.osuosl.org,
	Jonathan Corbet <corbet@....net>,
	Daniel Thompson <daniel.thompson@...aro.org>,
	"David S. Miller" <davem@...emloft.net>,
	Masahiro Yamada <masahiroy@...nel.org>,
	Takashi Iwai <tiwai@...e.com>, Julian Wiedmann <jwi@...ux.ibm.com>,
	"Matthew Wilcox (Oracle)" <willy@...radead.org>,
	Christian Borntraeger <borntraeger@...ibm.com>,
	Nishka Dasgupta <nishkadg.linux@...il.com>,
	Jiri Slaby <jslaby@...e.com>, Jakub Kicinski <kuba@...nel.org>,
	Guenter Roeck <linux@...ck-us.net>,
	Wambui Karuga <wambui.karugax@...il.com>,
	Vasily Gorbik <gor@...ux.ibm.com>, linux-s390@...r.kernel.org,
	linux-kernel@...r.kernel.org, Heiko Carstens <hca@...ux.ibm.com>,
	linux-input@...r.kernel.org, Ursula Braun <ubraun@...ux.ibm.com>,
	Stephen Boyd <swboyd@...omium.org>,
	Chris Packham <chris.packham@...iedtelesis.co.nz>,
	Harald Freudenberger <freude@...ux.ibm.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Jaroslav Kysela <perex@...ex.cz>, Felipe Balbi <balbi@...nel.org>,
	Kyungtae Kim <kt0755@...il.com>, netdev@...r.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Douglas Anderson <dianders@...omium.org>,
	Kevin Curtis <kevin.curtis@...site.co.uk>,
	linux-usb@...r.kernel.org,
	Jason Wessel <jason.wessel@...driver.com>,
	Romain Perier <romain.perier@...il.com>,
	Karsten Graul <kgraul@...ux.ibm.com>
Subject: Re: [PATCH 3/3] tasklet: Introduce new initialization API

On Wed, Jul 15, 2020 at 08:08:47PM -0700, Kees Cook wrote:
> From: Romain Perier <romain.perier@...il.com>
> 
> Nowadays, modern kernel subsystems that use callbacks pass the data
> structure associated with a given callback as argument to the callback.
> The tasklet subsystem remains one which passes an arbitrary unsigned
> long to the callback function. This has several problems:
> 
> - This keeps an extra field for storing the argument in each tasklet
>   data structure, it bloats the tasklet_struct structure with a redundant
>   .data field
> 
> - No type checking can be performed on this argument. Instead of
>   using container_of() like other callback subsystems, it forces callbacks
>   to do explicit type cast of the unsigned long argument into the required
>   object type.
> 
> - Buffer overflows can overwrite the .func and the .data field, so
>   an attacker can easily overwrite the function and its first argument
>   to whatever it wants.
> 
> Add a new tasklet initialization API, via DECLARE_TASKLET() and
> tasklet_setup(), which will replace the existing ones.
> 
> This work is greatly inspired by the timer_struct conversion series,
> see commit e99e88a9d2b0 ("treewide: setup_timer() -> timer_setup()")
> 
> To avoid problems with both -Wcast-function-type (which is enabled in
> the kernel via -Wextra is several subsystems), and with mismatched
> function prototypes when build with Control Flow Integrity enabled,
> this adds the "use_callback" member to let the tasklet caller choose
> which union member to call through. Once all old API uses are removed,
> this and the .data member 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 <romain.perier@...il.com>
> Co-developed-by: Allen Pais <allen.lkml@...il.com>
> Signed-off-by: Allen Pais <allen.lkml@...il.com>
> Co-developed-by: Kees Cook <keescook@...omium.org>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
>  include/linux/interrupt.h | 24 +++++++++++++++++++++++-
>  kernel/softirq.c          | 18 +++++++++++++++++-
>  2 files changed, 40 insertions(+), 2 deletions(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.