Message ID | 20240712-asi-rfc-24-v1-4-144b319a40d8@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 146D5C3DA45 for <linux-mm@archiver.kernel.org>; Fri, 12 Jul 2024 17:01:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 717CD6B0096; Fri, 12 Jul 2024 13:01:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C5FF6B0098; Fri, 12 Jul 2024 13:01:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36AE66B0099; Fri, 12 Jul 2024 13:01:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1ACA76B0096 for <linux-mm@kvack.org>; Fri, 12 Jul 2024 13:01:06 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C2A041C1C71 for <linux-mm@kvack.org>; Fri, 12 Jul 2024 17:01:05 +0000 (UTC) X-FDA: 82331715690.01.994B108 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf03.hostedemail.com (Postfix) with ESMTP id CFA4220021 for <linux-mm@kvack.org>; Fri, 12 Jul 2024 17:01:03 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=IjgJLBE2; spf=pass (imf03.hostedemail.com: domain of 3TmGRZggKCJE4vx57v8w19916z.x97638FI-775Gvx5.9C1@flex--jackmanb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3TmGRZggKCJE4vx57v8w19916z.x97638FI-775Gvx5.9C1@flex--jackmanb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720803646; a=rsa-sha256; cv=none; b=jQjKGFRf8R8mHAAaGEd5NyDa+Li/KGkuLTsQ+vlExOGFwy5n/+SL8BWYE1ucYPqsj1Wpfb x4FEkPGB8IW+36iy551lqiUNqF3Pt3/nST1DLNarpW02dccUBjyB9JNuBhWTjqTXXpAnzT 33rGfOezuTVkyCK9LnWy4wLi0M1sxgQ= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=IjgJLBE2; spf=pass (imf03.hostedemail.com: domain of 3TmGRZggKCJE4vx57v8w19916z.x97638FI-775Gvx5.9C1@flex--jackmanb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3TmGRZggKCJE4vx57v8w19916z.x97638FI-775Gvx5.9C1@flex--jackmanb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720803646; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uRdo734SZY7LgE59iZWS/AzLUQw9XRryPytUBqM/u/Y=; b=LbZYbpafe2opLtWobDJXTjFzp3wzv7QgUDs90aojPnAQatrg0jephhkLyFGMyKrjrMk0s2 h00FkFrY39EfFogcfSB50ZTdN9IygR+SSwbETH7OrpWlmYhfRjyBwphTx+5Cv5/ZiyCLD4 6S+Iz7Q/iIgR/SFKVRct2RVelKH21uI= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e02b5792baaso4161794276.2 for <linux-mm@kvack.org>; Fri, 12 Jul 2024 10:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720803663; x=1721408463; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=uRdo734SZY7LgE59iZWS/AzLUQw9XRryPytUBqM/u/Y=; b=IjgJLBE2IE0/N8ZFIAilAMJC5dbT/EzGcHVy2o62rdU4YIkmfEJJtG6YwyIFZRg5rF vgSiYcZrM7l2PzzE5QrGPzyhKy/Uq+1pUl2xPoLiSgumykHRaGx1qrAoQgDyfZ2GRuoG rt9fW5iLpVjTft/zcW3ddgJH7hV8o3/2ogWZwXJOCBL7P/xHQw6RNHDOHlsBs+pTL8M3 PAM79dAZTKmuCGRDIXPYm8hGT0ghcAJ49j0tXmcLGvqCpdAR0FIFtEt/YtvxLU4DOKx1 IsQcxz9ylUPGMDxNeHeh1/vAlfEsN8Jr468XE6jKLlafdNmWq66hkIf7/Whh6BrW7gb6 oEkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720803663; x=1721408463; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uRdo734SZY7LgE59iZWS/AzLUQw9XRryPytUBqM/u/Y=; b=mmr2aqEEw4bv/1yng+9Tb+7Mi4VOHdQnwGU0bQJ4Gs/nkh27SGhjtDLztBlFFJB0b8 9605meF3qXAonyVqtmKRQ1yBtGQ6bhSl8uPxS3G0+VIWVSI/e1tiW8AJwTBDzKpZUdy2 FbTqfpI538+lYZMKqP8qenJ3ukokLILms/57FmLTOB5+SBE7gPV7w1+XE4Jt0It2whFS Y1PI03RiU8+UNjF5otwhDES8rilezpiIgCh4facLLnUUaEtaoDYdUh78jFat3r8Cvhjx UmW8ASEwG8TFWkWDmQdHz/Nm3MIgcDkqX3hj5pCT/OihH8zDtuVxihg//CzYyGhcXaP5 an0g== X-Forwarded-Encrypted: i=1; AJvYcCWa2t+lE5FApaKVhuktB7Yw/1SmXx6y6LehLp/b9kIKZvXwd8wZ/ExuZEKvvcjHw8UJ3wOgde+r8qpvsyOqkxX1dag= X-Gm-Message-State: AOJu0Yxvh71vC1PdtWVIS+nCZ5rl5uBDBiSRLpzdoWK2dDhTAxpPWYeY G3RUfxj9WntED/aAq4VN0cmw/gT9hXnmyJQAtyW0ObKA8WCZH/DNAgGLgzthJJUwHsLDhfMmpw0 XSJa122w4IA== X-Google-Smtp-Source: AGHT+IFYA55X1keLcQMRBGeCAFNmP+QStD5pTx8+8q+l5zrMjeIlti4CTq5gIWF/C14pV/xqXPndYQF6ybLHYg== X-Received: from beeg.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:11db]) (user=jackmanb job=sendgmr) by 2002:a05:6902:1b12:b0:e03:b3e8:f9a1 with SMTP id 3f1490d57ef6-e041b02fabamr791937276.2.1720803662807; Fri, 12 Jul 2024 10:01:02 -0700 (PDT) Date: Fri, 12 Jul 2024 17:00:22 +0000 In-Reply-To: <20240712-asi-rfc-24-v1-0-144b319a40d8@google.com> Mime-Version: 1.0 References: <20240712-asi-rfc-24-v1-0-144b319a40d8@google.com> X-Mailer: b4 0.14-dev Message-ID: <20240712-asi-rfc-24-v1-4-144b319a40d8@google.com> Subject: [PATCH 04/26] objtool: let some noinstr functions make indirect calls From: Brendan Jackman <jackmanb@google.com> To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com>, Andy Lutomirski <luto@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>, Alexandre Chartre <alexandre.chartre@oracle.com>, Liran Alon <liran.alon@oracle.com>, Jan Setje-Eilers <jan.setjeeilers@oracle.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Andrew Morton <akpm@linux-foundation.org>, Mel Gorman <mgorman@suse.de>, Lorenzo Stoakes <lstoakes@gmail.com>, David Hildenbrand <david@redhat.com>, Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@kernel.org>, Khalid Aziz <khalid.aziz@oracle.com>, Juri Lelli <juri.lelli@redhat.com>, Vincent Guittot <vincent.guittot@linaro.org>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Steven Rostedt <rostedt@goodmis.org>, Valentin Schneider <vschneid@redhat.com>, Paul Turner <pjt@google.com>, Reiji Watanabe <reijiw@google.com>, Junaid Shahid <junaids@google.com>, Ofir Weisse <oweisse@google.com>, Yosry Ahmed <yosryahmed@google.com>, Patrick Bellasi <derkling@google.com>, KP Singh <kpsingh@google.com>, Alexandra Sandulescu <aesa@google.com>, Matteo Rizzo <matteorizzo@google.com>, Jann Horn <jannh@google.com> Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, Brendan Jackman <jackmanb@google.com> Content-Type: text/plain; charset="utf-8" X-Stat-Signature: or9hbrr9rchs5q96igdh1hek735owp6b X-Rspamd-Queue-Id: CFA4220021 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1720803663-153609 X-HE-Meta: U2FsdGVkX1+sw67fO/W7cMF6ZcLeYdlYss8NYf2Sn8oi7gjBkr2l+pONq1A3l0qos/OipUAs1ufxnZNnqvCVxEeFfW6UL4ynrpjKMzIXtGvugiGcy46qxNeky7j/LBD0D+MLCQalqr4HaanK0PGscXu7H0bPlOQMsQ3t2VMF1k0rsJootHa/MEYV1tqpfSGPXWb4RFHR++WoYVmY6CfHDO5WTP9f1T9ax2EQTxA33zbgK5R2d941vQf86aj1XHotziIDWt3GTkLbOAhME3JHNKBrip420AdLTG6wuCh2RCHH9ymXa4KL5RXOCEcs3vVuOI5pr/KrTSE+G+7JoZm4puQ8XI0i+FPGX+pJBio8mdj0KVRYRZMPvIQj7bUI5kmj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GMV1UtR3sUGnCM2X1X2TuXo5jAvZXsXajh7pbFQvt89wENjuzzw09uSdwOEVT96Fpo+P/BOzr1t6n6qPE 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Address Space Isolation (ASI) 2024
|
expand
|
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 0a33d9195b7a9..a760a858d8aa3 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3425,6 +3425,17 @@ static bool pv_call_dest(struct objtool_file *file, struct instruction *insn) return file->pv_ops[idx].clean; } +static inline bool allow_noinstr_indirect_call(struct symbol *func) +{ + /* + * These functions are noinstr but make indirect calls. The programmer + * solemnly promises that the target functions are noinstr too, but they + * might be in modules so we can't prove it here. + */ + return (!strcmp(func->name, "asi_exit") || + !strcmp(func->name, "__asi_enter")); +} + static inline bool noinstr_call_dest(struct objtool_file *file, struct instruction *insn, struct symbol *func) @@ -3437,6 +3448,9 @@ static inline bool noinstr_call_dest(struct objtool_file *file, if (file->pv_ops) return pv_call_dest(file, insn); + if (allow_noinstr_indirect_call(insn->sym)) + return true; + return false; }
As described in the comment, some noinstr functions really need to make indirect calls. Those functions could be rewritten to use static calls, but that just shifts the "assume it's instrumented" to "assume the indirect call is fine" which seems like just moving the problem around. Instead here's a way to selectively mark functions that are known to be in the danger zone, and we'll just have to be careful with them. Signed-off-by: Brendan Jackman <jackmanb@google.com> --- tools/objtool/check.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)