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 7D49AC432C0 for ; Tue, 3 Dec 2019 14:17:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3303B206DF for ; Tue, 3 Dec 2019 14:17:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bDlHyEtO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3303B206DF 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 BD36B6B0540; Tue, 3 Dec 2019 09:17:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B5D396B0543; Tue, 3 Dec 2019 09:17:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FD876B0557; Tue, 3 Dec 2019 09:17:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id 8339A6B0540 for ; Tue, 3 Dec 2019 09:17:54 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 2A4CD45CD for ; Tue, 3 Dec 2019 14:17:54 +0000 (UTC) X-FDA: 76224034068.12.pump40_620ae0bcebe05 X-HE-Tag: pump40_620ae0bcebe05 X-Filterd-Recvd-Size: 7596 Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Dec 2019 14:17:53 +0000 (UTC) Received: by mail-ot1-f68.google.com with SMTP id r27so2994694otc.8 for ; Tue, 03 Dec 2019 06:17:53 -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; bh=cUp+Gtc16yuek0IMquCN7Tugq9BdYPN6MOgfa153l0E=; b=bDlHyEtOSNFxuIuQzY/Wi85BrxFLj841EC8+CoX2/DNnmofJWyzZfYVXbZFGPtrZzH TodjJ61W4eLRdbMwNDj9TqvD2uE0nw0pEIukxTXVMVNDvl+hnlqZw5J9aa+7wO3NjigH FRSxzNFPiGD987vSRDBOg/HVJ1FgKgxjTgsJSCF7dwArOsecksqfkfiOzKVJGMEAgxR3 E2yo6NX04lcXn2vpT1p1AgyD3KlsoKkLhOfXTlrQsZnZaShriT0yW8wbjZx5anLtSAue NdiSXXpi2RWMCGW/6oNMYLJQA115SmhW6dpv3m+WalnU91tOd6/WkeWM+ajj4kEQY78k q/ZQ== 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; bh=cUp+Gtc16yuek0IMquCN7Tugq9BdYPN6MOgfa153l0E=; b=APrdeV3nVoL+FExqkbk09qjOkmz3mQmfkk9O/HnhiMkySUj8NcxKzvl2EJMh5a0vwh gTwmnfJ6zCnXGEF3ADDkgfHdtELz1k8fqIpJEjQNLd4pmdy5F9bo3z5yT0rq0yOBPS7I FP6NVzUWj7CIIjSA05X1Mvd74M54Og8IAAzMRRKN2V/XBMwFgMRONLUUhzy2J8IH1k1G unmBArsWR+amU809mPj+NGUQZBYKMDVoRbf3A5UU3UKMmRp5dfyO5tqgLoIX5ueHPXFF EZoawVJGuvGggWyqaHB7n5nw5lu3I1IxO8OYUUxAxe5SUvbYWIjUbICJC6jm3STx3U/W 9nkA== X-Gm-Message-State: APjAAAXBoG2QGrz7V1KG3nAuuyxUzbHI8YOC9PMonr1AIH3mnMZt/EJf M7R8nnr86GbUMPMFqrmBP1PXAleNcL7qBKacTfJPBw== X-Google-Smtp-Source: APXvYqyR4m9vDy+bbSTbp9DguRIbrvjB8J5ZljCOEtbdzB3VoIs/XpxlMztdBNYFiUQjw/dZxioLmr3mYzdEZuXx8i8= X-Received: by 2002:a9d:588c:: with SMTP id x12mr3141126otg.2.1575382672283; Tue, 03 Dec 2019 06:17:52 -0800 (PST) MIME-Version: 1.0 References: <20191122112621.204798-1-glider@google.com> <20191122112621.204798-37-glider@google.com> In-Reply-To: <20191122112621.204798-37-glider@google.com> From: Marco Elver Date: Tue, 3 Dec 2019 15:17:41 +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: Alexander Potapenko 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" 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 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? > 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. > config GENERIC_BUG > def_bool y > depends on BUG > diff --git a/arch/x86/include/asm/checksum.h b/arch/x86/include/asm/checksum.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) += mmx_32.o > else > obj-y += iomap_copy_64.o > +ifneq ($(CONFIG_GENERIC_CSUM),y) > lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o > +endif > lib-y += clear_page_64.o copy_page_64.o > lib-y += memmove_64.o memset_64.o > lib-y += copy_user_64.o Thanks, -- Marco