From nobody Tue Apr 7 08:08:13 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 6AE2C1A9FAB for ; Sat, 14 Mar 2026 12:17:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773490641; cv=none; b=uoZo/P0UsTHoRwAroAmCvOVDzk59HD0LNEZdSAkUa4g4JxL1BeE/xX4Ech1pTZV3vOl9dVR/AiTTN0mvM9jeYy7q1SbjJTlZZ0DY/Loeynq1ynBPg34/Ik0mO77w9G248UyiwIBfbCeehCP2X2yUW+1GoaBAcRVfsmi/1Qb6H4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773490641; c=relaxed/simple; bh=OlthjceWFlP/t9Z+nIzC6nOI/h+7JAjfkWc6lPSVgvU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=tIfzHHUQdkjtMdDnw7gCju5bPsWRrvEMiVwDCamDCIM6lziZFyJ3XcA9WJ3NpyirUEM40vGrFd9nBrloJ7/FCdd+tdVKCs45ZSjT+4RB7loVX2QQzAeByfL3zhY3m3Sf17iEmgahx3R9Yq2POWxoOA9w+V3R4tbp2Z4O0hythFs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=XXWPMO7j; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="XXWPMO7j" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773490637; bh=OlthjceWFlP/t9Z+nIzC6nOI/h+7JAjfkWc6lPSVgvU=; h=From:Date:Subject:To:Cc:From; b=XXWPMO7jfBtuimVlb8bc22Z8R04dq7vUlWUqmrKPxru7D+xPDNGVBzLkSE+0i12ny fde8gga8gSixRTyJzo/54EubC/gs6UUL2aElsZNxWPdlnnaNIby3kpiMk4+cR/l5hz DOQT/YLP/heB5V7qwY6tvaTibtE20dtUu58V44SY= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 14 Mar 2026 13:17:13 +0100 Subject: [PATCH] ARM: uapi: Add ucontext.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260314-uapi-ucontext-arm-v1-1-d9922bdf7dbc@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x3MTQqAIBBA4avIrBvQfqmrRAuzsWaRiVYE0t2Tl t/ivQSRAlOEQSQIdHPkw2WoQoDZtFsJecmGUpatrFSNl/aMlzncSc+JOuzYSdvrpjNzrxbInQ9 k+fmf4/S+H7r3CGBjAAAA X-Change-ID: 20260314-uapi-ucontext-arm-70f9a57cb91d To: Russell King Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773490637; l=3751; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=OlthjceWFlP/t9Z+nIzC6nOI/h+7JAjfkWc6lPSVgvU=; b=K1xCTxWYYvR/c56rgglSso3P9t4OrUPOMfy6xW2lEOXuwMDdI5IqLR20vsyTLJY8wt8sze9rf eUJ14aZDx8+C/jaxBGz8UQVc4HncxcoXKxSguMw7ye7TT8sIugBgENg X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The ARM asm/ucontext.h header was written to be usable both inside the kernel and in the UAPI, by using '#ifdef __KERNEL__' guards. However as the header is not located in the 'uapi/' directory, it will never be exposed as such. Move the UAPI bits to a new UAPI header and remove the pointless ifdeffery. While at it, also add some necessary includes to the new header. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/arm/include/asm/ucontext.h | 28 +--------------------------- arch/arm/include/uapi/asm/ucontext.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/arch/arm/include/asm/ucontext.h b/arch/arm/include/asm/ucontex= t.h index 4048c92d9c2b..e4e00822198e 100644 --- a/arch/arm/include/asm/ucontext.h +++ b/arch/arm/include/asm/ucontext.h @@ -4,31 +4,7 @@ =20 #include #include - -/* - * struct sigcontext only has room for the basic registers, but struct - * ucontext now has room for all registers which need to be saved and - * restored. Coprocessor registers are stored in uc_regspace. Each - * coprocessor's saved state should start with a documented 32-bit magic - * number, followed by a 32-bit word giving the coproccesor's saved size. - * uc_regspace may be expanded if necessary, although this takes some - * coordination with glibc. - */ - -struct ucontext { - unsigned long uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - struct sigcontext uc_mcontext; - sigset_t uc_sigmask; - /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ - int __unused[32 - (sizeof (sigset_t) / sizeof (int))]; - /* Last for extensibility. Eight byte aligned because some - coprocessors require eight byte alignment. */ - unsigned long uc_regspace[128] __attribute__((__aligned__(8))); -}; - -#ifdef __KERNEL__ +#include =20 /* * Coprocessor save state. The magic values and specific @@ -91,6 +67,4 @@ struct aux_sigframe { unsigned long end_magic; } __attribute__((__aligned__(8))); =20 -#endif - #endif /* !_ASMARM_UCONTEXT_H */ diff --git a/arch/arm/include/uapi/asm/ucontext.h b/arch/arm/include/uapi/a= sm/ucontext.h new file mode 100644 index 000000000000..6e6c3202e85e --- /dev/null +++ b/arch/arm/include/uapi/asm/ucontext.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_ASMARM_UCONTEXT_H +#define _UAPI_ASMARM_UCONTEXT_H + +#include +#include + +/* + * struct sigcontext only has room for the basic registers, but struct + * ucontext now has room for all registers which need to be saved and + * restored. Coprocessor registers are stored in uc_regspace. Each + * coprocessor's saved state should start with a documented 32-bit magic + * number, followed by a 32-bit word giving the coproccesor's saved size. + * uc_regspace may be expanded if necessary, although this takes some + * coordination with glibc. + */ + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; + /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ + int __unused[32 - (sizeof (sigset_t) / sizeof (int))]; + /* Last for extensibility. Eight byte aligned because some + coprocessors require eight byte alignment. */ + unsigned long uc_regspace[128] __attribute__((__aligned__(8))); +}; + +#endif --- base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f change-id: 20260314-uapi-ucontext-arm-70f9a57cb91d Best regards, --=20 Thomas Wei=C3=9Fschuh