From patchwork Wed Feb 15 13:00:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13141621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 182F2C6379F for ; Wed, 15 Feb 2023 13:01:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A3C16B0073; Wed, 15 Feb 2023 08:01:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 72D2E6B0074; Wed, 15 Feb 2023 08:01:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CEF56B0075; Wed, 15 Feb 2023 08:01:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4D01F6B0073 for ; Wed, 15 Feb 2023 08:01:22 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1CE1D406BA for ; Wed, 15 Feb 2023 13:01:22 +0000 (UTC) X-FDA: 80469537204.26.B4DF3D2 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf13.hostedemail.com (Postfix) with ESMTP id 235DA20027 for ; Wed, 15 Feb 2023 13:01:18 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=R0VoQz6v; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676466079; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eEGF2dhJHQrOcjGWiEp/1K3Pqyv63qcrypNyumV54Yg=; b=y6GsKvaXQoAYpbEYQXtTGr8BmW41QIYh2jLRt8XL6mnFZIGj2C/Qo9qXfkuXK3q8/zp4vN vP5xD0sip4nRj+SLXhOVQO77jcaJYSWIDcuVMtqzhcyFivu4Fil8oPjLSaKThx0+N6M8rK c0q7HgzfdJ3CQ8p7xSODUWvuSinH3Nk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=R0VoQz6v; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676466079; a=rsa-sha256; cv=none; b=ywsKUV2oHzyAxzR+4YaaDmNq4uweGQiSmIM1E9dIzDgvE0pF0OyXs42BUR316D3+4tLMrH QkB9RUZgqXpSYUupfb/Pv74R37A3J4unfSGBTI34pDDTxeizrN+dT7/ozRaj3+DO2vhboK 62HC4DuNBqnD8tk9sXCoyqUcFJCxhFQ= 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 ams.source.kernel.org (Postfix) with ESMTPS id 9CC17B8212A; Wed, 15 Feb 2023 13:01:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6819BC4339B; Wed, 15 Feb 2023 13:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676466076; bh=gjHAHHqwYm8o1x992R2kWv27BpeHlDcrRDtNIB6oM0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0VoQz6vcJRMvwJmX8jY9JYLJ6IEQOqKG5hN5MD23CQx5K1TPX4HjelS4VNioCyw3 rRxumsiccf2phYjGDdQoD3SeM5AZmc6cvjwZOvxHWTc7NiBmbiL8nPtDgsnB1Jq3VH JAYDeL/C0k2JAfyi1BNJVf4BvguAmuyg/PmI++jrkzaYSGIN8RysFq6bJzEuLGj04Q HT0tIBlddiEC6XTcvgm7A2hdOIx6kcZAuIlkjEwzBSYfje5AnZ3Aq+bpjPsBy105BX 37oYXOxUG6vwUT06gEDFQ/0EXnoWg6kDAOGQfeO58yaYtOsG3XL1eXaETFTDTIozDq APgN5Cqa7Mg9g== From: Arnd Bergmann To: Andrew Morton , Josh Poimboeuf , Peter Zijlstra Cc: Arnd Bergmann , Alexander Potapenko , Andrey Konovalov , Andrey Ryabinin , Dmitry Vyukov , Kuan-Ying Lee , Marco Elver , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] [v2] kasan: mark addr_has_metadata __always_inline Date: Wed, 15 Feb 2023 14:00:56 +0100 Message-Id: <20230215130058.3836177-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215130058.3836177-1-arnd@kernel.org> References: <20230215130058.3836177-1-arnd@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 235DA20027 X-Stat-Signature: ynz8znk6kxkim5jodrdd7oyhcjy6hhf8 X-HE-Tag: 1676466078-309607 X-HE-Meta: U2FsdGVkX19XHEtg6Z8UbcHPmrBjsqOPYRlmNbNGdnUrV46CXnCsJUgJGH/v0oBIENSXRw9rSdErmiOZ05przfk0ouNb03SxU296wTLFnoDU+2MSU1RF8DON18klJjT/f1rnBTWBQj30thUrllmYBkf1fWXr2b0swNCjVoqX7WFshgd+E2xDygvWyvIt2fCUlOulyBkH1orOpcpi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rg5JOMs7A62Tv/fvG0iVNYlP/N7Wu+MsWhWolxhx3d0TS8hyp/wnEA/LQnz4h3IGO0Xqko7pwo2WrtVx65pQwHP0clhgCNNcmLJ3fty2kb2+HQEfDnmHtw5SnnA/R8yj0psB99cNvq7XOyq/VkCsgJsk8ywhgUuKEoqj0kKOX/DKERwicqLYVBVFt7T6XjZuEeguA4/p+R3CnyWSyjk4QmTfWFfkGpQO3hKLY= 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: From: Arnd Bergmann When the compiler decides not to inline this function, objtool complains about incorrect UACCESS state: mm/kasan/generic.o: warning: objtool: __asan_load2+0x11: call to addr_has_metadata() with UACCESS enabled Acked-by: Peter Zijlstra (Intel) Reviewed-by: Marco Elver Reviewed-by: Andrey Konovalov Signed-off-by: Arnd Bergmann --- v2: fix objdump/objtool typo --- 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)); }