Re: [RESEND RFC PATCH v2] arm64: Exposes support for 32-bit syscalls

2021-02-12 Thread Amanieu d'Antras
On Fri, Feb 12, 2021 at 6:04 PM Mark Rutland wrote: > > The patch proposed by > > Ryan is based on the kernel patch used by Tango which can be found > > here: https://github.com/Amanieu/linux/tree/tango-v5.4 > > > > Efficiency is not the concern here: copying/rearranging some bytes is > > tiny com

Re: [RESEND RFC PATCH v2] arm64: Exposes support for 32-bit syscalls

2021-02-12 Thread Amanieu d'Antras
On Fri, Feb 12, 2021 at 1:28 PM Catalin Marinas wrote: > The only downside I think is that for some syscalls it's not that > efficient. Those using struct iovec come to mind, qemu probably > duplicates the user structures, having to copy them in both directions > (well, the kernel compat layer doe

Re: [PATCH] Adds a new ioctl32 syscall for backwards compatibility layers

2021-01-06 Thread Amanieu d'Antras
I encountered a similar problem when writing the Tango binary translator (https://www.amanieusystems.com/). Tango allows AArch32 programs to run on AArch64 CPUs that don't support AArch32 (e.g. ThunderX). The technology has been licensed to several customers who are primarily using it to run Androi

[PATCH v2 01/20] compat: Add generic compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
This matches the normal siginfo_t as closely as possible, unlike some architecture-specific versions which are missing some fields. Signed-off-by: Amanieu d'Antras --- arch/arm64/include/asm/compat.h | 2 ++ arch/mips/include/asm/compat.h| 1 + arch/parisc/include/asm/compat.h

[PATCH v2 00/20] Fix handling of compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
s since v1: - Properly copy padding bytes and avoid leaking uninitialized data to userspace - Fixed compile errors on mips and powerpc - Fixed some compiler warnings - Fixed some formatting issues Amanieu d'Antras (20): compat: Add generic compat_siginfo_t compat: Add generic copy_siginfo_{to,fro

[PATCH v2 06/20] mips: Use generic copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/mips/include/asm/compat.h | 3 -- arch/mips/kernel/signal32.c| 62 -- 2 files changed, 65 deletions(-) diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h index 29ca129..abc4fe4 1

[PATCH v2 05/20] mips: Clean up compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
union member and eliminating the unused _irix_sigchld one. Signed-off-by: Amanieu d'Antras --- arch/mips/include/asm/compat.h | 61 +++--- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/as

[PATCH v2 08/20] arm64: Use generic copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/arm64/include/asm/compat.h | 3 -- arch/arm64/kernel/signal32.c| 85 - 2 files changed, 88 deletions(-) diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index dc7cfc1..824

[PATCH v2 07/20] arm64: Use generic compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/arm64/include/asm/compat.h | 60 - 1 file changed, 60 deletions(-) diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 5eae749..dc7cfc1 100644 --- a/arch/arm64/include/asm/com

[PATCH v2 09/20] parisc: Use generic compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/parisc/include/asm/compat.h | 53 1 file changed, 53 deletions(-) diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index 46a0a8a..6c80ae2 100644 --- a/arch/parisc/includ

[PATCH v2 02/20] compat: Add generic copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
4 bytes of padding between the 64-bit union and the initial 3 siginfo_t members. Signed-off-by: Amanieu d'Antras --- arch/arm64/include/asm/compat.h| 2 + arch/mips/include/asm/compat.h | 2 + arch/parisc/include/asm/compat.h | 2 + arch/powerpc/include/asm/compat.h

[PATCH v2 10/20] parsic: Use generic copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/parisc/include/asm/compat.h | 3 -- arch/parisc/kernel/signal32.c| 102 --- 2 files changed, 105 deletions(-) diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index 6c

[PATCH v2 14/20] powerpc: Use generic copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/powerpc/include/asm/compat.h | 5 --- arch/powerpc/kernel/signal_32.c | 72 +-- 2 files changed, 1 insertion(+), 76 deletions(-) diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/com

[PATCH v2 11/20] s390: Use generic compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/s390/include/asm/compat.h | 52 -- 1 file changed, 52 deletions(-) diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index 497af62..fbb6365 100644 --- a/arch/s390/include/asm/com

[PATCH v2 15/20] tile: Use generic compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/tile/include/asm/compat.h | 57 -- 1 file changed, 57 deletions(-) diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index e0c61da..302a9f5 100644 --- a/arch/tile/include/asm/com

[PATCH v2 16/20] tile: Use generic copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/tile/include/asm/compat.h | 3 -- arch/tile/kernel/compat_signal.c | 75 2 files changed, 78 deletions(-) diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 302a9f5..74

[PATCH v2 12/20] s390: Use generic copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/s390/include/asm/compat.h | 3 -- arch/s390/kernel/compat_signal.c | 102 --- 2 files changed, 105 deletions(-) diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index fbb6365..5b

[PATCH v2 17/20] sparc: Use generic compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/sparc/include/asm/compat.h | 54 - 1 file changed, 54 deletions(-) diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 9357014..8f85fcd 100644 --- a/arch/sparc/include/asm/com

[PATCH v2 19/20] signalfd: Fix some issues in signalfd_copyinfo

2015-11-04 Thread Amanieu d'Antras
otherwise. 4) ssi_ptr and ssi_addr values for compat tasks did not match those generated by 32-bit kernels. The values need to be sign-extended to 64 bits rather than zero-extended. Signed-off-by: Amanieu d'Antras --- fs/signalfd.c | 58 ++--

