From patchwork Fri Jan 13 12:31:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 43227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp242879wrt; Fri, 13 Jan 2023 04:34:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXvZ0VtWWIjeWlI14FsDTi/PwOQI2bgH5h8Jgyk7OwXcXPEle27zwpRJV+NXUXPjDyZIXUut X-Received: by 2002:a05:6402:e83:b0:45c:a5f2:ffea with SMTP id h3-20020a0564020e8300b0045ca5f2ffeamr94103334eda.7.1673613278727; Fri, 13 Jan 2023 04:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673613278; cv=none; d=google.com; s=arc-20160816; b=TzHRuw/I7/kmUYkFf54BNSqRSAPM15e2/EUbNMzS31DEHN7GqWAf40a4B5P1QKbB2n 1K72BV9UGGhzYSsEsERNcN8nBqCtIewryuoXNrqiI31gW4i+TzsK25PO2a3THOwj15i5 oTKpgDrldjMQ5yQZyV3+W5o75T1HNuFyIyQS55yISzi7ciK7uNe2hQAIP7OK0TD/PKoy jZm8gS4qQ99suhT5pG/soSuRCw8wmLtM6N0nuM2YD9tipaIUK5yIj839ooOGDRgokInR 8Ggtmqy7byXthqmjnL21A1gMS/uc4HhSXWJrIEHvXKnLP5bTcvhCUG1lrgT11yRjkVbU 7phw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=EL3mPETbPdvFA800DQi92+7HmKGkuhOgYQBznH6oeWc=; b=KtkgkOYr48EkXeALO0zkKkmr7nRp2t7N+NdeE/EweEcm9kQIefZzyMKiRDimdq+g/I qc12HOiPF/cJSXmKGGI4F2bYLC+PXBHv8JBKBYNWcFFde0rD0hXNmh1dll7OokL5bUxF BMeA4cD6JUqcdQ4XFlKqOc2ZOGjOc4CsTdVOkHmKbDpSB6wk+pGXOuSBQN58w2Q4Z+sf O+OPm6mC0OFzYcig4N0dLzfIKNHOPDxGlLRfnSEvGbUjEeXiiTQKUriakyEuadWLD2bS ny8slP3aOnEq8K+iL62CGAnntk3J40jYKdQaZ3ZXcZHmeXLTcIWq97KDQh1dbPDhx4l3 4IjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=i8Pf0eL7; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=8+Q8mk1a; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a056402090a00b0047a1c5df487si23680037edz.266.2023.01.13.04.34.12; Fri, 13 Jan 2023 04:34:38 -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=@linutronix.de header.s=2020 header.b=i8Pf0eL7; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=8+Q8mk1a; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241536AbjAMMd1 (ORCPT + 99 others); Fri, 13 Jan 2023 07:33:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241016AbjAMMcJ (ORCPT ); Fri, 13 Jan 2023 07:32:09 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 555F0517D0; Fri, 13 Jan 2023 04:31:10 -0800 (PST) Date: Fri, 13 Jan 2023 12:31:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673613066; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EL3mPETbPdvFA800DQi92+7HmKGkuhOgYQBznH6oeWc=; b=i8Pf0eL7xUbYjvuLMZ4xceZpuATo3esqn8qPG9wTAA1sPhDIWngwY1QAB48E0ET4GLKFIA qKKdheJ/T9KW4q8w5SR4ZKb1vx5jDCmBu/0/KRrbxpTgDJN5Gf7vCPaQd3QU8Y82ECvyRx JNRnuCE3FNy4b3uMvmc9pCUeX5SYS1wo3Uyaa1oNqeBybMcfsCh00/bMtamgNH9YYoCV4I Q3G6Gzb6xFr6VNemzFSxWxC3cGeTqck02FgAC/tW4oOO6+bCG9REHZQK3u83xbKrB2i1WP HvuiGv+L2oDY+LGO0NhCkz7V4C2/8pT07sbnWAgIz8JEn3bZg+guRzino8jLvA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673613066; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EL3mPETbPdvFA800DQi92+7HmKGkuhOgYQBznH6oeWc=; b=8+Q8mk1aLu0aw/LeDJn5DgeyF4xmlNXMs+GoZGqFqlUfpE7vpJKP2j7ROtRtOm1P7Mmto+ jUymaHlJDji9aWCw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] ubsan: Fix objtool UACCESS warns Cc: "Peter Zijlstra (Intel)" , Ingo Molnar , Tony Lindgren , Ulf Hansson , "Rafael J. Wysocki" , Frederic Weisbecker , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230112195541.906007455@infradead.org> References: <20230112195541.906007455@infradead.org> MIME-Version: 1.0 Message-ID: <167361306657.4906.17949853863028198570.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754848600588093416?= X-GMAIL-MSGID: =?utf-8?q?1754910717106704794?= The following commit has been merged into the sched/core branch of tip: Commit-ID: f18b0d7ee815abb33eb1cc540fdde64fbb922d1a Gitweb: https://git.kernel.org/tip/f18b0d7ee815abb33eb1cc540fdde64fbb922d1a Author: Peter Zijlstra AuthorDate: Thu, 12 Jan 2023 20:43:56 +01:00 Committer: Ingo Molnar CommitterDate: Fri, 13 Jan 2023 11:48:17 +01:00 ubsan: Fix objtool UACCESS warns clang-14 allyesconfig gives: vmlinux.o: warning: objtool: emulator_cmpxchg_emulated+0x705: call to __ubsan_handle_load_invalid_value() with UACCESS enabled vmlinux.o: warning: objtool: paging64_update_accessed_dirty_bits+0x39e: call to __ubsan_handle_load_invalid_value() with UACCESS enabled vmlinux.o: warning: objtool: paging32_update_accessed_dirty_bits+0x390: call to __ubsan_handle_load_invalid_value() with UACCESS enabled vmlinux.o: warning: objtool: ept_update_accessed_dirty_bits+0x43f: call to __ubsan_handle_load_invalid_value() with UACCESS enabled Add the required eflags save/restore and whitelist the thing. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Tested-by: Tony Lindgren Tested-by: Ulf Hansson Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Link: https://lore.kernel.org/r/20230112195541.906007455@infradead.org --- lib/ubsan.c | 5 ++++- tools/objtool/check.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ubsan.c b/lib/ubsan.c index 60c7099..4d39e0b 100644 --- a/lib/ubsan.c +++ b/lib/ubsan.c @@ -339,9 +339,10 @@ void __ubsan_handle_load_invalid_value(void *_data, void *val) { struct invalid_value_data *data = _data; char val_str[VALUE_LENGTH]; + unsigned long ua_flags = user_access_save(); if (suppress_report(&data->location)) - return; + goto out; ubsan_prologue(&data->location, "invalid-load"); @@ -351,6 +352,8 @@ void __ubsan_handle_load_invalid_value(void *_data, void *val) val_str, data->type->type_name); ubsan_epilogue(); +out: + user_access_restore(ua_flags); } EXPORT_SYMBOL(__ubsan_handle_load_invalid_value); diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 64954aa..9767bab 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1216,6 +1216,7 @@ static const char *uaccess_safe_builtin[] = { "__ubsan_handle_type_mismatch", "__ubsan_handle_type_mismatch_v1", "__ubsan_handle_shift_out_of_bounds", + "__ubsan_handle_load_invalid_value", /* misc */ "csum_partial_copy_generic", "copy_mc_fragile",