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


Groups > linux.debian.kernel > #61538

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

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Aurelien Jarno <aurel32@debian.org>
Newsgroups linux.debian.bugs.dist, linux.debian.ports.arm, linux.debian.kernel
Subject Bug#904385: arm64: sigaltstack fails with MINSIGSTKSZ for 32-bit processes
Date Mon, 23 Jul 2018 21:40:02 +0200
Message-ID <weOQy-3Py-1@gated-at.bofh.it> (permalink)
X-Original-To Debian Bug Tracking System <submit@bugs.debian.org>
X-Mailbox-Line From debian-bugs-dist-request@lists.debian.org Mon Jul 23 19:33:11 2018
Old-Return-Path <debbugs@buxtehude.debian.org>
X-Spam-Flag NO
X-Spam-Score -2.3
Reply-To Aurelien Jarno <aurel32@debian.org>, 904385@bugs.debian.org
Resent-To debian-bugs-dist@lists.debian.org
Resent-Cc debian-arm@lists.debian.org, debian-arm@lists.debian.org, Debian Kernel Team <debian-kernel@lists.debian.org>
X-Debian-Pr-Message report 904385
X-Debian-Pr-Package src:linux
X-Debian-Pr-Source linux
X-Spam-Bayes score:0.0000 Tokens: new, 56; hammy, 150; neutral, 155; spammy, 0. spammytokens: hammytokens:0.000-+--HX-Debbugs-Cc:sk:debian-, 0.000-+--H*x:7.1.7, 0.000-+--H*UA:7.1.7, 0.000-+--H*M:reportbug, 0.000-+--H*MI:reportbug
Content-Type text/plain; charset="utf-8"
MIME-Version 1.0
Content-Transfer-Encoding base64
X-Mailer reportbug 7.1.7
X-Debian-Message from BTS
X-Mailing-List <debian-bugs-dist@lists.debian.org> archive/latest/1474351
List-ID <debian-bugs-dist.lists.debian.org>
List-URL <https://lists.debian.org/debian-bugs-dist/>
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Date Mon, 23 Jul 2018 21:31:40 +0200
X-Original-Message-ID <153237430026.2128.15229506653308037337.reportbug@arm64.local>
Xref csiph.com linux.debian.bugs.dist:909057 linux.debian.ports.arm:10998 linux.debian.kernel:61538

Cross-posted to 3 groups.

Show key headers only | View raw


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)

Back to linux.debian.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

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

csiph-web