[PATCH v2 20/20] signal: Remove unnecessary zero-initialization of siginfo_t

2015-11-04 Thread Amanieu d'Antras
This is no longer required since copy_siginfo_from_user32 now initializes all siginfo_t fields properly. Signed-off-by: Amanieu d'Antras --- kernel/ptrace.c | 1 - kernel/signal.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/ptrace.c b/kernel/ptrace.c

[PATCH v2 04/20] x86: Rewrite copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
. The new code is kept as close as possible to the generic version to make future changes to both functions easier. Unlike the previous implementation, this one guarantees that the compat behavior is identical to that of a 32-bit kernel. Signed-off-by: Amanieu d'Antras --- arch/

[PATCH v2 18/20] sparc: Use generic copy_siginfo_{to,from}_user32

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/sparc/include/asm/compat.h | 3 -- arch/sparc/kernel/signal32.c| 69 - 2 files changed, 72 deletions(-) diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 8f85fcd..1b

[PATCH v2 13/20] powerpc: Use generic compat_siginfo_t

2015-11-04 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/powerpc/include/asm/compat.h | 62 ++- 1 file changed, 2 insertions(+), 60 deletions(-) diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index cdc8638..f0f8392 100644 --- a

[PATCH v2 03/20] x86: Update compat_siginfo_t to be closer to the generic version

2015-11-04 Thread Amanieu d'Antras
x86 can't use the generic compat_siginfo_t because it needs to support x32, so we just change it to be closer to the generic version. The only significant change is the addition of several fields in _sigfault that were previously omitted. Signed-off-by: Amanieu d'Antras --- arch/x

Re: [PATCH 04/20] x86: Rewrite copy_siginfo_{to,from}_user32

2015-10-15 Thread Amanieu d'Antras
On Thu, Oct 15, 2015 at 7:41 PM, Oleg Nesterov wrote: > OOH ;) I'll try to look at this patch and the changes in the generic > code later. A couple of nits right now. > > Please CC x86 maintainers, not only x...@kernel.org. > > Please do not remove get/put_user_ex from this code. And this reminds

Re: [PATCH 19/20] signalfd: Fix handling of ssi_ptr and ssi_int in signalfd_copyinfo

