From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.196.30 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795991580; b=ZFAhRB9t0ZA3tyCUnDePdW5Qjaz3P9x4V9Ms8LqVcyuCw4XY0eTN4iQqR7FA533go5Id sYiLYK0cTxNmpICpnTg+aKgjewu302gNC0G/Id4J63+t7w5E8uZzJXypT4Y3PPfMLLkwQ JvrmDyUoQ3mGEYnjng2pm4kV04LIyTKTyga74YaFVofqQcd3IuMWvqyGpszV1v+jp33Ux D3JNXKfUHDxBmIPdbZbe5F01/QkO0xvkhDACeqFMr8N30ZPY1cnBaJ/9W2JiA+Q+5OtTB Z2IJt/Y7+5uZjoZfPe3955GseQw+e2nwhQKbdf/aIDCJnkAnsaqPPvH6eM0HGZpyekA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795991580; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=uASOKb+db5byyRZc2bYZ6kt4H35DXUy3mjISw1oaVaE=; b=gsmTrI35g9ueut0ODe+V+KvVkhVBP1hMRqoPsQJvQxKGHpX5kzwUeHRRdAQc8quZdKaC Xbz5SdS8DUKN19S1uRFsMLl7oGiJ9CUTmBQuE69CKkyu51aIP6yhuWUWXbq4IYRAJ9iPz pMX3K9bCGL285HvKY2iiEEhUTioLnSWwvlULlOrSQbarBJQZQFAkPGTwMvhIO+Tq2rKR5 T8TE/XxL06P3ooXjoCvHfjob50+0UdC6GVFXtIM7izNLP5548BSkmU8IDHGAeLt2Vq6cf E+JtaBOkQFuQ2gcXAEnQMsV2lZ0bNduXq1wFoSHElWDXPuun7ItQQT7/hAgVCHdU36g== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=EzwRJU8B; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.196.30 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013030.outbound.protection.outlook.com [40.93.196.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B6B1606A31C for ; Sun, 29 Nov 2026 22:32:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6B6B1606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=EzwRJU8B ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yWa9IFYEeThmTtigVzUQ1MAEPB20aZ+93ghBDUqB0UjdciHMjR2PR9VtXvfrXnWUaBdrBwgRe4JinY5HsHxsSDH4+w9+2xuVRQ9Z/R7K9nivq9lcAw1Hm5+6VXLqQB7HbWSv7/7RBI+Osy4PIzLARCYYvMVGemWeUrtoklWAXukuWi70auxY8fh7UelQNmokndKGrDwHLNfDIaUCy2X8b1A2cw2LEIqubnqQM8f+3kfqwc3dUqNdSa4rqoSrVMXv5pp1Yjp8hZqnnTviDuOTTzeAMpWyt6hYANKyZ/ED+ptaa1Wf9kZqRKnqv/SCRSC2n/U81PxhzQj8QJFLZ8XDjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uASOKb+db5byyRZc2bYZ6kt4H35DXUy3mjISw1oaVaE=; b=Oib7Z+Wnvhq9kp13giMdNjMRpAUeScaebBCK4Z9PVYtA35cKL+PbNGLfQNnrw05dujxAp8sDJp75+Uo1hMRF7gZWwuV/KBqMqpi/a1608uKSnJwTLSn9vd5w1Kj++qQaApe9aWqxaDPvltKV3CgDS5DUbeYkejldbSkpnsGso6JDjbchTa+aeeCMdD7N58cGCjNlif6W+PkIk87lJrJnuDZFhG7yYVGVycUd9fzk5314LQ3pdErJQ1TBF33WViDTQeB/x45ltLND2iW9zWPPxVbQevgWE/zUuLJYDocnouY3kNaO3sumgdkz4x5b3+BNyfqFKiwAjRcN4AxdsT357A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uASOKb+db5byyRZc2bYZ6kt4H35DXUy3mjISw1oaVaE=; b=EzwRJU8BpgHmIEr29mlJ5eXtXzXHDnlXa8CxovWGWSqPS1kYtJ9owIaczqDNmMuOrtNCPKr29Q2lWxWnMe02IYTETDX10BcI2SAdTDRuP3r2ka9jbBU3PLPZ0KBTF92JsZVzXChZiuqUCh7YG8yIcLlF50BhkBNHDq6QlLCAhfY= Received: from CH0PR03CA0246.namprd03.prod.outlook.com (2603:10b6:610:e5::11) by DM6PR12MB4418.namprd12.prod.outlook.com (2603:10b6:5:28e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Sun, 29 Nov 2026 22:32:52 +0000 Received: from CH7PEPF0000001A.namprd21.prod.outlook.com (2603:10b6:610:e5:cafe::5c) by CH0PR03CA0246.outlook.office365.com (2603:10b6:610:e5::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.12 via Frontend Transport; Sun, 29 Nov 2026 22:32:52 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CH7PEPF0000001A.mail.protection.outlook.com (10.167.244.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.0 via Frontend Transport; Sun, 29 Nov 2026 22:32:52 +0000 Received: from BLRKPRNAYAK.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Sun, 29 Nov 2026 16:32:47 -0600 From: K Prateek Nayak To: Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , the arch/x86 maintainers , CC: Andy Lutomirski , Peter Zijlstra , Rick Edgecombe , Andrew Cooper , Kees Cook , Pawan Gupta , K Prateek Nayak Subject: [RFC PATCH 09/27] x86/ftrace: Prepare ftrace trampolines to handle shadow stack Date: Sun, 29 Nov 2026 22:29:34 +0000 Message-ID: <20261129222953.9124-10-kprateek.nayak@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261129222953.9124-1-kprateek.nayak@amd.com> References: <20261129222953.9124-1-kprateek.nayak@amd.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH7PEPF0000001A:EE_|DM6PR12MB4418:EE_ X-MS-Office365-Filtering-Correlation-Id: e491fd46-2f9c-42e1-9044-08df4e68b490 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700016|1800799024|23010399003|82310400026|10067099003|56012099006|11063799006|261022105027099003|261021123027099003|261021121427099003|261009223027099003|261102123227099003|261026121527099003|261026140227099003|261028144727099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: ZuiJPBzi3NUGK+eeGN0e7tVBDToX2D6jmYJPoS5K46QRCb8BXAxcoJsVbkmRqMj20ERYoyKOSZmzZ7Uvryi8WO2osv8JVl7hYaeqJNrcHjmjGe3rp1A2jFc4DhUYzjHLq4/ArullfkKo6KDK1muk/H33RcvbydemF4TWf7XZ9Rws7UvSt63G0zN3hMrVViOOJj4S1sXQxP41+aUpUuvPJOM4qhEEwQug1Hyz0er4m3Fe83hcdiDoMhW8CGWr49Pt0mWIL9Gp6bt5E46/6tMfvVITPILcy3H2IozBTX9Q2v+yAU/WZfqmy9CKSHTgiwmuw7uIGP/aA02EX1+t2guWfkdVQHWuNZWhVSTkQF6TKYN5RXlQ3DxHNVttDdc+U+aaDn6VWkK8MZ8U79Efc1YV8CbHMYTGadsOt4svCCmrvL5KLGoj9EG/LTBZCAGMMNinVd26UXS9WwPOH3BW/X5L3Wx5yRP4UawrSvWFKHQ4GzRsBxVr8+EVR7J/UDYtGU/gwEIWQjWGrPebAWwPRQH/61ObLn3Ha7QVjZBkh1M8GZSIgpwNgJUjedy1QJl39bP1kndUSJIHfNZ9CjvYxxZZWvq3J91d+rjgdmnho8l0P0BOdUYz+Ml+hwe7K7UJUE3nmDtdykboFe+K3tAIRwNUX6pW9OwmiNPy8wZt4g/AIxhmg/yV1MINfBRbZu1TuuS6Wx/mAWca5kVnXx70fETBdg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(36860700016)(1800799024)(23010399003)(82310400026)(10067099003)(56012099006)(11063799006)(261022105027099003)(261021123027099003)(261021121427099003)(261009223027099003)(261102123227099003)(261026121527099003)(261026140227099003)(261028144727099003)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kiZVpRrT5cQwvlF2LAluntQmrHCH48t7FkxMLFM5pq9kGxurBls0x1ADzqtWAgyL94xhuUaLlfHUHzrHqaYJ1ZKrsUzsMWG2IyKbFx5J77RTe4V4LyGA/f6A71g94RjDFZJq4iTB4S+J7I9rNXiWqXmiK2/pUVQh05N5bSd+MqAo+mMwnY5oiszx8yFJElxrb8YRKYzWI1ARpWAe7EwSSpbwXLsv6mo15+Qs2SR1ozVZH1njROElXUZSsUE7ThPFwurRIpjjC+GtNJR3Vxmc+jgCMlHWdn05Rdf38Vq/1unMo0lBY6Vty3oOfs2VTvMUeU8Z34HB1jsJfVveuXqcEcjvS65zwOGTbiJ2tVXeO8WTZxVm3LAeHZTsQkmBnzhQLtWhXABnpbGrCDvAJpSr+z+9cFjbUofhhU1fe+tYQ5WxER5gXJLqvswcFLWZN3jj X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2026 22:32:52.2276 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e491fd46-2f9c-42e1-9044-08df4e68b490 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH7PEPF0000001A.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4418 Kprobes can hook onto function entry via optprobes, int3 kprobes, or via ftrace_regs_caller and hijack the return. From a shadow stack perspective, the ftrace_caller's stack looks like: caller call traced_function call ftrace_regs_caller Rethooks and return_to_handler can hijack the return address from traced_function; IPMODIFY and direct caller ftrace handlers can steer the return from traced function. To be aware of the shadow stack context that needs correction, the CET helpers need to know the context from where pt_regs came from. Similar to the FRED frame handling, push the SSP at ftrace_regs_caller and a context metadata flag onto the stack that can be inspected from the handler. Based on the event type, the CET helpers can be made aware if the slot that needs modifying is at SSP, or just below. return_to_handler() now does the INTRA_FUNCTION_CALL early which allows using the stack slot pushed for the pt_regs container. !X86_KERN_SHADOW_STACK build will now do an extra pop. Note: The return_to_handler now sets regs->cs to 0 to prevent false positives of !user_mode_regs() in CET helpers. Since a full pt_regs is not present, it also blocks the ftrace helper from returning the incomplete pt_regs pointer. Signed-off-by: K Prateek Nayak --- arch/x86/kernel/cet.c | 4 +- arch/x86/kernel/ftrace_64.S | 121 +++++++++++++++++++++++++++++++----- 2 files changed, 108 insertions(+), 17 deletions(-) diff --git a/arch/x86/kernel/cet.c b/arch/x86/kernel/cet.c index bab8ff1c64c5..66c9ce531249 100644 --- a/arch/x86/kernel/cet.c +++ b/arch/x86/kernel/cet.c @@ -119,7 +119,9 @@ enum fred_exit_work { }; enum frame_context { - FRED_ENTRY = 1 + FRED_ENTRY = 1, + FTRACE_CALLER, + RETURN_TRAMPOLINE }; /* diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S index 62c1c93aa1c6..a6211070d6e5 100644 --- a/arch/x86/kernel/ftrace_64.S +++ b/arch/x86/kernel/ftrace_64.S @@ -131,6 +131,62 @@ .endm +#ifdef CONFIG_X86_KERN_SHADOW_STACK + +/* + * The ftrace handler might use regs_set_return_ip() to steer the return + * from ftrace_caller which also tries to do shadow stack handling + * assuming pt_regs is part of the standared FRED entry frame. + * + * Avoid any shadow stack manipulations by setting the two slots above + * pt_regs to zeros. regs_set_return_ip() et al. will see shadow stack + * pointer to be NULL and skip any shadow stack handling. + * + * Ftrace caller will correct the shadow stack if the handler has + * hijacked any of the return or has decided to do a tail call. + */ +.macro FTRACE_PUSH_SHSTK_FRAME + xor %eax, %eax + rdsspq %rax + pushq %rax + pushq $0x200 + .endm + +.macro FTRACE_POP_SHSTK_FRAME + addq $16, %rsp + .endm + +.macro FTRACE_FIX_DIRECT_CALL_SHSTK + xor %ecx, %ecx + rdsspq %rcx + testq %rcx, %rcx + jz .Lshstk_done\@ + wrssq %rax, (%rcx) +.Lshstk_done\@: + .endm + +.macro FTRACE_PUSH_RETURN_HANDLER_SHSTK_FRAME + xor %eax, %eax + rdsspq %rax + movq %rax, (%rsp) /* Pushed by intra function call. */ + pushq $0x300 + .endm + +#else /* !CONFIG_X86_KERN_SHADOW_STACK */ + +.macro FTRACE_PUSH_SHSTK_FRAME + .endm +.macro FTRACE_POP_SHSTK_FRAME + .endm +.macro FTRACE_FIX_DIRECT_CALL_SHSTK + .endm + +.macro FTRACE_PUSH_RETURN_HANDLER_SHSTK_FRAME + addq $8, %rsp + .endm + +#endif /* CONFIG_X86_KERN_SHADOW_STACK */ + SYM_TYPED_FUNC_START(ftrace_stub) CALL_DEPTH_ACCOUNT RET @@ -177,10 +233,18 @@ SYM_INNER_LABEL(ftrace_caller_op_ptr, SYM_L_GLOBAL) /* Account for the function call below */ CALL_DEPTH_ACCOUNT + /* + * Push a blank frame above pt_regs as to not confuse + * the shadow stack handlers. + */ + FTRACE_PUSH_SHSTK_FRAME + SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL) ANNOTATE_NOENDBR call ftrace_stub + FTRACE_POP_SHSTK_FRAME + /* Handlers can change the RIP */ movq RIP(%rsp), %rax movq %rax, MCOUNT_REG_SIZE(%rsp) @@ -242,10 +306,15 @@ SYM_INNER_LABEL(ftrace_regs_caller_op_ptr, SYM_L_GLOBAL) /* Account for the function call below */ CALL_DEPTH_ACCOUNT + /* See comment in ftrace_caller above. */ + FTRACE_PUSH_SHSTK_FRAME + SYM_INNER_LABEL(ftrace_regs_call, SYM_L_GLOBAL) ANNOTATE_NOENDBR call ftrace_stub + FTRACE_POP_SHSTK_FRAME + /* Copy flags back to SS, to restore them */ movq EFLAGS(%rsp), %rax movq %rax, MCOUNT_REG_SIZE(%rsp) @@ -290,6 +359,9 @@ SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL) jz 2f andq $0xfffffffffffffffe, %rax movq %rax, MCOUNT_REG_SIZE+8(%rsp) + + FTRACE_FIX_DIRECT_CALL_SHSTK + restore_mcount_regs /* Restore flags */ popfq @@ -300,21 +372,26 @@ SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL) movq %rdi, MCOUNT_REG_SIZE-8(%rsp) movq %rax, MCOUNT_REG_SIZE(%rsp) - restore_mcount_regs 8 - /* Restore flags */ - popfq - UNWIND_HINT_FUNC - /* - * The above left an extra return value on the stack; effectively - * doing a tail-call without using a register. This PUSH;RET - * pattern unbalances the RSB, inject a pointless CALL to rebalance. + * Restore below will leve an extra return value on the stack; + * effectively doing a tail-call without using a register. + * This PUSH;RET pattern unbalances the RSB, inject a pointless + * CALL to rebalance. */ ANNOTATE_INTRA_FUNCTION_CALL CALL .Ldo_rebalance int3 .Ldo_rebalance: add $8, %rsp + + /* Populate the return into the frame from above. */ + FTRACE_FIX_DIRECT_CALL_SHSTK + + restore_mcount_regs 8 + /* Restore flags */ + popfq + UNWIND_HINT_FUNC + ALTERNATIVE __stringify(RET), \ __stringify(ANNOTATE_UNRET_SAFE; ret; int3), \ X86_FEATURE_CALL_DEPTH @@ -378,26 +455,38 @@ SYM_CODE_START(return_to_handler) movq %rdx, RDX(%rsp) movq %rbp, RBP(%rsp) movq %rdi, RSP(%rsp) + movq $0, CS(%rsp) movq %rsp, %rdi + /* + * Final RET will jump back to the old return address. Since, the return + * frame was hijacked, use a retpoline here to keep the RSB balanced. + * + * For shadow stack, this adds the frame to stuff the return address into. + */ + ANNOTATE_INTRA_FUNCTION_CALL + call .Ldo_rop + int3 +.Ldo_rop: + FTRACE_PUSH_RETURN_HANDLER_SHSTK_FRAME + call ftrace_return_to_handler + FTRACE_POP_SHSTK_FRAME + movq %rax, %rdi movq RDX(%rsp), %rdx movq RAX(%rsp), %rax - addq $(FRAME_SIZE) + 8, %rsp + addq $(FRAME_SIZE), %rsp /* - * Jump back to the old return address. This cannot be JMP_NOSPEC rdi - * since IBT would demand that contain ENDBR, which simply isn't so for - * return addresses. Use a retpoline here to keep the RSB balanced. + * This cannot be JMP_NOSPEC rdi since IBT would demand that contain ENDBR, + * which simply isn't so for return addresses. This is the second part of + * the repoline sequence; CALL has already been balanced above. */ - ANNOTATE_INTRA_FUNCTION_CALL - call .Ldo_rop - int3 -.Ldo_rop: mov %rdi, (%rsp) + ALTERNATIVE __stringify(RET), \ __stringify(ANNOTATE_UNRET_SAFE; ret; int3), \ X86_FEATURE_CALL_DEPTH -- 2.43.0