From patchwork Wed Feb 15 13:00:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13141623 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 CDF94C6379F for ; Wed, 15 Feb 2023 13:01:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29AFC6B0075; Wed, 15 Feb 2023 08:01:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2269C6B0078; Wed, 15 Feb 2023 08:01:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02A966B007B; Wed, 15 Feb 2023 08:01:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DCD3D6B0075 for ; Wed, 15 Feb 2023 08:01:26 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5FCDBC02EA for ; Wed, 15 Feb 2023 13:01:26 +0000 (UTC) X-FDA: 80469537372.25.4072EC1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 76BCE180008 for ; Wed, 15 Feb 2023 13:01:24 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=trjIqlwZ; spf=pass (imf16.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676466084; 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=TmXc5XX7mQ4tyyYhso+an7R7TS3SjE8ukS97BSt6G1c=; b=rX4k1DS5366sxHnXifrhtD+d4qtjL7oOL9zr3zDRfrdvrCP38Nb+afQmvkGYOJa18Iy9Zx wUf62MrOQlWig+8Vp/uMgWpAFXXIjfR6XXKCU0bXis75pVCpJHq56R1qrFlZ9RoVdEpdcv Ccl/OVeB0AG/EXgNDqEbdOhxY0LgU5o= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=trjIqlwZ; spf=pass (imf16.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676466084; a=rsa-sha256; cv=none; b=WaLWfkxmA1MVIqiB6lRTOm4s6Y+fX0GHM9mt0I1N+gg9Fw1jCJ2JS+7EC+K4xTzY6KZ9Jg cFfOy1Q/x4IorM7HjWsRfGvRAVe/Jmg9pKM7HgNmwnxvGvVsFGMX8Ttj2VWNqww3/GAoZ6 /UOKTifDzIN0gMkgNEse1Xj2eb4u94w= 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 6E9BE61BA6; Wed, 15 Feb 2023 13:01:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4813DC433EF; Wed, 15 Feb 2023 13:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676466083; bh=LCrzUXqbVxh67TyCMfdqY6tY7QeA2lgRgFNm/o1Clp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=trjIqlwZyO+lwC6wY2BwIi2/mShc9WUDm9YrsjZ24D2fsCN/XdBERQW+gmteC8VNN YK4uldLchrzIGLzJ3nz93yG0XY7arZ3i4YgZ2Lc9Mu9lA7KxV1k4dey5CH+NCH8XPe T12gdgRSJvbK/HMFSkuKhQgI07jjONQ6YMov3TAIPRXlQM0Xh0TamEqo1+hkqCwWit A/HGHQ8tTFEqzT5Y7HhQ4ZkU+ePlRphqBw0io5rRVIm9/ye4Ja+OE3AAvycLdCH3OP m22aM8Hqp22iEmk+ci6F6qJRnjS2DdmigNWX2mZU7KKQzMWrXtKyApa/5ozRNmPlry yABFYRztl4azg== 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 3/3] [v2] objtool: add UACCESS exceptions for __tsan_volatile_read/write Date: Wed, 15 Feb 2023 14:00:58 +0100 Message-Id: <20230215130058.3836177-4-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: rspam03 X-Stat-Signature: jtp9hga34gemxdkbb8sx9u93biaeqqk5 X-Rspamd-Queue-Id: 76BCE180008 X-HE-Tag: 1676466084-983281 X-HE-Meta: U2FsdGVkX19elBcsUePilIV91LtwzwvwXOT7ze33zicVWRuBVZ93D46EbeYLU5fWSsgU9rjypQR/HORRkcxcvhWUkeiUhdfW+siXOdu3t5UWa7EiRv4B15eQBozqAD+C67UNPCX2lEE39Y21Q8yd4krHxIzwgIcJsD5RpsNPvKjXnrK9UxWROKfLu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IPR7V6LBjS3NSGf9zId/SP/0RC9VVhX3TYqpLNAY/v0qAppgomdeMWi/tFX7MncUIMaaMHPJ3/Jqmt6d5tAgIUBCc7UHBzqz+TA3BhkdwPbtNpgDTMpCT/xQSubugWOvpF5OHHwvggGd5jSSzU99+Pm68CaZxnFLilHd+j5v1TAIPNrEq+zw== 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 A lot of the tsan helpers are already excempt from the UACCESS warnings, but some more functions were added that need the same thing: kernel/kcsan/core.o: warning: objtool: __tsan_volatile_read16+0x0: call to __tsan_unaligned_read16() with UACCESS enabled kernel/kcsan/core.o: warning: objtool: __tsan_volatile_write16+0x0: call to __tsan_unaligned_write16() with UACCESS enabled vmlinux.o: warning: objtool: __tsan_unaligned_volatile_read16+0x4: call to __tsan_unaligned_read16() with UACCESS enabled vmlinux.o: warning: objtool: __tsan_unaligned_volatile_write16+0x4: call to __tsan_unaligned_write16() with UACCESS enabled As Marco points out, these functions don't even call each other explicitly but instead gcc (but not clang) notices the functions being identical and turns one symbol into a direct branch to the other. Fixes: 75d75b7a4d54 ("kcsan: Support distinguishing volatile accesses") Acked-by: Marco Elver Signed-off-by: Arnd Bergmann --- tools/objtool/check.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index b0b467d9608a..da52ce861cc2 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1237,6 +1237,8 @@ static const char *uaccess_safe_builtin[] = { "__tsan_atomic64_compare_exchange_val", "__tsan_atomic_thread_fence", "__tsan_atomic_signal_fence", + "__tsan_unaligned_read16", + "__tsan_unaligned_write16", /* KCOV */ "write_comp_data", "check_kcov_mode",