2015-10-14 Thread Amanieu d'Antras
Sorry, this was an old version of the patch that was accidentally sent. Please ignore it. On Wed, Oct 14, 2015 at 9:59 PM, Amanieu d'Antras wrote: > There are several issues here: > 1) The value of ssi_ptr was incorrect for 32-bit processes. It was >previously copied direct

[PATCH 01/20] compat: Add generic compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
This matches the normal siginfo_t as closely as possible, unlike some architecture-specific versions which are missing some fields. Signed-off-by: Amanieu d'Antras --- arch/arm64/include/asm/compat.h | 2 ++ arch/mips/include/asm/compat.h| 1 + arch/parisc/include/asm/compat.h

[PATCH 02/20] compat: Add generic copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
this has never worked correctly in the past anyways. Signed-off-by: Amanieu d'Antras --- arch/arm64/include/asm/compat.h | 2 + arch/mips/include/asm/compat.h| 2 + arch/parisc/include/asm/compat.h | 2 + arch/powerpc/include/asm/compat.h | 2 + arch/s390/include/asm/com

[PATCH 03/20] x86: Update compat_siginfo_t to be closer to the generic version

2015-10-14 Thread Amanieu d'Antras
x86 can't use the generic compat_siginfo_t because it needs to support x32, so we just change it to be closer to the generic version. The only significant change is the addition of several fields in _sigfault that were previously omitted. Signed-off-by: Amanieu d'Antras --- arch/x

[PATCH 09/20] parisc: Use generic compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/parisc/include/asm/compat.h | 53 1 file changed, 53 deletions(-) diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index 46a0a8a..6c80ae2 100644 --- a/arch/parisc/includ

[PATCH 11/20] s390: Use generic compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/s390/include/asm/compat.h | 52 -- 1 file changed, 52 deletions(-) diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index 497af62..fbb6365 100644 --- a/arch/s390/include/asm/com

[PATCH 08/20] arm64: Use generic copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/arm64/include/asm/compat.h | 3 -- arch/arm64/kernel/signal32.c| 85 - 2 files changed, 88 deletions(-) diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index dc7cfc1..824

[PATCH 04/20] x86: Rewrite copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
d-off-by: Amanieu d'Antras --- arch/x86/kernel/signal_compat.c | 269 +--- 1 file changed, 194 insertions(+), 75 deletions(-) diff --git a/arch/x86/kernel/signal_compat.c b/arch/x86/kernel/signal_compat.c index dc3c0b1..e6f7e76 100644 --- a/arch/

[PATCH 12/20] s390: Use generic copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/s390/include/asm/compat.h | 3 -- arch/s390/kernel/compat_signal.c | 102 --- 2 files changed, 105 deletions(-) diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index fbb6365..5b

[PATCH 15/20] tile: Use generic compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/tile/include/asm/compat.h | 57 -- 1 file changed, 57 deletions(-) diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index e0c61da..302a9f5 100644 --- a/arch/tile/include/asm/com

[PATCH 13/20] powerpc: Use generic compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/powerpc/include/asm/compat.h | 60 --- 1 file changed, 60 deletions(-) diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index cdc8638..b4b644d 100644 --- a/arch/powerpc/includ

[PATCH 05/20] mips: Clean up compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
union member and eliminating the unused _irix_sigchld one. Signed-off-by: Amanieu d'Antras --- arch/mips/include/asm/compat.h | 62 ++ 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/as

[PATCH 17/20] sparc: Use generic compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/sparc/include/asm/compat.h | 54 - 1 file changed, 54 deletions(-) diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 9357014..8f85fcd 100644 --- a/arch/sparc/include/asm/com

[PATCH 16/20] tile: Use generic copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/tile/include/asm/compat.h | 3 -- arch/tile/kernel/compat_signal.c | 75 2 files changed, 78 deletions(-) diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 302a9f5..74

[PATCH 10/20] parsic: Use generic copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/parisc/include/asm/compat.h | 3 -- arch/parisc/kernel/signal32.c| 102 --- 2 files changed, 105 deletions(-) diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index 6c

[PATCH 19/20] signalfd: Fix some issues in signalfd_copyinfo

