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=-14.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 ED1C6C43603 for ; Thu, 5 Dec 2019 14:37:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A10FD21835 for ; Thu, 5 Dec 2019 14:37:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="e/iFsIyM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A10FD21835 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4B3866B10A8; Thu, 5 Dec 2019 09:37:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 463F66B10A9; Thu, 5 Dec 2019 09:37:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 352DC6B10AA; Thu, 5 Dec 2019 09:37:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 1B05E6B10A8 for ; Thu, 5 Dec 2019 09:37:28 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 8FFBE181AEF2A for ; Thu, 5 Dec 2019 14:37:27 +0000 (UTC) X-FDA: 76231340934.22.berry45_5e23d0906ea4c X-HE-Tag: berry45_5e23d0906ea4c X-Filterd-Recvd-Size: 8538 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Dec 2019 14:37:26 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id y17so3909927wrh.5 for ; Thu, 05 Dec 2019 06:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zfLIAn7doOMWsg3h7a3EJ0ZEm+uvOCSY7VaA4gLb6Hg=; b=e/iFsIyMwRU9fw1RCRBJ7MWToFBoYA8x6J8UysctG1TWlH1+zHLaZjLYiSAT2brTAQ JsDOZtX2UWunxAD+WlN23CuLqk06EUqB7PK0Nwah9Sl0JN1Qt0NQn6wfY0/lNKoB1j54 wN+XLBp5jYXIZEUtvtRDevAUzOIcZ3Vz2Jsnb1iQ5elwyASkQFpI8YHzr2JE5w+UYXwT ypN2j9stESiGbIShQCdyrwpcv7mH4mVsCrrACwtBJx3uYO/+s/Pzk1K4AuYbfoHhqWSt DKhjrCWnOTOYKUNPblp1bA4veCmbZT5X0byhKbZWjqC+s0kF7NR/VljIY6wvcLrDpDZN pMig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zfLIAn7doOMWsg3h7a3EJ0ZEm+uvOCSY7VaA4gLb6Hg=; b=XaygRn2heMcER19Zb8GqyMsmMo/OVjVzPMHI3Vz4ctRAvANgdIdVY2U94xRIcDPC5A 7FjomHx3BJUdPq5qsy9/UKJLPHnI99QDJEgFr9cvrYYrr/thdDoxUQQnXOGI2z7vQUQ9 gGTLqfytohb1lRaITHth2cozLGq2nHbEVcOVH6/0QJnIPCrrVSD/xfYJk6rL8jwreXwJ pHTVwR3g4/cyjgtLRWTUnOh31mnU3T21XjrwhxznEBJzUoUeC3h43hhwss67l9k2KvSu ZmkSNfffJKaetX15kdOpY2hg9OgHVDI8vxui55wk8NR4oxp6q3a2bcjQmtiLaA+BC4dK ju3w== X-Gm-Message-State: APjAAAWvLuLWONgrbv7QvnaLOam7j+mb+qoaEfwxQPbvikR8kYxB38gf S/CSuW+ZDX++grliW1JqNer0JGjlkN0+QgX53WdSiw== X-Google-Smtp-Source: APXvYqw/RaylocVRqg65iV1yP2/dJtlZwVTndtkqrUyNS6wBVr4MO2p0pVhItfL4gxIjQGBV/bJNUlonjzklMLa2whQ= X-Received: by 2002:adf:ef03:: with SMTP id e3mr10891753wro.216.1575556645173; Thu, 05 Dec 2019 06:37:25 -0800 (PST) MIME-Version: 1.0 References: <20191122112621.204798-1-glider@google.com> <20191122112621.204798-37-glider@google.com> In-Reply-To: From: Alexander Potapenko Date: Thu, 5 Dec 2019 15:37:14 +0100 Message-ID: Subject: Re: [PATCH RFC v3 36/36] net: kasan: kmsan: support CONFIG_GENERIC_CSUM on x86, enable it for KASAN/KMSAN To: Marco Elver Cc: Arnd Bergmann , Michal Simek , Andrey Ryabinin , Vegard Nossum , Dmitry Vyukov , Randy Dunlap , Linux Memory Management List , Al Viro , Andreas Dilger , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Ard Biesheuvel , Christoph Hellwig , Christoph Hellwig , "Darrick J. Wong" , "David S. Miller" , Dmitry Torokhov , Eric Biggers , Eric Dumazet , Eric Van Hensbergen , Greg Kroah-Hartman , Harry Wentland , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jason Wang , Jens Axboe , Marek Szyprowski , Mark Rutland , "Martin K. Petersen" , Martin Schwidefsky , Matthew Wilcox , "Michael S. Tsirkin" , Petr Mladek , Qian Cai , Robin Murphy , Sergey Senozhatsky , Steven Rostedt , Takashi Iwai , "Theodore Ts'o" , Thomas Gleixner , Vasily Gorbik , Wolfram Sang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 3, 2019 at 3:17 PM Marco Elver wrote: > > On Fri, 22 Nov 2019 at 12:28, wrote: > > > > This is needed to allow memory tools like KASAN and KMSAN see the > > memory accesses from the checksum code. Without CONFIG_GENERIC_CSUM the > > tools can't see memory accesses originating from handwritten assembly > > code. > > For KASAN it's a question of detecting more bugs, for KMSAN using the C > > implementation also helps avoid false positives originating from > > seemingly uninitialized checksum values. > > The files touched are only in x86. The title mentions 'net' -- is this > still accurate? Not sure :/ I'll probably replace it with "x86:", as other patches to this file don't mention "net". > > Signed-off-by: Alexander Potapenko > > To: Alexander Potapenko > > Cc: Arnd Bergmann > > Cc: Michal Simek > > Cc: Andrey Ryabinin > > Cc: Vegard Nossum > > Cc: Dmitry Vyukov > > Cc: Randy Dunlap > > Cc: linux-mm@kvack.org > > --- > > > > v2: > > - dropped the "default n" (as requested by Randy Dunlap) > > > > Change-Id: I645e2c097253a8d5717ad87e2e2df6f6f67251f3 > > --- > > arch/x86/Kconfig | 4 ++++ > > arch/x86/include/asm/checksum.h | 10 +++++++--- > > arch/x86/lib/Makefile | 2 ++ > > 3 files changed, 13 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > index 3f83a5c53808..f497aae3dbf4 100644 > > --- a/arch/x86/Kconfig > > +++ b/arch/x86/Kconfig > > @@ -272,6 +272,10 @@ config GENERIC_ISA_DMA > > def_bool y > > depends on ISA_DMA_API > > > > +config GENERIC_CSUM > > + bool > > + default y if KMSAN || KASAN > > When would it be desirable to use GENERIC_CSUM without KMSAN or KASAN? > > If it is generally a bad idea to disable GENERIC_CSUM with KMSAN and > KASAN, does it make more sense to just remove this config option and > unconditionally (if CONFIG_K{A,M}SAN) use the asm-generic version in > checksum.h? > > This would simplify this patch and avoid introducing a config option > that will likely never be set explicitly. There is already a similar option for MIPS and m68k, so I think it's better to be consistent with them. > > config GENERIC_BUG > > def_bool y > > depends on BUG > > diff --git a/arch/x86/include/asm/checksum.h b/arch/x86/include/asm/che= cksum.h > > index d79d1e622dcf..ab3464cbce26 100644 > > --- a/arch/x86/include/asm/checksum.h > > +++ b/arch/x86/include/asm/checksum.h > > @@ -1,6 +1,10 @@ > > /* SPDX-License-Identifier: GPL-2.0 */ > > -#ifdef CONFIG_X86_32 > > -# include > > +#ifdef CONFIG_GENERIC_CSUM > > +# include > > #else > > -# include > > +# ifdef CONFIG_X86_32 > > +# include > > +# else > > +# include > > +# endif > > #endif > > diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile > > index 5246db42de45..bca9031de9ff 100644 > > --- a/arch/x86/lib/Makefile > > +++ b/arch/x86/lib/Makefile > > @@ -55,7 +55,9 @@ endif > > lib-$(CONFIG_X86_USE_3DNOW) +=3D mmx_32.o > > else > > obj-y +=3D iomap_copy_64.o > > +ifneq ($(CONFIG_GENERIC_CSUM),y) > > lib-y +=3D csum-partial_64.o csum-copy_64.o csum-wrappers_64.o > > +endif > > lib-y +=3D clear_page_64.o copy_page_64.o > > lib-y +=3D memmove_64.o memset_64.o > > lib-y +=3D copy_user_64.o > > Thanks, > -- Marco --=20 Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Halimah DeLaine Prado Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg