Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #61538 > unrolled thread

Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes

Started byAurelien Jarno <aurel32@debian.org>
First post2018-07-23 21:40 +0200
Last post2019-08-26 20:00 +0200
Articles 8 — 4 participants

Back to article view | Back to linux.debian.kernel


Contents

  Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes Aurelien Jarno <aurel32@debian.org> - 2018-07-23 21:40 +0200
    Processed (with 1 error): Re: Bug#904385: arm64: sigaltstack  fails with MINSIGSTKSZ for 32-bit processes "Debian Bug Tracking System" <owner@bugs.debian.org> - 2018-07-23 21:50 +0200
    Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes Aurelien Jarno <aurel32@debian.org> - 2018-07-23 21:50 +0200
      Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes Steve McIntyre <steve@einval.com> - 2018-07-25 17:30 +0200
        Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes Steve McIntyre <steve@einval.com> - 2018-09-26 12:50 +0200
          Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes Aurelien Jarno <aurelien@aurel32.net> - 2019-07-29 22:30 +0200
    Processed: Re: Bug#904385: arm64: sigaltstack fails with  MINSIGSTKSZ for 32-bit processes "Debian Bug Tracking System" <owner@bugs.debian.org> - 2019-07-29 22:30 +0200
    Bug#904385: marked as done (arm64: sigaltstack fails with  MINSIGSTKSZ for 32-bit processes) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2019-08-26 20:00 +0200

#61538 — Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes

FromAurelien Jarno <aurel32@debian.org>
Date2018-07-23 21:40 +0200
SubjectBug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes
Message-ID<weOQy-3Py-1@gated-at.bofh.it>
Package: src:linux
Version: 4.9.110-1
Severity: normal

Dear Maintainer,

The arm64 kernel allows one to run aarch32 processes on an aarch64
processor (if it has support for it), using the standard 32/64-bit
syscall compatibility. However this compat layer does not correctly
validate the arguments of the sigaltstack syscall.

arch/arm64/include/uapi/asm/signal.h defines SIGSTKSZ and MINSIGSTKSZ
as follow:
| #define MINSIGSTKSZ 5120
| #define SIGSTKSZ    16384

arch/arm/include/uapi/asm/signal.h defines SIGSTKSZ and MINSIGSTKSZ as
follow:
| #define MINSIGSTKSZ 2048
| #define SIGSTKSZ    8192

It seems to be the only 32/64-bit architecture for which those constants
differ. The do_compat_sigaltstack function in kernel/signal.c passes
ss.ss_size to do_sigaltstack unchanged, and the latter validates it
against the native MINSIGSTKSZ.

This causes the glibc test nptl/tst-signal6 to fail, but I guess it can
also affects other packages at runtime. This is also reproducible with
the following simple testcase:

| #include <signal.h>
| #include <stdlib.h>
| #include <stdio.h>
| 
| int main(int argc, char *argv[])
| {
|         stack_t ss;
| 
|         ss.ss_sp = malloc(MINSIGSTKSZ);
|         if (ss.ss_sp == NULL) {
|                 perror("malloc");
|                 exit(EXIT_FAILURE);
|         }
| 
|         ss.ss_size = MINSIGSTKSZ;
|         ss.ss_flags = 0;
|         if (sigaltstack(&ss, NULL)) {
|                 perror("sigaltstack");
|                 exit(EXIT_FAILURE);
|         }
| 
|         return 0;
| }

| $ ./sigaltstack 
| sigaltstack: Cannot allocate memory

| $ strace ./sigaltstack
| execve("./sigaltstack", ["./sigaltstack"], [/* 23 vars */]) = 0
| strace: [ Process PID=694 runs in 32 bit mode. ]
| uname({sysname="Linux", nodename="arm64", ...}) = 0
| brk(NULL)                               = 0x35d000
| brk(0x35dd00)                           = 0x35dd00
| set_tls(0x35d4c0, 0x78f7c, 0, 0x24, 0x78f6c) = 0
| readlink("/proc/self/exe", "/home/aurel32/sigaltstack", 4096) = 25
| brk(0x37ed00)                           = 0x37ed00
| brk(0x37f000)                           = 0x37f000
| access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
| sigaltstack({ss_sp=0x35e8b0, ss_flags=0x800 /* SS_??? */, ss_size=67191}, NULL) = -1 ENOMEM (Cannot allocate memory)
| dup(2)                                  = 3
| fcntl64(3, F_GETFL)                     = 0x20002 (flags O_RDWR|0x20000)
| fstat64(3, 0xff96bf28)                  = 0
| write(3, "sigaltstack: Cannot allocate mem"..., 36sigaltstack: Cannot allocate memory
| ) = 36
| close(3)                                = 0
| exit_group(1)                           = ?
| +++ exited with 1 +++

