Message ID | 20230208164011.2287122-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3559529wrn; Wed, 8 Feb 2023 08:41:26 -0800 (PST) X-Google-Smtp-Source: AK7set9Aop1A+WyPeFqlBZXxDjxvTo2FAt+vmh1q9APLP2t0lYKSTOfpjc56dgZydeoCVXaPlNuG X-Received: by 2002:a17:90a:4b4a:b0:22c:64c6:b7c4 with SMTP id o10-20020a17090a4b4a00b0022c64c6b7c4mr7663409pjl.2.1675874485697; Wed, 08 Feb 2023 08:41:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675874485; cv=none; d=google.com; s=arc-20160816; b=fSJFJWT6c0dBM5S7uvslYwMNWdd8C/3LPeGMcmHLZVlwT/MJoz0JlE5t67sBXD15Ia q+XGkIfC9qiyf+mePywLD9n1nverMPJAa4zWCHnPU6DbDGu5NezrtSTDmae5ey7M/nys wfMS7cqLFVWKDBrwxMt+WLQnWQM/oSCOBIfKCYB6esI5Ac0DLpkaHIPhJu5XRHOhTMBd 6L6W8X1Yxe08mJe44V5fStDYxvR0I8s7L5ZnW39UBG4zVtN7lTG89NSVHC30YXaaLH+d 33MLRxB049w1WaC1fa3ReV2msoY97uNUNUUw8FMLJg6XJM+3v7LFY20JV31dMhBkqBXr KezA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/9gCt/DXMCz5FsPggffU4ASpM56svrE/8oAUHWynS+o=; b=uWabV5fFeJ2RalNcmQe/CtbBi40Yqg5aYedotQM5qn10lXlMxJq79HhP2+cS6FCCeU TK2vBsKymt4sFSoW0LFIOk0J/URM5o3lpluvOYuF8jgL8A/ZFzEX8tLOI5pwwkmFD+fm G4nKZqZmpm5y1mxGht5DCiG9SYDPFHGA6x5+TnG4GN0gfEQHrcaNxTQAiK9LJu6Yb9ip n6rU60ntMtdWjQpxS0/RWnBE/HAKq3k6O9Mu5bJRK8U74KY4ETVIz2jZbZPb1VKCuw/V 5ZBJ4bqiM9LVx7fm1qWTq7rWIZKh/SRyhIXTykWB2ShlHE5FhfvjczyEJ4nN2th3DxWT nZnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WbTBU4bb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y63-20020a638a42000000b004fb1d903b3csi4845661pgd.37.2023.02.08.08.41.11; Wed, 08 Feb 2023 08:41:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WbTBU4bb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbjBHQkh (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Wed, 8 Feb 2023 11:40:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231670AbjBHQk0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Feb 2023 11:40:26 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ECF64DE2C for <linux-kernel@vger.kernel.org>; Wed, 8 Feb 2023 08:40:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9ED27CE2246 for <linux-kernel@vger.kernel.org>; Wed, 8 Feb 2023 16:40:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CEC1C433D2; Wed, 8 Feb 2023 16:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675874417; bh=+5YG0ew14LGHHwHHweKoIWpxQOFrZZOOumCgJpF1eCM=; h=From:To:Cc:Subject:Date:From; b=WbTBU4bbJfZy8N5AHyAEElkmZ0+jh4Z0bDAxfpPzv17D5tzwUiCXxp8oPouaj2eK/ 1BmCiw2rGIGBCI8XnBZ5ZvV3JYw1KgXr6F3oHdHze/wuRGyFR2hqdEfX0xFPNoMGRO /TNYy8dw4r4PBkTxJXd36hXR9rtLam1yu0wIUVRpwwxyAkSNTxt1QKp9rf/zM58dQY W2knpPx/3Ejks1aXkMt4xBmnThZp0+qPiXgff1uXhn7MIKU2WqlFBjJ2QEs2+nw0ua 2Q56IVf/AplSFNOOwaudlBMZT7cy5+N44tv0fRss47/F2TYFsmdVV31/d4e5Hl1Z+5 t0VunwZfiXPzA== From: Arnd Bergmann <arnd@kernel.org> To: Josh Poimboeuf <jpoimboe@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Andrey Ryabinin <ryabinin.a.a@gmail.com>, Andrew Morton <akpm@linux-foundation.org> Cc: kasan-dev@googlegroups.com, Marco Elver <elver@google.com>, Dmitry Vyukov <dvyukov@google.com>, Alexander Potapenko <glider@google.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, Andrey Konovalov <andreyknvl@gmail.com>, Arnd Bergmann <arnd@arndb.de>, Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] kasan: mark addr_has_metadata __always_inline Date: Wed, 8 Feb 2023 17:39:55 +0100 Message-Id: <20230208164011.2287122-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757281764410696138?= X-GMAIL-MSGID: =?utf-8?q?1757281764410696138?= |
Series |
[1/4] kasan: mark addr_has_metadata __always_inline
|
|
Commit Message
Arnd Bergmann
Feb. 8, 2023, 4:39 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de> When the compiler decides not to inline this function, objdump complains about incorrect UACCESS state: mm/kasan/generic.o: warning: objtool: __asan_load2+0x11: call to addr_has_metadata() with UACCESS enabled Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- mm/kasan/kasan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Wed, 8 Feb 2023 at 17:40, Arnd Bergmann <arnd@kernel.org> wrote: > > From: Arnd Bergmann <arnd@arndb.de> > > When the compiler decides not to inline this function, objdump > complains about incorrect UACCESS state: > > mm/kasan/generic.o: warning: objtool: __asan_load2+0x11: call to addr_has_metadata() with UACCESS enabled > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Marco Elver <elver@google.com> > --- > mm/kasan/kasan.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h > index 3231314e071f..9377b0789edc 100644 > --- a/mm/kasan/kasan.h > +++ b/mm/kasan/kasan.h > @@ -297,7 +297,7 @@ static inline const void *kasan_shadow_to_mem(const void *shadow_addr) > << KASAN_SHADOW_SCALE_SHIFT); > } > > -static inline bool addr_has_metadata(const void *addr) > +static __always_inline bool addr_has_metadata(const void *addr) > { > return (kasan_reset_tag(addr) >= > kasan_shadow_to_mem((void *)KASAN_SHADOW_START)); > @@ -316,7 +316,7 @@ bool kasan_check_range(unsigned long addr, size_t size, bool write, > > #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */ > > -static inline bool addr_has_metadata(const void *addr) > +static __always_inline bool addr_has_metadata(const void *addr) > { > return (is_vmalloc_addr(addr) || virt_addr_valid(addr)); > } > -- > 2.39.1 >
On Wed, Feb 08, 2023 at 05:39:55PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > When the compiler decides not to inline this function, objdump > complains about incorrect UACCESS state: > > mm/kasan/generic.o: warning: objtool: __asan_load2+0x11: call to addr_has_metadata() with UACCESS enabled > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> > --- > mm/kasan/kasan.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h > index 3231314e071f..9377b0789edc 100644 > --- a/mm/kasan/kasan.h > +++ b/mm/kasan/kasan.h > @@ -297,7 +297,7 @@ static inline const void *kasan_shadow_to_mem(const void *shadow_addr) > << KASAN_SHADOW_SCALE_SHIFT); > } > > -static inline bool addr_has_metadata(const void *addr) > +static __always_inline bool addr_has_metadata(const void *addr) > { > return (kasan_reset_tag(addr) >= > kasan_shadow_to_mem((void *)KASAN_SHADOW_START)); > @@ -316,7 +316,7 @@ bool kasan_check_range(unsigned long addr, size_t size, bool write, > > #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */ > > -static inline bool addr_has_metadata(const void *addr) > +static __always_inline bool addr_has_metadata(const void *addr) > { > return (is_vmalloc_addr(addr) || virt_addr_valid(addr)); > } > -- > 2.39.1 >
On Wed, Feb 08, 2023 at 05:39:55PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > When the compiler decides not to inline this function, objdump "objdump" -> "objtool" here and in patch subject.
On Wed, Feb 8, 2023 at 5:40 PM Arnd Bergmann <arnd@kernel.org> wrote: > > From: Arnd Bergmann <arnd@arndb.de> > > When the compiler decides not to inline this function, objdump > complains about incorrect UACCESS state: > > mm/kasan/generic.o: warning: objtool: __asan_load2+0x11: call to addr_has_metadata() with UACCESS enabled > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > mm/kasan/kasan.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h > index 3231314e071f..9377b0789edc 100644 > --- a/mm/kasan/kasan.h > +++ b/mm/kasan/kasan.h > @@ -297,7 +297,7 @@ static inline const void *kasan_shadow_to_mem(const void *shadow_addr) > << KASAN_SHADOW_SCALE_SHIFT); > } > > -static inline bool addr_has_metadata(const void *addr) > +static __always_inline bool addr_has_metadata(const void *addr) > { > return (kasan_reset_tag(addr) >= > kasan_shadow_to_mem((void *)KASAN_SHADOW_START)); > @@ -316,7 +316,7 @@ bool kasan_check_range(unsigned long addr, size_t size, bool write, > > #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */ > > -static inline bool addr_has_metadata(const void *addr) > +static __always_inline bool addr_has_metadata(const void *addr) > { > return (is_vmalloc_addr(addr) || virt_addr_valid(addr)); > } > -- > 2.39.1 > Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com> Thanks!
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 3231314e071f..9377b0789edc 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -297,7 +297,7 @@ static inline const void *kasan_shadow_to_mem(const void *shadow_addr) << KASAN_SHADOW_SCALE_SHIFT); } -static inline bool addr_has_metadata(const void *addr) +static __always_inline bool addr_has_metadata(const void *addr) { return (kasan_reset_tag(addr) >= kasan_shadow_to_mem((void *)KASAN_SHADOW_START)); @@ -316,7 +316,7 @@ bool kasan_check_range(unsigned long addr, size_t size, bool write, #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */ -static inline bool addr_has_metadata(const void *addr) +static __always_inline bool addr_has_metadata(const void *addr) { return (is_vmalloc_addr(addr) || virt_addr_valid(addr)); }