From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 099DA21882B; Thu, 24 Apr 2025 20:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745525789; cv=none; b=FGhmH0keCVT9WS6eqRC9QujuS65li5Oz0rLjshbsLJwIjZKSlwlJWgQ5+eVMo7eF/0BsxUhSw/aXF/4ziq1LU8qhB9sOmvPSiwrz5MOrHqwDraeYX6QJqWrIo3fizddJv9FhbMMqkvTQKDMqCqrlCEI8bvEXjTy/tEu6gx3QGnk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745525789; c=relaxed/simple; bh=HYqUX8NOw07w7m9e2ts05QoIOIvbKztU+oGEXImRejg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Ezexj3hxQaZElvhl7kApRQ2dyHJQsYC4Eoz6WPUVQqlyu/E1cwQi9yxqYJxW3kmU+MdU0gokieRe9zgTY3Aw+pggUvvDfqbBRBq+CafOnTOEP2u5w/+keJ36xG5iO9+brfz75hsLWvon5zTgt6O5yPFu/zlicp2847xFlzl5Cgk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FD58C16AAE; Thu, 24 Apr 2025 20:16:28 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1u831c-0000000H3vB-2axK; Thu, 24 Apr 2025 16:18:24 -0400 Message-ID: <20250424201824.466438405@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 24 Apr 2025 16:15:17 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Josh Poimboeuf , x86@kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Indu Bhagat , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Mark Brown , linux-toolchains@vger.kernel.org, Jordan Rome , Sam James , Andrii Nakryiko , Jens Remus , Florian Weimer , Andy Lutomirski , Weinan Liu , Blake Jones , Beau Belgrave , "Jose E. Marchesi" , Alexander Aring Subject: [PATCH v5 06/12] unwind_user/sframe: Add prctl() interface for registering .sframe sections References: <20250424201511.921245242@goodmis.org> Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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. Signed-off-by: Josh Poimboeuf Signed-off-by: Steven Rostedt (Google) --- include/uapi/linux/prctl.h | 5 ++++- kernel/sys.c | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h index 15c18ef4eb11..4973c932341b 100644 --- a/include/uapi/linux/prctl.h +++ b/include/uapi/linux/prctl.h @@ -351,7 +351,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. @@ -364,4 +364,7 @@ struct prctl_mm_map { # define PR_TIMER_CREATE_RESTORE_IDS_ON 1 # define PR_TIMER_CREATE_RESTORE_IDS_GET 2 +#define PR_ADD_SFRAME 78 +#define PR_REMOVE_SFRAME 79 + #endif /* _LINUX_PRCTL_H */ diff --git a/kernel/sys.c b/kernel/sys.c index c434968e9f5d..d76665e4df7e 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -64,6 +64,7 @@ #include #include #include +#include #include @@ -2820,6 +2821,14 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, return -EINVAL; error = posixtimer_create_prctl(arg2); 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.47.2