-- System Information:
Debian Release: 9.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: arm64 (aarch64)

Kernel: Linux 4.9.0-7-arm64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

[toc] | [next] | [standalone]


#61539 — Processed (with 1 error): Re: Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes

From"Debian Bug Tracking System" <owner@bugs.debian.org>
Date2018-07-23 21:50 +0200
SubjectProcessed (with 1 error): Re: Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes
Message-ID<weP0d-3TQ-1@gated-at.bofh.it>
In reply to#61538
Processing control commands:

> affects -1 glibc
Bug #904385 [src:linux] arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes
Added indication that 904385 affects glibc
> found linux/4.17.6-2
Unknown command or malformed arguments to command.


-- 
904385: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904385
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems

[toc] | [prev] | [next] | [standalone]


#61540

FromAurelien Jarno <aurel32@debian.org>
Date2018-07-23 21:50 +0200
Message-ID<weP0d-3TQ-3@gated-at.bofh.it>
In reply to#61538
control: affects -1 glibc
control: found linux/4.17.6-2

On 2018-07-23 21:31, Aurelien Jarno wrote:
> Package: src:linux
> Version: 4.9.110-1
> Severity: normal
> 
> Dear Maintainer,
> 
> The arm64 kernel allows one to run aarch32 processes on an aarch64
> processor (if it has support for it), using the standard 32/64-bit
> syscall compatibility. However this compat layer does not correctly
> validate the arguments of the sigaltstack syscall.
> 

I forgot to say that the problem is reproducible with kernel 4.17.6.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

[toc] | [prev] | [next] | [standalone]


#61569

FromSteve McIntyre <steve@einval.com>
Date2018-07-25 17:30 +0200
Message-ID<wftTI-6UN-5@gated-at.bofh.it>
In reply to#61540
On Mon, Jul 23, 2018 at 09:40:33PM +0200, Aurelien Jarno wrote:
>control: affects -1 glibc
>control: found linux/4.17.6-2
>
>On 2018-07-23 21:31, Aurelien Jarno wrote:
>> Package: src:linux
>> Version: 4.9.110-1
>> Severity: normal
>> 
>> Dear Maintainer,
>> 
>> The arm64 kernel allows one to run aarch32 processes on an aarch64
>> processor (if it has support for it), using the standard 32/64-bit
>> syscall compatibility. However this compat layer does not correctly
>> validate the arguments of the sigaltstack syscall.
>> 
>
>I forgot to say that the problem is reproducible with kernel 4.17.6.

Fix proposed in https://lkml.org/lkml/2018/7/25/409 

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
You raise the blade, you make the change... You re-arrange me 'til I'm sane...

[toc] | [prev] | [next] | [standalone]


#62236

FromSteve McIntyre <steve@einval.com>
Date2018-09-26 12:50 +0200
Message-ID<wCfyh-5Vu-1@gated-at.bofh.it>
In reply to#61569
On Wed, Jul 25, 2018 at 04:25:03PM +0100, Steve McIntyre wrote:
>On Mon, Jul 23, 2018 at 09:40:33PM +0200, Aurelien Jarno wrote:
>>control: affects -1 glibc
>>control: found linux/4.17.6-2
>>
>>On 2018-07-23 21:31, Aurelien Jarno wrote:
>>> Package: src:linux
>>> Version: 4.9.110-1
>>> Severity: normal
>>> 
>>> Dear Maintainer,
>>> 
>>> The arm64 kernel allows one to run aarch32 processes on an aarch64
>>> processor (if it has support for it), using the standard 32/64-bit
>>> syscall compatibility. However this compat layer does not correctly
>>> validate the arguments of the sigaltstack syscall.
>>> 
>>
>>I forgot to say that the problem is reproducible with kernel 4.17.6.
>
>Fix proposed in https://lkml.org/lkml/2018/7/25/409 

At Will's suggestion, I've just tested that patchset locally and it
definitely fixes this problem so I've added a Tested-by: for him.

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
There's no sensation to compare with this
Suspended animation, A state of bliss

[toc] | [prev] | [next] | [standalone]


