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: 57527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp179497wrn; Wed, 15 Feb 2023 05:07:40 -0800 (PST) X-Google-Smtp-Source: AK7set/9k4DXG/LAtxM0tnv9m8OkzNO7YXT0Hpa7xA4OJoH5YQjIjXhvRM+AarQz3UgtzDSI7CLx X-Received: by 2002:a05:6402:121a:b0:4a2:5652:d8ba with SMTP id c26-20020a056402121a00b004a25652d8bamr2436868edw.18.1676466460075; Wed, 15 Feb 2023 05:07:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676466460; cv=none; d=google.com; s=arc-20160816; b=MHYyitkNbRQsiDtZ2DECU7aqqHjbxksbt8Y92Pg0v6jZwVbQrP0apxETrEesV/paEm yP1Wp/mvSfvUpIat6IS/V52Z4LTUG/qE3QgdTYYp8Md2BBwNM8P5vI1PQJaMzNmRnO0e V9/Ru9P54RLXJ1kfu/9O6tLMZ45l6fFWJb2EhIQkZVTKheESvyPCjavcJNyZUzm9NR/R VIvVh0clYU7ELqUbi0LVYFevU8cSEj7N6VZZVxoEdC5ZapfhRJez/4L9wNYu2jcYAKzC 5MRq9I0BIfAhnsS6Rz2zvCeEvxQ/wymMhIUnj/ir0kM2LLb5tdwRvjreOGwRvMv6A36h uYBw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eEGF2dhJHQrOcjGWiEp/1K3Pqyv63qcrypNyumV54Yg=; b=gIGnGjcYlOFSvbxiXp1owudb49yWMBUhWuzolIahxiRyDyvjag+LlBzt/jNONqXUZm 32Fk2zwpw7UzcfJITM+4FURG1vREkafu2Rlw4Ip/WRifmkP2/DAuU9EbPZCi3jPGHKup 2GNxY+CMAsfgwNUnsFe08PdubyHQAlBZkKavZ65/ocsWGQcnshHd9qMEZuwUCcIJ6PDe k1tkUoTBV4BqHboFT95jpoNqvuAf1XVjZBVacYF52xFaScOsz9rOEawzh4HhXu+3mrup 9Qds8futIEfAlwaV+TT4fHhvtyXQ0AUuKQodBomzG8+biXWDuf2G+HXZmw1dovZWJ/r7 sLEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R0VoQz6v; 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 f18-20020a056402005200b0049e37585a7bsi21887552edu.196.2023.02.15.05.07.16; Wed, 15 Feb 2023 05:07:40 -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=R0VoQz6v; 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 S230335AbjBONBU (ORCPT + 99 others); Wed, 15 Feb 2023 08:01:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233917AbjBONBS (ORCPT ); Wed, 15 Feb 2023 08:01:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61F7ACA3B for ; Wed, 15 Feb 2023 05:01:17 -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 dfw.source.kernel.org (Postfix) with ESMTPS id F1CF261B94 for ; Wed, 15 Feb 2023 13:01:16 +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-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757902494502172495?= X-GMAIL-MSGID: =?utf-8?q?1757902494502172495?= 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)); }