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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 ++--
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
.
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/
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
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
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
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
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
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
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
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
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
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
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
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/
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
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
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
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
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
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
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
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 ++--
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
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
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
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
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
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
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&
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
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
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 ++
51 matches
Mail list logo