From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17609C433E1 for ; Fri, 17 Jul 2020 07:09:41 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9444920734 for ; Fri, 17 Jul 2020 07:09:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="BP8x9tri"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="g8LC2DWS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9444920734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 31BCA168D; Fri, 17 Jul 2020 09:08:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 31BCA168D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594969779; bh=UQQoBsFbpjla3wQ4i0/T69W2hA7YzBSn0i/qXLyvbjU=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BP8x9triULLxjei/v+4+W4HiFxQ4cUMG4X2SaWzcjV80vsgrfKe+ogrJV/kjbuNJn SQICl8d5dZJzqroFjD6leDLznN6K/xDtZipF/k9bK1NF5zuGgudda/kdy0nFZR2zez +idLheJkU3fajlbdjw+Npetc1yoyz0P7EMgBUgtA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 81B9CF802FB; Fri, 17 Jul 2020 09:05:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E2303F801EC; Thu, 16 Jul 2020 23:24:28 +0200 (CEST) Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 260E5F8014C for ; Thu, 16 Jul 2020 23:24:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 260E5F8014C Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="g8LC2DWS" Received: by mail-pl1-x643.google.com with SMTP id m16so4427586pls.5 for ; Thu, 16 Jul 2020 14:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GuRiIW4nk04qSodan0OUo2QjHoiXfRAFsMTlj/9iRXw=; b=g8LC2DWSxvHGrs2YfNgqk3VpuTWmyx3EVdSYPeLpfd8l0h3R8fxuksSBwA40ai4ADZ kvo6yqRa0fHbA8eJUx9ZhH7+OM1Pi2G/tAj5fqTQQNaJxqtiMUti5yjEE1XiAduQJjm5 0svDx9VcKd8b8SNp5t3SPolgR9wFDAMRS57OI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GuRiIW4nk04qSodan0OUo2QjHoiXfRAFsMTlj/9iRXw=; b=igJoEcLKtW+PSqa8suSMMIGwUHbsjy1q0XYItda3Ajj3z/cX7K/qMzDgvHAK2Q/ysx eZMu3VcvDZYqnYzqrRvllJ+o9WXw78CVpChUw9K8TM7KD6iaqMTa/zmeYSvdTdoUZoww yq7F6cNXPQWhwFpe8Y8JlczHH6sAYaoyejjPo0gOjdxsegBqdRjqiRgBPcX104swmR/c 9SPaFQstFA4LE0MBHmjvaRYiwhj1OeJygbbb2d9GeuXHip2TkI18mkWiehR53QEqJDng vBMuPvHfJEAzbupc1eNiYV5gVg4Rp8aNRM+hrGBXY5Mo8eyTfBNkwMQu34vtdgQ/JeIO 7xLQ== X-Gm-Message-State: AOAM533SEONs8xPZ1KYIDh3AbEOqE7U6OtvNn72hhomM2YrfT93eFMlv 5nbcELHVzuJKCzKbfUJ7VN1oWA== X-Google-Smtp-Source: ABdhPJyP3qLO1Y3SOoBLYTFQL4BEKccE2HwZrJKw7OBU3VgLMhd+dox46Tq8jY21pcPLVhtrgaAB+g== X-Received: by 2002:a17:90a:1089:: with SMTP id c9mr6859603pja.180.1594934662399; Thu, 16 Jul 2020 14:24:22 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r25sm1515610pgv.88.2020.07.16.14.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 14:24:21 -0700 (PDT) Date: Thu, 16 Jul 2020 14:24:20 -0700 From: Kees Cook To: Dmitry Torokhov Subject: Re: [PATCH 0/3] Modernize tasklet callback API Message-ID: <202007161416.9C1B8F3D26@keescook> References: <20200716030847.1564131-1-keescook@chromium.org> <20200716075718.GM10769@hirez.programming.kicks-ass.net> <202007161214.102F6E6@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Fri, 17 Jul 2020 09:05:03 +0200 Cc: Kuppuswamy Sathyanarayanan , "Rafael J. Wysocki" , Oscar Carter , Mitchell Blank Jr , kernel-hardening@lists.openwall.com, Peter Zijlstra , kgdb-bugreport@lists.sourceforge.net, Sebastian Andrzej Siewior , "alsa-devel@alsa-project.org" , Allen Pais , netdev , Christian Gromm , Will Deacon , devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, Daniel Thompson , "David S. Miller" , Masahiro Yamada , Takashi Iwai , Julian Wiedmann , "Matthew Wilcox \(Oracle\)" , Christian Borntraeger , Nishka Dasgupta , Jiri Slaby , Jakub Kicinski , Guenter Roeck , Wambui Karuga , Vasily Gorbik , lkml , Heiko Carstens , "linux-input@vger.kernel.org" , Ursula Braun , Stephen Boyd , Chris Packham , Harald Freudenberger , Thomas Gleixner , Felipe Balbi , Kyungtae Kim , Greg Kroah-Hartman , Jonathan Corbet , Douglas Anderson , Kevin Curtis , USB list , Jason Wessel , Romain Perier , Karsten Graul X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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, Kees Cook wrote: > > > > Hi, > > > > > > > > This is the infrastructure changes to prepare the tasklet API for > > > > conversion to passing the tasklet struct as the callback argument instead > > > > of an arbitrary unsigned long. The first patch details why this is useful > > > > (it's the same rationale as the timer_struct changes from a bit ago: > > > > less abuse during memory corruption attacks, more in line with existing > > > > ways of doing things in the kernel, save a little space in struct, > > > > etc). Notably, the existing tasklet API use is much less messy, so there > > > > is less to clean up. > > > > > > I would _MUCH_ rather see tasklets go the way of the dodo, esp. given > > > that: > > > > > > > drivers/input/keyboard/omap-keypad.c | 2 +- > > > > drivers/input/serio/hil_mlc.c | 2 +- > > > > drivers/net/wan/farsync.c | 4 +-- > > > > drivers/s390/crypto/ap_bus.c | 2 +- > > > > drivers/staging/most/dim2/dim2.c | 2 +- > > > > drivers/staging/octeon/ethernet-tx.c | 2 +- > > > > drivers/tty/vt/keyboard.c | 2 +- > > > > drivers/usb/gadget/udc/snps_udc_core.c | 6 ++--- > > > > drivers/usb/host/fhci-sched.c | 2 +- > > > > include/linux/interrupt.h | 37 ++++++++++++++++++++++---- > > > > kernel/backtracetest.c | 2 +- > > > > kernel/debug/debug_core.c | 2 +- > > > > kernel/irq/resend.c | 2 +- > > > > kernel/softirq.c | 18 ++++++++++++- > > > > net/atm/pppoatm.c | 2 +- > > > > net/iucv/iucv.c | 2 +- > > > > sound/drivers/pcsp/pcsp_lib.c | 2 +- > > > > 17 files changed, 66 insertions(+), 25 deletions(-) > > > > > > there appear to be hardly any users left.. Can't we stage an extinction > > > event here instead? > > > > Oh, I wish, but no. That's just the ones using DECLARE_TASKLET. There > > are hundred(s?) more (see the referenced tree). > > Still, do we really need tasklets? Can we substitute timers executing > immediately in their place? If there is a direct replacement, then sure, I'd be happy to do whatever, however it does not look mechanical to me. If there is a mechanical way that will convert these two directories (as an example of various complexities): drivers/crypto/ccp/ drivers/gpu/drm/i915/gt/ then let's get it documented. But if not, let's write up a paragraph for the deprecated.rst, mark it as deprecated in comments, and modernize the API (which is a mostly mechanical change) to avoid it being a problem for CFI, for memory corruption, and heap space, etc. -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11449C433E5 for ; Thu, 16 Jul 2020 21:24:42 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id 33A8720787 for ; Thu, 16 Jul 2020 21:24:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="g8LC2DWS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33A8720787 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-19370-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 1888 invoked by uid 550); 16 Jul 2020 21:24:35 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Received: (qmail 1853 invoked from network); 16 Jul 2020 21:24:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GuRiIW4nk04qSodan0OUo2QjHoiXfRAFsMTlj/9iRXw=; b=g8LC2DWSxvHGrs2YfNgqk3VpuTWmyx3EVdSYPeLpfd8l0h3R8fxuksSBwA40ai4ADZ kvo6yqRa0fHbA8eJUx9ZhH7+OM1Pi2G/tAj5fqTQQNaJxqtiMUti5yjEE1XiAduQJjm5 0svDx9VcKd8b8SNp5t3SPolgR9wFDAMRS57OI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GuRiIW4nk04qSodan0OUo2QjHoiXfRAFsMTlj/9iRXw=; b=MkrIcXfHVu9i5tCj5BDoyNFEcUxQnxTrUEED+RMYQ5mQCGKObuuPcpFOU+XyuH/EvF 16TtBzazGxmPjWOVVoChWPXtGOV17lba9aCWB5GuyRvj+cKcnDu75UY1xqIrSuML+DfT /xyjtfL3+nFF1nQXakGAPBZrDRK7+pneYVfg3BQoh/7SZmwRVsxotDk2sPoX3oMjZnIe JAm/RkuysnZ/QvOOjPCLS1zhTcChMTQxvo+4pNEagJ9DXANAzy9HJRztE3bF3Bb1iilr pL+4Ua0dfrUcFi+2EWTswbM2K/qGUYrhstH0iIQ+GB8GBvKDKAyAUNe3tWrA/9CyGsv+ iWYA== X-Gm-Message-State: AOAM531ZOVLWpCt5O3maLfi8lYMp9U4H8PSKbjnux52phVbUBNN+Ir2b VErl2uQveReSdsXMLZLwqFRGvg== X-Google-Smtp-Source: ABdhPJyP3qLO1Y3SOoBLYTFQL4BEKccE2HwZrJKw7OBU3VgLMhd+dox46Tq8jY21pcPLVhtrgaAB+g== X-Received: by 2002:a17:90a:1089:: with SMTP id c9mr6859603pja.180.1594934662399; Thu, 16 Jul 2020 14:24:22 -0700 (PDT) Date: Thu, 16 Jul 2020 14:24:20 -0700 From: Kees Cook To: Dmitry Torokhov Cc: Peter Zijlstra , Greg Kroah-Hartman , Thomas Gleixner , Allen Pais , Oscar Carter , Romain Perier , Kevin Curtis , "David S. Miller" , Jakub Kicinski , Harald Freudenberger , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Jiri Slaby , Felipe Balbi , Jason Wessel , Daniel Thompson , Douglas Anderson , Mitchell Blank Jr , Julian Wiedmann , Karsten Graul , Ursula Braun , Jaroslav Kysela , Takashi Iwai , Christian Gromm , Nishka Dasgupta , Masahiro Yamada , Stephen Boyd , "Matthew Wilcox (Oracle)" , Wambui Karuga , Guenter Roeck , Chris Packham , Kyungtae Kim , Kuppuswamy Sathyanarayanan , Sebastian Andrzej Siewior , "Rafael J. Wysocki" , Jonathan Corbet , Will Deacon , "linux-input@vger.kernel.org" , lkml , netdev , linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, USB list , kgdb-bugreport@lists.sourceforge.net, "alsa-devel@alsa-project.org" , kernel-hardening@lists.openwall.com Subject: Re: [PATCH 0/3] Modernize tasklet callback API Message-ID: <202007161416.9C1B8F3D26@keescook> References: <20200716030847.1564131-1-keescook@chromium.org> <20200716075718.GM10769@hirez.programming.kicks-ass.net> <202007161214.102F6E6@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Kees Cook wrote: > > > > Hi, > > > > > > > > This is the infrastructure changes to prepare the tasklet API for > > > > conversion to passing the tasklet struct as the callback argument instead > > > > of an arbitrary unsigned long. The first patch details why this is useful > > > > (it's the same rationale as the timer_struct changes from a bit ago: > > > > less abuse during memory corruption attacks, more in line with existing > > > > ways of doing things in the kernel, save a little space in struct, > > > > etc). Notably, the existing tasklet API use is much less messy, so there > > > > is less to clean up. > > > > > > I would _MUCH_ rather see tasklets go the way of the dodo, esp. given > > > that: > > > > > > > drivers/input/keyboard/omap-keypad.c | 2 +- > > > > drivers/input/serio/hil_mlc.c | 2 +- > > > > drivers/net/wan/farsync.c | 4 +-- > > > > drivers/s390/crypto/ap_bus.c | 2 +- > > > > drivers/staging/most/dim2/dim2.c | 2 +- > > > > drivers/staging/octeon/ethernet-tx.c | 2 +- > > > > drivers/tty/vt/keyboard.c | 2 +- > > > > drivers/usb/gadget/udc/snps_udc_core.c | 6 ++--- > > > > drivers/usb/host/fhci-sched.c | 2 +- > > > > include/linux/interrupt.h | 37 ++++++++++++++++++++++---- > > > > kernel/backtracetest.c | 2 +- > > > > kernel/debug/debug_core.c | 2 +- > > > > kernel/irq/resend.c | 2 +- > > > > kernel/softirq.c | 18 ++++++++++++- > > > > net/atm/pppoatm.c | 2 +- > > > > net/iucv/iucv.c | 2 +- > > > > sound/drivers/pcsp/pcsp_lib.c | 2 +- > > > > 17 files changed, 66 insertions(+), 25 deletions(-) > > > > > > there appear to be hardly any users left.. Can't we stage an extinction > > > event here instead? > > > > Oh, I wish, but no. That's just the ones using DECLARE_TASKLET. There > > are hundred(s?) more (see the referenced tree). > > Still, do we really need tasklets? Can we substitute timers executing > immediately in their place? If there is a direct replacement, then sure, I'd be happy to do whatever, however it does not look mechanical to me. If there is a mechanical way that will convert these two directories (as an example of various complexities): drivers/crypto/ccp/ drivers/gpu/drm/i915/gt/ then let's get it documented. But if not, let's write up a paragraph for the deprecated.rst, mark it as deprecated in comments, and modernize the API (which is a mostly mechanical change) to avoid it being a problem for CFI, for memory corruption, and heap space, etc. -- Kees Cook