#64611

FromAurelien Jarno <aurelien@aurel32.net>
Date2019-07-29 22:30 +0200
Message-ID<ypkrn-33F-5@gated-at.bofh.it>
In reply to#62236
control: notfixed -1 linux/4.18.20-1
control: found -1 4.19.37-6

On 2018-09-26 11:41, Steve McIntyre wrote:
> On Wed, Jul 25, 2018 at 04:25:03PM +0100, Steve McIntyre wrote:
> >On Mon, Jul 23, 2018 at 09:40:33PM +0200, Aurelien Jarno wrote:
> >>control: affects -1 glibc
> >>control: found linux/4.17.6-2
> >>
> >>On 2018-07-23 21:31, Aurelien Jarno wrote:
> >>> Package: src:linux
> >>> Version: 4.9.110-1
> >>> Severity: normal
> >>> 
> >>> Dear Maintainer,
> >>> 
> >>> The arm64 kernel allows one to run aarch32 processes on an aarch64
> >>> processor (if it has support for it), using the standard 32/64-bit
> >>> syscall compatibility. However this compat layer does not correctly
> >>> validate the arguments of the sigaltstack syscall.
> >>> 
> >>
> >>I forgot to say that the problem is reproducible with kernel 4.17.6.
> >
> >Fix proposed in https://lkml.org/lkml/2018/7/25/409 
> 
> At Will's suggestion, I've just tested that patchset locally and it
> definitely fixes this problem so I've added a Tested-by: for him.
> 

The fix is composed of two patches, and only the first one went to the
stable releases. Therefore both our oldstable and stable kernels used on
the build daemons are still buggy.

The following one is still missing in at least 4.9 and 4.19:

| commit 24951465cbd279f60b1fdc2421b3694405bcff42
| Author: Will Deacon <will.deacon@arm.com>
| Date:   Wed Sep 5 15:34:43 2018 +0100
| 
|     arm64: compat: Provide definition for COMPAT_SIGMINSTKSZ
|     
|     arch/arm/ defines a SIGMINSTKSZ of 2k, so we should use the same value
|     for compat tasks.
|     
|     Cc: Arnd Bergmann <arnd@arndb.de>
|     Cc: Dominik Brodowski <linux@dominikbrodowski.net>
|     Cc: "Eric W. Biederman" <ebiederm@xmission.com>
|     Cc: Andrew Morton <akpm@linux-foundation.org>
|     Cc: Al Viro <viro@zeniv.linux.org.uk>
|     Cc: Oleg Nesterov <oleg@redhat.com>
|     Reviewed-by: Dave Martin <Dave.Martin@arm.com>
|     Reported-by: Steve McIntyre <steve.mcintyre@arm.com>
|     Tested-by: Steve McIntyre <93sam@debian.org>
|     Signed-off-by: Will Deacon <will.deacon@arm.com>
|     Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

[toc] | [prev] | [next] | [standalone]


#64610 — Processed: Re: Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes

From"Debian Bug Tracking System" <owner@bugs.debian.org>
Date2019-07-29 22:30 +0200
SubjectProcessed: Re: Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes
Message-ID<ypkrn-33F-3@gated-at.bofh.it>
In reply to#61538
Processing control commands:

> notfixed -1 linux/4.18.20-1
Bug #904385 {Done: Salvatore Bonaccorso <carnil@debian.org>} [src:linux] arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes
No longer marked as fixed in versions linux/4.18.20-1.
> found -1 4.19.37-6
Bug #904385 {Done: Salvatore Bonaccorso <carnil@debian.org>} [src:linux] arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes
Marked as found in versions linux/4.19.37-6 and reopened.

-- 
904385: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904385
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems

[toc] | [prev] | [next] | [standalone]


#64940 — Bug#904385: marked as done (arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes)

From"Debian Bug Tracking System" <owner@bugs.debian.org>
Date2019-08-26 20:00 +0200
SubjectBug#904385: marked as done (arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes)
Message-ID<yzrrA-7uy-11@gated-at.bofh.it>
In reply to#61538

[Multipart message — attachments visible in raw view] — view raw

Your message dated Mon, 26 Aug 2019 17:47:31 +0000
with message-id <E1i2J5X-0009ZE-CX@fasolo.debian.org>
and subject line Bug#904385: fixed in linux 4.9.189-1
has caused the Debian Bug report #904385,
regarding arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
904385: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904385
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web