Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1697156rdb; Thu, 25 Jan 2024 03:35:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhOCVJ0k++tLC1+kojukUpCehnZvE3y9CPR+ojfuYKjPot+UHRc2LLGLMtQ/K+FiI/Xoy1 X-Received: by 2002:a17:902:e80b:b0:1d7:4e9a:b425 with SMTP id u11-20020a170902e80b00b001d74e9ab425mr1403298plg.57.1706182558233; Thu, 25 Jan 2024 03:35:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706182558; cv=pass; d=google.com; s=arc-20160816; b=R3fq4WrrGKKL/qSoMy8gk//nfrLzloRXSDm/NNZXrEX7fmBv0q1Q7FvklGBpt5+oOm MgEtWdXAdXGnn/xXLZoDQwdyEg2DK0byzyH3dilT6tr3LtAx7BhDWFKdWMDarptPwDjT MiOfxP7eJMoR/cshVl9cUM+7Ob85EhpHTYSJWQUMB2iPtF71c327wawoisIk+RGYt3ca MrM2aOhUCDOgR7447B07ZWS8RX3QBeGXnBBtIEqlDbHWhsmgFMDopWDfPK3v6Lf+Co2X VGV6DTLn8SsII0Jd+a2pkrtFGFtMECQ8uuQe571P7gDFjKi3EqQ/1WhLlY2PhHmaxg/y Q4Dg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38513-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 2-20020a170902ee4200b001d77c35750esi3452563plo.615.2024.01.25.03.35.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:35:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38513-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38513-linux.lists.archive=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 93A1128D914 for ; Thu, 25 Jan 2024 11:35:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 900364F8B4; Thu, 25 Jan 2024 11:33:02 +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 ; 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 ; 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: List-Subscribe: List-Unsubscribe: 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 To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , Kevin Loughlin , Tom Lendacky , Dionna Glaze , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy Lutomirski , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Justin Stitt , Brian Gerst , linux-arch@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" From: Ard Biesheuvel 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 --- 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 -- 2.43.0.429.g432eaa2c6b-goog