From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 24B563F1AC4; Wed, 20 May 2026 15:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779291655; cv=none; b=hIUQpJlWKpX4TMQzf7L+nKtx/uWrj2iIvLOoGWBZ1Z1wLEjmLx9j92LvJuellMlGm318paZZfy7Cj+KWj2XVxmcMGFYbId1TKlC4IXTdypZq2IsDaf9TVZeGb1w5ircYtqYQLCUqYq5pT830agKxvwHgBQJ8rdYoFbxpHqOKC1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779291655; c=relaxed/simple; bh=pOTifWMyDUr3KztHc7ELPe1Ms++E6svSTXBfgYLa2PY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D2vh9bjyKmfjitVnzOg/UiW+e2EHJz2H9zoyLZRokr2e2jfeGWhhwZVVY8AFl4/Cjl4HT4bkyCHR4lqL4aK+DhiJYS0obu2d/s6oUDtzeo99xTAJl5sr6PLgEKAKO0ELe0X1dLWDZa0LwHmQHNO8TdBJ8W5ka1FCflfOpSYpSHA= 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=LhUi0Ppl; arc=none smtp.client-ip=148.163.156.1 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="LhUi0Ppl" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64KDW9HL3919898; Wed, 20 May 2026 15:40:25 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=WbHj9iJ7NuBWvii1A /p//5DBJ1F6JGPeRMLlnMLO6Uc=; b=LhUi0PplsX+LI7hAaEG6j36I0dcncbk1T X3MYPZZPYQ+Uc5gcMsVpgdtaGAu9hC8eBSvmj3927BVS8JOQf2dZmHx9257DW5uS +Pj/NjxqptNkqLUb/ENLnZp7baWiahV2OqveglFnnmxZFALQVm4kcpPbBjAW7Mum 39wv6/RY9uBIQVmORyKroxm5VRbvnVz7R729JXqzXaCj2YexZmeXo2/MhOortDFj wSiPgvSdkr9bcvhFKbt9oDiKkhoWF4iURdUW6CdWZsuOeDqkgl3zxobG4yP72anB PgjpiFXrMGah4gnwE01UTE+ExYNvhvcKIWdDMli6H1YW2Eoi2PXJw== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4e6h8mtsqg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 May 2026 15:40:24 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 64KFd64E008375; Wed, 20 May 2026 15:40:23 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4e739w03bv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 May 2026 15:40:23 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 64KFeJ5u8323524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 May 2026 15:40:19 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DCB2520040; Wed, 20 May 2026 15:40:18 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B58D2004B; Wed, 20 May 2026 15:40:18 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 20 May 2026 15:40:18 +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 v15 20/20] unwind_user/sframe: Add prctl() interface for registering .sframe sections Date: Wed, 20 May 2026 17:40:04 +0200 Message-ID: <20260520154004.3845823-21-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260520154004.3845823-1-jremus@linux.ibm.com> References: <20260520154004.3845823-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-GUID: 8r4Jt1uPtErt-p80F5ARJZjJU30LBmBj X-Authority-Analysis: v=2.4 cv=GYMnWwXL c=1 sm=1 tr=0 ts=6a0dd5e9 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VwQbUJbxAAAA:8 a=meVymXHHAAAA:8 a=pGLkceISAAAA:8 a=VnNF1IyMAAAA:8 a=1RKwvADtGVyjO38rMG4A:9 a=2JgSa4NbpEOStq-L5dxp:22 X-Proofpoint-ORIG-GUID: mjXy61-ALNHMmMxx1WsbOKx6Ph1jwlyl X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIwMDE1MSBTYWx0ZWRfX7JfboGGTW41p XDOHgShkDe/wpP2e0PXh/NeE07prsJJAQtbcvDgJyFfh9ORKY5ctpBKa2GImqvsb9BYX5Dl2UIR a4z+hPRnfb/25tSVVzV7q0B0Zo5KueRA+o4cj4/8Ri4EjiZb2yn3b0crinZq6oyxEGekYO3EpyD AtuzEFqyxlPLN5JV1hKeQEoMg+NVORfXB3r48SrqSDP98MsS2lpFo5RO0xNrVDM59A+nteFTCdL 61ePrUsjdAvXBdF1KhjqMmkg6xevbS+QCNe7i0l783bK4UdiO33kWAdgJApHPCTUW+3wuldkoLU 1HF45OQ3oVZVlQxt2VgsbQcEtw8NhxAVwVMmWMYRLUDm8KJfZTDN8qtnXGRFWI33/3jRHMf0iCK C2jnFU5OYUV3TSe+j7H5ha6VxxTjJONsKyIqF9V7BcHraBzEFTcAgtZs0GZpITxPmNJFhVRniC3 3pK4cj/XcPfSGNQhRfg== 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-20_03,2026-05-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 clxscore=1015 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605200151 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 v15: - Fix rebase error (missing break). (Sashiko AI) Changes in v14: - Bump PR_ADD_SFRAME and PR_REMOVE_SFRAME. include/uapi/linux/prctl.h | 4 ++++ kernel/sys.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h index b6ec6f693719..bd0bf828b033 100644 --- a/include/uapi/linux/prctl.h +++ b/include/uapi/linux/prctl.h @@ -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..b0a9b1e3ccd7 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -65,6 +65,7 @@ #include #include #include +#include #include @@ -2907,6 +2908,14 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, if (arg3 & PR_CFI_LOCK && !(arg3 & PR_CFI_DISABLE)) error = arch_prctl_lock_branch_landing_pad_state(me); break; + 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); error = -EINVAL; -- 2.51.0