From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96FD847887C; Tue, 5 May 2026 12:18:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777983509; cv=none; b=dSQGZ3Y6UhgaQpZl81V2Mvvd2Vw576XitqhCC1BWsqcmfPhjkPdMz9TvF0xKpoM7K6nQuNJVMrq4emrZbSLr646fxHZzLuSzXTR/Tmis4LFFLB/9RCiy9Pm8boPCSzcf4LBuVuO5hwg7nqylWXFzdBQjASjuNiDi5mg3fH6RNoI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777983509; c=relaxed/simple; bh=MKiZHpQYhzSaqobTOwaf24W+UVE4a06VWzhTprabQwg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qdANXbr/oElhg2mEthIWcReZSVM/ZRVNXQd5qEQKAVwkhARP5AgIbH2FI2aaV902OV+PcTPzTQ+xW5aLPo6ItlNZEZVBhZYre+J1TAhBDHGfdBp+vvBgmbUMs36MDT/+zHToBV/wT62TMrq89QVbQuPvgosCW4wtZKrkjv0Xqn4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=kyp1OubG; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="kyp1OubG" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6456vErd3189768; Tue, 5 May 2026 12:17:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=1rW6pODOLpmIW3dM1 Bj/JMJas2e2YSTbOVAnzl9U3D0=; b=kyp1OubGgmq8yPgzuacnELa/FzlQiqpAM F2RLXOVKW1jTgdZEihdLaJKSWQEETxLQVXki82oqVkcvfX6781cVVJUaBR1ZPBkj N0PmFT/SjM4t+iU5KF2K9k1Yl5JUG16ATAPZWZJaX3GpmOqxMPF9N2t8+Ki1ESqq gLZxhxICDnmkobCkkB6iwnVbkY/Qc0o9ohUmAt2a5KSyHP8wQMovYRJWpL91XnCU s00+4oPNYy2HR3R7vJDW5fV70BhGNVSEZbQ0vS43agrHvvBkPvg7z0gFFHKwZ+cZ Y/ztn777I3IDf4NV/P289BnH+3+/FNibj1qiVHbWvTenJ7yUt2k+w== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dw9xxk5dr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 May 2026 12:17:33 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 645C9cRI029301; Tue, 5 May 2026 12:17:33 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dwwtg9bmm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 May 2026 12:17:32 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 645CHT6t34079162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 May 2026 12:17:29 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EBAD2004B; Tue, 5 May 2026 12:17:29 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E92E2004F; Tue, 5 May 2026 12:17:29 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 5 May 2026 12:17:29 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, x86@kernel.org, Steven Rostedt , Josh Poimboeuf , Indu Bhagat , Peter Zijlstra , Dylan Hatch , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Mathieu Desnoyers , Kees Cook , Sam James Cc: Jens Remus , bpf@vger.kernel.org, linux-mm@kvack.org, Namhyung Kim , Andrii Nakryiko , "Jose E. Marchesi" , Beau Belgrave , Florian Weimer , "Carlos O'Donell" , Masami Hiramatsu , Jiri Olsa , Arnaldo Carvalho de Melo , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , "Steven Rostedt (Google)" Subject: [PATCH v14 19/19] unwind_user/sframe: Add prctl() interface for registering .sframe sections Date: Tue, 5 May 2026 14:17:18 +0200 Message-ID: <20260505121718.3572346-20-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260505121718.3572346-1-jremus@linux.ibm.com> References: <20260505121718.3572346-1-jremus@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA1MDExNCBTYWx0ZWRfXzbsTop3bX66g LFiQGRpKphTx+FUh9jEV6F2mi58EPDFgxFbUXetud3vbgciG1RsLfGwS/gX5l4YJnKpa/c5nGFT WRjicReZwI0HzjFm/H5IUZOb1FDYHTbHp3nYRBkbrNIRcpkJZOh/opCakmyrv2zYFO4PdsKjJFb xIetshmi2Vh8hav4xj0vOZYl5LwjqTgq3pIQ30rRFC+1kWJa3QMZYUBpGjGAgTDyQStije4jWqR bRQOugZgIlwd4QegBoUr4hvNJNniIN/GhGykR40eS2Qf97iE9Trf/1incLwqCbRJnRrynURh+LJ 9J953rqmcYJ4dG4TWsUApQtqnfCGv61Sh+QD9sJLmiRjrEtmC9fd6yopKZFYtHqgPwVuLFXBViP lhYzsBEhtmuL3bZX9SVHBUo/p4X3Pce7Vu5GUiJ5T1bfe4NCGflJ3aCqWqPEGiBOGcOrkNYX5pM dGoksnPkr6KLIKnBPTQ== X-Proofpoint-ORIG-GUID: wsKsPePIPbR1Pf5sSmwvRTZBUPpHqZJm X-Proofpoint-GUID: 1K7W285VYx8m3b0nv1DHxzyyYXFMAPBc X-Authority-Analysis: v=2.4 cv=ctWrVV4i c=1 sm=1 tr=0 ts=69f9dfde cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 a=meVymXHHAAAA:8 a=pGLkceISAAAA:8 a=VnNF1IyMAAAA:8 a=1RKwvADtGVyjO38rMG4A:9 a=2JgSa4NbpEOStq-L5dxp:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-05_02,2026-04-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 clxscore=1015 suspectscore=0 impostorscore=0 spamscore=0 malwarescore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605050114 From: Josh Poimboeuf The kernel doesn't have direct visibility to the ELF contents of shared libraries. Add some prctl() interfaces which allow glibc to tell the kernel where to find .sframe sections. [ This adds an interface for prctl() for testing loading of sframes for libraries. But this interface should really be a system call. This patch is for testing purposes only and should not be applied to mainline. ] Signed-off-by: Josh Poimboeuf Signed-off-by: Steven Rostedt (Google) Reviewed-by: Indu Bhagat Signed-off-by: Jens Remus --- Notes (jremus): Changes in v14: - Bump PR_ADD_SFRAME and PR_REMOVE_SFRAME. include/uapi/linux/prctl.h | 6 +++++- kernel/sys.c | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h index b6ec6f693719..0aa0ec971843 100644 --- a/include/uapi/linux/prctl.h +++ b/include/uapi/linux/prctl.h @@ -368,7 +368,7 @@ struct prctl_mm_map { * configuration. All bits may be locked via this call, including * undefined bits. */ -#define PR_LOCK_SHADOW_STACK_STATUS 76 +#define PR_LOCK_SHADOW_STACK_STATUS 76 /* * Controls the mode of timer_create() for CRIU restore operations. @@ -416,4 +416,8 @@ struct prctl_mm_map { # define PR_CFI_DISABLE _BITUL(1) # define PR_CFI_LOCK _BITUL(2) +/* SFRAME management */ +#define PR_ADD_SFRAME 82 +#define PR_REMOVE_SFRAME 83 + #endif /* _LINUX_PRCTL_H */ diff --git a/kernel/sys.c b/kernel/sys.c index 62e842055cc9..6e81e82bc991 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -65,6 +65,7 @@ #include #include #include +#include #include @@ -2906,6 +2907,13 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, break; if (arg3 & PR_CFI_LOCK && !(arg3 & PR_CFI_DISABLE)) error = arch_prctl_lock_branch_landing_pad_state(me); + case PR_ADD_SFRAME: + error = sframe_add_section(arg2, arg3, arg4, arg5); + break; + case PR_REMOVE_SFRAME: + if (arg3 || arg4 || arg5) + return -EINVAL; + error = sframe_remove_section(arg2); break; default: trace_task_prctl_unknown(option, arg2, arg3, arg4, arg5); -- 2.51.0