Message ID | 20240125112818.2016733-28-ardb+git@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-38513-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1574120dyi; Thu, 25 Jan 2024 03:36:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHl+IB9iX/WITKSlqJN3y+HPUhJrju6FJ+U8uqpwNzGSJDO/T2yMSu4hXGbtvQ9rcg0NYn5 X-Received: by 2002:a17:903:298d:b0:1d8:20ea:4284 with SMTP id lm13-20020a170903298d00b001d820ea4284mr1312740plb.29.1706182570414; Thu, 25 Jan 2024 03:36:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706182570; cv=pass; d=google.com; s=arc-20160816; b=TmKKI+4i2uJnsGcflTLNuFivT4fQCOU0eAqN+JClPevbXqPj1RdMzBNqHAEqvY6Vig IJD+WEZz/MarAxf2+W1CMqKkprkisDz38MrhHORa4V+kHsIszHk0QssoxL8vokz97rGr /nn0tCisBy05iHuwh/PPmv/JwpRrbVyk60mNJvfmzOaIgPN3mYJsPdvrZGX9E0cp+IeR c2RmtOh9SkwnhHNnNkwcbLLugKgXPSQ2RD0dPCPmuO26hDtUCg3w5hGF6oXaQPuGaswJ GNfmhOVPINKH7maoWLXcGFiMXsJVCxfi2ByD9QakeFLJCn7h6hocKIdbaMamNWgVBLhD nD+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=usiDcusxejCbluC36Vpk0on80rVNZ7Itzv8e5WwmSQI=; fh=Mjd69IxHltS/Jba8SYEPy4aDMrScq2KBDxG2XjETtWk=; b=CU+OF6c4kTSnUwiTVU7VU/Osi47sR5JU3Dc4+bwf44+NkRojPPQNjD4rsCrZfxoOpF TvpRusgXqAZg3W25j+BNFtJ/hNT48OwSwb0GiRR8zFuTX9Yv1JpujtQGhgnGtLSqNRzV oD4hjF29f883L3DVxnyVNv6ED+Z8xv+jT81khHr93MZBnUknmyna3le9dmr4Z9kjRdLJ BGc3+2q3/+r9Mb2ABAdaSFXIG6py5iNL/fhsmeEEcJcrKW9zhf2WVyD2PtFQ/j6zFaE0 p/z9bwbUWZbvNFTP7gk6h8C+ip1HTLJ5IQrvaPHGBu0trsCHqoUNCwwh10jMgQTtPN0/ qmSA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AfPFhgi+; arc=pass (i=1 spf=pass spfdomain=flex--ardb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-38513-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38513-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b1-20020a170903228100b001d767df9dd9si5432536plh.333.2024.01.25.03.36.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:36:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38513-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AfPFhgi+; arc=pass (i=1 spf=pass spfdomain=flex--ardb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-38513-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38513-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B96AB2868CF for <ouuuleilei@gmail.com>; Thu, 25 Jan 2024 11:35:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7799E5100D; Thu, 25 Jan 2024 11:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AfPFhgi+" Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 244AB2EAEA for <linux-kernel@vger.kernel.org>; Thu, 25 Jan 2024 11:32:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182381; cv=none; b=hqxnIAQRAyGImatAUte9FczgNgZkjC7As8zl1tk+nbFf+5rPH3pNwMyIsOWSgNVd+/z4ewzNWMkZ5xy9MmKkQaEfQD0eWZ8eyOhiXDI3kQVeW06mzbaQqQHnhGAvi5mQBsAoFulm6co/wpyGaXFeIUpipisn927Ci5ZhteKYWYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182381; c=relaxed/simple; bh=BHUup4Ao15H5a0x4s+HXfGoWgWU/14gkkZKIK0ZXAdk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=nUsx6l+sjizG0mDqEoNPZHxlAPrimOxm6tM/XbXjM8DkacAfIJpDkieiFy0wcoOvBQe7bc7M90QW6EUadz7Hw3U3TcTOw6KAcC29DlsPYPkkIl6lKkUp6hCRcLQIhIXsOO4OO4pJakYCDQ9EMASHWc1oNAS3HBICxmT72kAl8jg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=AfPFhgi+; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-40e86ddcee5so49352285e9.2 for <linux-kernel@vger.kernel.org>; Thu, 25 Jan 2024 03:32:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706182378; x=1706787178; darn=vger.kernel.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=usiDcusxejCbluC36Vpk0on80rVNZ7Itzv8e5WwmSQI=; b=AfPFhgi+OTBDvCG51iWK+mk9bdc3YtI0Wgk5Bt3uix0iQ1mGkhwwm4hyj3NwP7HTYl BUvwQJ3wYMcmEm5nc+eej38a1AFydvIiL5sN3Yd5gx4uIU0VmLCNDZuqxE6WyO7nEuMp BN0UkTiXViYzXfX+qOeIjMuugNnwWhjWnzvuZGcAtg7TPQ9xAt4o5lmwSM/U21dNoLty MTOAktO15RNlvph1D+xzZoLa2eTdd7wuu3SppPmbh8RbVOFlXBdecizDXPSxUCWZ8UJ5 RnPxnfoEBjl7gs8b6DZgYNwOitbxbAxw0Qe5kFEO41p4pu/UVZM8okzrdoC0gRfheUss 2vsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706182378; x=1706787178; 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=usiDcusxejCbluC36Vpk0on80rVNZ7Itzv8e5WwmSQI=; b=v0VPjNryIAPthgZs8vgrOAdQX+etIOTDGqSMvVBHxyQa0b8+KNvnFjdjOOGuTkiodw k3+V1oGeFgIR81trXFcbaAC2DcW6Ndtw5A/0ub4ajPC63nJvza//Ek/AEnSnql+0VScP 0u8sOt+0QoMs9EV9dddRuTKeYAjDPKjUXAPGndt9Z9uIDKmFWtolrjx3zTgSnDgX4Cvb D1RfLkvR+uAifvW7LDCh+fELUGH5eq2zTJBr1g20YjVBXqRWpnIyZOIB0aoUlpRUw2/i npjLHYGZkq2oDTPlWONMI0R20npXvxxEUUMSoS2/s6YsdkeQ3GmrWu7MOunMks7tqVI2 uH8Q== X-Gm-Message-State: AOJu0YwM8y6OToRrI2EMy9JGKuA6eizy3HvR7Xf2KOEOmKZzajlFEVxP /x17mkpPcYPqeHN67OLdNvaedVrXg9cCyKvuqj4CGcvPu3qjZtgEueK6a4+45+QMUZBvPCt8Wvi UJNvTBcoZ9N3qjHyXdJ/EuLGnNoszYYtyW8NlkmZzYYP+cQ5S2NoUqNM67rJVKJmOuMcRuMmiO6 JdOvRAfQIqU12TGJP+1OKdXnG613Fqmg== X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:600c:1e1c:b0:40e:d2b5:f9c8 with SMTP id ay28-20020a05600c1e1c00b0040ed2b5f9c8mr10496wmb.2.1706182377907; Thu, 25 Jan 2024 03:32:57 -0800 (PST) Date: Thu, 25 Jan 2024 12:28:28 +0100 In-Reply-To: <20240125112818.2016733-19-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240125112818.2016733-19-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1335; i=ardb@kernel.org; h=from:subject; bh=+Hn8XwOONyFACfVl0+TV+ToDQrCQwdquUdW+H4YgWKM=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIXWT68tdC0+Wx7q93Op2UuuemL2I66Gngl4O3H+7Ly35/ Kpcsku8o5SFQYyDQVZMkUVg9t93O09PlKp1niULM4eVCWQIAxenAExE+z4jwyFGw42c5z81zN/r MM1w9uVn5tMD5VhYn2RUh1t9nJx6ag4jw4GL548zXrGP75w8r+pPiuyaa+HcfdeX9M3nENW5KuM UxwMA X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240125112818.2016733-28-ardb+git@google.com> Subject: [PATCH v2 09/17] x86: Move return_thunk to __pitext section From: Ard Biesheuvel <ardb+git@google.com> To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel <ardb@kernel.org>, Kevin Loughlin <kevinloughlin@google.com>, Tom Lendacky <thomas.lendacky@amd.com>, Dionna Glaze <dionnaglaze@google.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Justin Stitt <justinstitt@google.com>, Brian Gerst <brgerst@gmail.com>, linux-arch@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789062094545271499 X-GMAIL-MSGID: 1789062094545271499 |
Series |
x86: Confine early 1:1 mapped startup code
|
|
Commit Message
Ard Biesheuvel
Jan. 25, 2024, 11:28 a.m. UTC
From: Ard Biesheuvel <ardb@kernel.org> The x86 return thunk will function correctly even when it is called via a different virtual mapping than the one it was linked at, so it can safely be moved to .pi.text. This allows other code in that section to call it. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> --- arch/x86/kernel/vmlinux.lds.S | 2 +- arch/x86/lib/retpoline.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index a349dbfc6d5a..77262e804250 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -134,7 +134,7 @@ SECTIONS SOFTIRQENTRY_TEXT #ifdef CONFIG_RETPOLINE *(.text..__x86.indirect_thunk) - *(.text..__x86.return_thunk) + *(.pi.text..__x86.return_thunk) #endif STATIC_CALL_TEXT diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S index 7b2589877d06..003b35445bbb 100644 --- a/arch/x86/lib/retpoline.S +++ b/arch/x86/lib/retpoline.S @@ -136,7 +136,7 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array) * relocations for same-section JMPs and that breaks the returns * detection logic in apply_returns() and in objtool. */ - .section .text..__x86.return_thunk + .section .pi.text..__x86.return_thunk, "ax" #ifdef CONFIG_CPU_SRSO