2015-10-14 Thread Amanieu d'Antras
otherwise. 4) ssi_ptr and ssi_addr values for compat tasks did not match those generated by 32-bit kernels. The values need to be sign-extended to 64 bits rather than zero-extended. Signed-off-by: Amanieu d'Antras --- fs/signalfd.c | 58 ++--

[PATCH 18/20] sparc: Use generic copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/sparc/include/asm/compat.h | 3 -- arch/sparc/kernel/signal32.c| 69 - 2 files changed, 72 deletions(-) diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 8f85fcd..1b

[PATCH 07/20] arm64: Use generic compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/arm64/include/asm/compat.h | 60 - 1 file changed, 60 deletions(-) diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 5eae749..dc7cfc1 100644 --- a/arch/arm64/include/asm/com

[PATCH 19/20] signalfd: Fix handling of ssi_ptr and ssi_int in signalfd_copyinfo

2015-10-14 Thread Amanieu d'Antras
otherwise. Signed-off-by: Amanieu d'Antras --- fs/signalfd.c | 42 +++--- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/fs/signalfd.c b/fs/signalfd.c index 270221f..4d59de9 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c @@ -80,22 +80,43 @@ s

[PATCH 20/20] signal: Remove unnecessary zero-initialization of siginfo_t

2015-10-14 Thread Amanieu d'Antras
This is no longer required since copy_siginfo_from_user32 now initializes all siginfo_t fields properly. Signed-off-by: Amanieu d'Antras --- kernel/ptrace.c | 1 - kernel/signal.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/ptrace.c b/kernel/ptrace.c

[PATCH 06/20] mips: Use generic copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/mips/include/asm/compat.h | 2 -- arch/mips/kernel/signal32.c| 62 -- 2 files changed, 64 deletions(-) diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h index 3ccb126..3269077 1

[PATCH 14/20] powerpc: Use generic copy_siginfo_{to,from}_user32

2015-10-14 Thread Amanieu d'Antras
Signed-off-by: Amanieu d'Antras --- arch/powerpc/include/asm/compat.h | 3 -- arch/powerpc/kernel/signal_32.c | 72 +-- 2 files changed, 1 insertion(+), 74 deletions(-) diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/com

[PATCH 00/20] Fix handling of compat_siginfo_t

2015-10-14 Thread Amanieu d'Antras
structures. signalfd_copyinfo was also modified to properly generate data for compat tasks. In particular the ssi_ptr and ssi_data members need to be sign-extended to 64 bits rather than zero-extended, since that is the behavior in 32-bit kernels. This series has been tested on x86_64 and arm64. Amanieu d&

Re: [PATCH] signal: Make the si_code check in rt_[tg]sigqueueinfo stricter

2015-10-13 Thread Amanieu d'Antras
unno. I am currently working on another patch set that updates copy_siginfo_{to,from}_user32 to match the behavior of 32-bit kernels. I will fix the si_code encoding there with a change similar to yours. Amanieu d'Antras -- To unsubscribe from this list: send the line "unsubscribe linux-k

Re: [PATCH] signal: Make the si_code check in rt_[tg]sigqueueinfo stricter

2015-10-12 Thread Amanieu d'Antras
On Mon, Oct 12, 2015 at 4:54 PM, Oleg Nesterov wrote: > Yes, copy_siginfo_to_user() does __put_user((short)from->si_code). > But SI_FROMUSER/SI_FROMKERNEL are internal kernel checks, we mostly > use them in copy_siginfo_to_user(). > > And note that if ->si_code < 0 we simply do __copy_to_user(), s

[PATCH] signal: Make the si_code check in rt_[tg]sigqueueinfo stricter

2015-10-12 Thread Amanieu d'Antras
value in the kernel. It was still possible to spoof any si_code by ORing 0x into the top 16 bits. The check is tightened by checking the value of si_code that will be seen by a user program instead of the one in the kernel. Signed-off-by: Amanieu d'Antras --- kernel/signal.c | 4 ++