void* is used to align to 32-bits or 64-bits on 32 and 64 bits archs.
Purecap breaks this assumption.
As struct __kernel_sockaddr_storage is used for both Aarch64 and purecap
user structs, we cannot reliably use void* for alignment.
Change it to an unsigned long. Musl uses the same type for its definition
of struct sockaddr_storage.
Signed-off-by: Teo Couprie Diaz <teo.coupriediaz(a)arm.com>
---
include/uapi/linux/socket.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 51d6bb2f6765..28ff6a4aebca 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -22,7 +22,7 @@ struct __kernel_sockaddr_storage {
/* space to achieve desired size, */
/* _SS_MAXSIZE value minus size of ss_family */
};
- void *__align; /* implementation specific desired alignment */
+ unsigned long __align; /* implementation specific desired alignment */
};
};
--
2.25.1
Hi All,
This series adds capabilities support for clone3 syscall along with
set of testcases in morello clone kselftests.
Changes available at:
https://git.morello-project.org/Bea/linux/-/tree/morello/clone3_v4
LTP changes:
https://git.morello-project.org/Bea/morello-linux-ltp/-/tree/morello/clone3
To run clone3 tests:
./runltp -f syscalls -s clone3
v4:
[PATCH 1/3]
- fixed commit message referring to the wrong copy routine
[PATCH 3/3]
- dropped setting default size for clone3 args
- dropped stale comment regarding re-using bits from clone_args flags
- switched ASSERT_FALSE to ASSERT_EQ when comparing pids in child process
- added caching tls value to safely unmap memory
- added validation for both clone stack and tls
- switch from clone_args-> tls to actual thread data when checking for tag in
cloned process
v3:
[PATCH 1/3]:
- updated commit message to reflect actual changes
[PATCH 2/3]:
- fixed type casting and sizes for copy routines
- swapped order of args for clone_args_size_ver
[PATCH 3/3]:
- added dedicated field for test custom flags instead of 'borrowing' one from
clone_args struct
- added test for stack before calling munmap in failing test cases
- switched to WSTOPPED for waitid call
v2:
- add copy_struct_from_user_with_ptr variant
- drop explicit padding from clone_args struct
- switch __alignof__ to sizeof for struct sizing conditions
- use __clone_args_size_ver macro when validating struct layout
- cache the current compat mode instead of relying on compiler optimizations
- drop use of as_user_ptr in favour of explicit casting
- use clone_args struct directly for kselftest test fixture
- add signalling to better handle dependencies between test threads
Beata Michalska (3):
uaccess: Preserve capability tags with copy_struct_from_user_with_ptr
fork: clone3: Add support for architectural capabilities
kselftests/arm64: morello: Add clone3 test-cases
include/linux/uaccess.h | 60 ++++-
include/uapi/linux/sched.h | 30 ++-
kernel/fork.c | 139 ++++++++---
.../testing/selftests/arm64/morello/Makefile | 1 +
tools/testing/selftests/arm64/morello/clone.c | 222 +++++++++++++++++-
5 files changed, 400 insertions(+), 52 deletions(-)
--
2.25.1
Hi All,
This series adds capabilities support for clone3 syscall along with
set of testcases in morello clone kselftests.
Changes available at:
https://git.morello-project.org/Bea/linux/-/tree/morello/clone3_v3
LTP changes:
https://git.morello-project.org/Bea/morello-linux-ltp/-/tree/morello/clone3
To run clone3 tests:
./runltp -f syscalls -s clone3
v3:
[PATCH 1/3]:
- updated commit message to reflect actual changes
[PATCH 2/3]:
- fixed type casting and sizes for copy routines
- swapped order of args for clone_args_size_ver
[PATCH 3/3]:
- added dedicated field for test custom flags instead of 'borrowing' one from
clone_args struct
- added test for stack before calling munmap in failing test cases
- switched to WSTOPPED for waitid call
v2:
- add copy_struct_from_user_with_ptr variant
- drop explicit padding from clone_args struct
- switch __alignof__ to sizeof for struct sizing conditions
- use __clone_args_size_ver macro when validating struct layout
- cache the current compat mode instead of relying on compiler optimizations
- drop use of as_user_ptr in favour of explicit casting
- use clone_args struct directly for kselftest test fixture
- add signalling to better handle dependencies between test threads
Beata Michalska (3):
uaccess: Preserve capability tags with copy_struct_from_user_with_ptr
fork: clone3: Add support for architectural capabilities
kselftests/arm64: morello: Add clone3 test-cases
include/linux/uaccess.h | 60 ++++-
include/uapi/linux/sched.h | 30 ++-
kernel/fork.c | 139 ++++++++---
.../testing/selftests/arm64/morello/Makefile | 1 +
tools/testing/selftests/arm64/morello/clone.c | 228 +++++++++++++++++-
5 files changed, 406 insertions(+), 52 deletions(-)
--
2.25.1
Hi All,
This series adds capabilities support for clone3 syscall along with
set of testcases in morello clone kselftests.
Changes available at:
https://git.morello-project.org/Bea/linux/-/tree/morello/clone3_v2
LTP changes:
https://git.morello-project.org/Bea/morello-linux-ltp/-/tree/morello/clone3
To run clone3 tests:
./runltp -f syscalls -s clone3
v2:
- add copy_struct_from_user_with_ptr variant
- drop explicit padding from clone_args struct
- switch __alignof__ to sizeof for struct sizing conditions
- use __clone_args_size_ver macro when validating struct layout
- cache the current compat mode instead of relying on compiler optimizations
- drop use of as_user_ptr in favour of explicit casting
- use clone_args struct directly for kselftest test fixture
- add signalling to better handle dependencies between test threads
Beata Michalska (3):
uaccess: Preserve capability tags with copy_struct_from_user
fork: clone3: Add support for architectural capabilities
kselftests/arm64: morello: Add clone3 test-cases
include/linux/uaccess.h | 60 ++++-
include/uapi/linux/sched.h | 30 ++-
kernel/fork.c | 135 +++++++---
.../testing/selftests/arm64/morello/Makefile | 1 +
tools/testing/selftests/arm64/morello/clone.c | 232 +++++++++++++++++-
5 files changed, 406 insertions(+), 52 deletions(-)
--
2.25.1
void* can cause issues for alignment now that its size depends on whether
it is compat or purecap. In struct __kernel_sockaddr_storage, it is not
annotated with __user, so it is affected.
Change it to an unsigned long. Musl uses the same type for its struct
definitions.
Signed-off-by: Teo Couprie Diaz <teo.coupriediaz(a)arm.com>
---
include/uapi/linux/socket.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 51d6bb2f6765..28ff6a4aebca 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -22,7 +22,7 @@ struct __kernel_sockaddr_storage {
/* space to achieve desired size, */
/* _SS_MAXSIZE value minus size of ss_family */
};
- void *__align; /* implementation specific desired alignment */
+ unsigned long __align; /* implementation specific desired alignment */
};
};
base-commit: bbd29c87073f43eb8c09e8a2c2f4508b46a831a0
--
2.25.1
Hi,
This series includes all the uAPI changes defined in the PCuABI spec
that are not already in the tree or posted on the list.
The patches are not meant to be merged right now, logically this should
happen together with the corresponding implementaton. Rather, I am
making these patches available for reference, as the emulation of PCuABI
is progressing in projects like libshim and requires the definition of
these uAPI macros.
The patches are also available in this branch:
https://git.morello-project.org/kbrodsky-arm/linux/-/commits/upcoming_uapi
Thanks,
Kevin
Kevin Brodsky (3):
uapi: errno.h: Introduce ERESERVATION
uapi: mm: Introduce PROT_MAX()
uapi: mm: Introduce PROT_CAP_INVOKE
include/uapi/asm-generic/errno.h | 2 ++
include/uapi/asm-generic/mman-common.h | 8 ++++++++
2 files changed, 10 insertions(+)
--
2.38.1
The __packed attribute for struct compat_group_req led to a failure of
the LTP test accept02 when trying to join a multicast group.
Keep it for COMPAT32 but remove it in COMPAT64, do the same for the
other structs used here.
Signed-off-by: Teo Couprie Diaz <teo.coupriediaz(a)arm.com>
---
Not really sure this is the right way to go, nor if the others structs
should be left alone.
Chaning them all didn't lead to failures in setsockopt or accept LTP
tests, which was where the issue was detected.
include/net/compat.h | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/include/net/compat.h b/include/net/compat.h
index f2d7423217d2..5cb091e2a6a6 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -68,7 +68,11 @@ struct compat_group_req {
__u32 gr_interface;
struct __kernel_sockaddr_storage gr_group
__aligned(4);
+#ifdef CONFIG_COMPAT32
} __packed;
+#else
+};
+#endif
struct compat_group_source_req {
__u32 gsr_interface;
@@ -76,7 +80,11 @@ struct compat_group_source_req {
__aligned(4);
struct __kernel_sockaddr_storage gsr_source
__aligned(4);
+#ifdef CONFIG_COMPAT32
} __packed;
+#else
+};
+#endif
struct compat_group_filter {
union {
@@ -88,7 +96,11 @@ struct compat_group_filter {
__u32 gf_numsrc_aux;
struct __kernel_sockaddr_storage gf_slist[1]
__aligned(4);
+#ifdef CONFIG_COMPAT32
} __packed;
+#else
+ };
+#endif
struct {
__u32 gf_interface;
struct __kernel_sockaddr_storage gf_group
@@ -97,8 +109,16 @@ struct compat_group_filter {
__u32 gf_numsrc;
struct __kernel_sockaddr_storage gf_slist_flex[]
__aligned(4);
+#ifdef CONFIG_COMPAT32
} __packed;
+#else
+ };
+#endif
};
-} __packed;
+#ifdef CONFIG_COMPAT32
+ } __packed;
+#else
+ };
+#endif
#endif /* NET_COMPAT_H */
base-commit: 2fcc0af155a19755f68602f400fc845d2c9e6077
--
2.25.1
Hi,
This RFC proposes changes to the bpf syscall to support propagating
user pointers as capabilities in the pure-capability kernel-user ABI
(PCuABI). It also includes an approach to supporting the existing
aarch64 ABI as a COMPAT layer (compat64).
Since the bpf syscall is multiplexed this RFC changes only the
BPF_PROG_LOAD option. The idea is to agree on the general approach
and get some feedback here before the remaining options are changed to
fully support the syscall.
Since the changes are incomplete, functions in this series suffixed with
_fixed will eventually replace the original function it is updating. The
originals remain in place for now.
Patches 8 and 9 provide two potential solutions to one problem. I don't
know enough about LSMs to decide there so any input there appreciated.
A basic LTP test that only does a bare minimal bpf(BPF_PROG_LOAD...)
syscall has been created for this RFC to verify these changes. This also
tests the new CHECK_ATTR macro implementation.
Kernel branch available at:
https://git.morello-project.org/zdleaf/linux/-/commits/rfc/bpf
LTP test at:
https://git.morello-project.org/zdleaf/morello-linux-test-project/-/commits…
Thanks,
Zach
Zachary Leaf (9):
arm64: morello: enable eBPF and tracing
bpf/net: copy ptrs from user with bpf/sockptr_t
bpf: extend bpfptr_t to use pointers
bpf: use user pointer types for bpf_attr
bpf: add compat64 handling of bpf syscall
bpf: make CHECK_ATTR support compat
temp for RFC: add padding to BPF_PROG_LOAD
bpf/security: update bpf lsm API
bpf/security: move lsm hook point
.../morello_transitional_pcuabi_defconfig | 15 ++-
include/linux/bpfptr.h | 19 ++++
include/linux/sockptr.h | 9 ++
include/uapi/linux/bpf.h | 55 +++++++++--
kernel/bpf/syscall.c | 95 ++++++++++++++++---
kernel/bpf/verifier.c | 10 +-
6 files changed, 176 insertions(+), 27 deletions(-)
--
2.34.1