ipc_parse_version is not used in 64-bit, only when in 32-bit compat. Change ARCH_WANT_COMPAT_IPC_PARSE_VERSION to be selected in COMPAT32 only.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com --- arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index d402721ccad0..c784d8664a40 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -92,7 +92,7 @@ config ARM64 select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING - select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT32 select ARCH_WANT_DEFAULT_BPF_JIT select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_FRAME_POINTERS
Hi,
On 9/27/22 16:24, Teo Couprie Diaz wrote:
ipc_parse_version is not used in 64-bit, only when in 32-bit compat. Change ARCH_WANT_COMPAT_IPC_PARSE_VERSION to be selected in COMPAT32 only.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index d402721ccad0..c784d8664a40 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -92,7 +92,7 @@ config ARM64 select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING
- select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
- select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT32 select ARCH_WANT_DEFAULT_BPF_JIT select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_FRAME_POINTERS
After looking at the structures used by shmctl for passing arguments, the first 3 patches may not be needed. It does not have user pointers inside the structure so compat handler can be set to native handler. This 4th patch can be retained.
--- a/arch/arm64/kernel/sys_compat64.c +++ b/arch/arm64/kernel/sys_compat64.c @@ -83,6 +83,14 @@ #define __arm64_compatentry_compat_sys_setitimer __arm64_compatentry_sys_setitimer #define __arm64_compatentry_compat_sys_getrusage __arm64_compatentry_sys_getrusage
+#define __arm64_compatentry_compat_sys_shmctl __arm64_compatentry_sys_shmctl + asmlinkage long sys_ni_syscall(void);
Thanks, Amit Daniel
On 28/09/2022 10:20, Amit Kachhap wrote:
Hi,
On 9/27/22 16:24, Teo Couprie Diaz wrote:
ipc_parse_version is not used in 64-bit, only when in 32-bit compat. Change ARCH_WANT_COMPAT_IPC_PARSE_VERSION to be selected in COMPAT32 only.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index d402721ccad0..c784d8664a40 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -92,7 +92,7 @@ config ARM64 select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING - select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT32 select ARCH_WANT_DEFAULT_BPF_JIT select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_FRAME_POINTERS
After looking at the structures used by shmctl for passing arguments, the first 3 patches may not be needed. It does not have user pointers inside the structure so compat handler can be set to native handler.
That is correct, however we have made the decision to avoid bypassing compat handlers if it is straightforward to fix the compat_* structs and/or handlers. This is by far the most common case, including here (the only notable exception so far has been time structs). Note that in fact the diff below would only supersede patch 1. Patch 2 fixes things not just for shmctl but also semctl and possibly others (compat_ipc64_perm is used in quite a few places). Patch 3 fixes shmat, which needs different handling in compat anyway (similarly to mmap).
Kevin
This 4th patch can be retained.
--- a/arch/arm64/kernel/sys_compat64.c +++ b/arch/arm64/kernel/sys_compat64.c @@ -83,6 +83,14 @@ #define __arm64_compatentry_compat_sys_setitimer __arm64_compatentry_sys_setitimer #define __arm64_compatentry_compat_sys_getrusage __arm64_compatentry_sys_getrusage
+#define __arm64_compatentry_compat_sys_shmctl __arm64_compatentry_sys_shmctl
asmlinkage long sys_ni_syscall(void);
Thanks, Amit Daniel _______________________________________________ linux-morello mailing list -- linux-morello@op-lists.linaro.org To unsubscribe send an email to linux-morello-leave@op-lists.linaro.org
On 9/28/22 14:52, Kevin Brodsky wrote:
On 28/09/2022 10:20, Amit Kachhap wrote:
Hi,
On 9/27/22 16:24, Teo Couprie Diaz wrote:
ipc_parse_version is not used in 64-bit, only when in 32-bit compat. Change ARCH_WANT_COMPAT_IPC_PARSE_VERSION to be selected in COMPAT32 only.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index d402721ccad0..c784d8664a40 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -92,7 +92,7 @@ config ARM64 select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING - select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT32 select ARCH_WANT_DEFAULT_BPF_JIT select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_FRAME_POINTERS
After looking at the structures used by shmctl for passing arguments, the first 3 patches may not be needed. It does not have user pointers inside the structure so compat handler can be set to native handler.
That is correct, however we have made the decision to avoid bypassing compat handlers if it is straightforward to fix the compat_* structs and/or handlers. This is by far the most common case, including here (the only notable exception so far has been time structs). Note that in fact the diff below would only supersede patch 1. Patch 2 fixes things not just for shmctl but also semctl and possibly others (compat_ipc64_perm is used in quite a few places). Patch 3 fixes shmat, which needs different handling in compat anyway (similarly to mmap).
Agreed that by modifying the compat_* structures we will actually fix all the other usecases. Since I had both implementations for semctl/msgctl so I was in dilemma which one to send. thanks for the clarification.
Amit
Kevin
This 4th patch can be retained.
--- a/arch/arm64/kernel/sys_compat64.c +++ b/arch/arm64/kernel/sys_compat64.c @@ -83,6 +83,14 @@ #define __arm64_compatentry_compat_sys_setitimer __arm64_compatentry_sys_setitimer #define __arm64_compatentry_compat_sys_getrusage __arm64_compatentry_sys_getrusage
+#define __arm64_compatentry_compat_sys_shmctl __arm64_compatentry_sys_shmctl
asmlinkage long sys_ni_syscall(void);
Thanks, Amit Daniel _______________________________________________ linux-morello mailing list -- linux-morello@op-lists.linaro.org To unsubscribe send an email to linux-morello-leave@op-lists.linaro.org
Hi,
On 9/28/22 09:20, Amit Kachhap wrote:
Hi,
On 9/27/22 16:24, Teo Couprie Diaz wrote:
ipc_parse_version is not used in 64-bit, only when in 32-bit compat. Change ARCH_WANT_COMPAT_IPC_PARSE_VERSION to be selected in COMPAT32 only.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index d402721ccad0..c784d8664a40 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -92,7 +92,7 @@ config ARM64 select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING
- select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
- select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT32 select ARCH_WANT_DEFAULT_BPF_JIT select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_FRAME_POINTERS
After looking at the structures used by shmctl for passing arguments, the first 3 patches may not be needed. It does not have user pointers inside the structure so compat handler can be set to native handler. This 4th patch can be retained.
Thanks for the review Amit ! The structs don't contain any user pointers indeed, but as Kevin mentioned we elected to keep the compat handler. That allowed me to fix a few things along the way too.
--- a/arch/arm64/kernel/sys_compat64.c +++ b/arch/arm64/kernel/sys_compat64.c @@ -83,6 +83,14 @@ #define __arm64_compatentry_compat_sys_setitimer __arm64_compatentry_sys_setitimer #define __arm64_compatentry_compat_sys_getrusage __arm64_compatentry_sys_getrusage
+#define __arm64_compatentry_compat_sys_shmctl __arm64_compatentry_sys_shmctl
asmlinkage long sys_ni_syscall(void);
However that is good to know if I ever need to bypass the compat handler !
Thanks, Amit Daniel
Thanks, Téo IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
linux-morello@op-lists.linaro.org