NetBSD Problem Report #55200

From www@netbsd.org  Thu Apr 23 15:50:21 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id AE4141A9218
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 23 Apr 2020 15:50:21 +0000 (UTC)
Message-Id: <20200423155020.A8A281A924D@mollari.NetBSD.org>
Date: Thu, 23 Apr 2020 15:50:20 +0000 (UTC)
From: tnn@nygren.pp.se
Reply-To: tnn@nygren.pp.se
To: gnats-bugs@NetBSD.org
Subject: COMPAT_NETBSD32 sigaction/sigaltstack support is broken
X-Send-Pr-Version: www-1.0

>Number:         55200
>Category:       port-evbarm
>Synopsis:       COMPAT_NETBSD32 sigaction/sigaltstack support is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          pending-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 23 15:55:00 +0000 2020
>Closed-Date:    
>Last-Modified:  Sat May 02 16:30:03 +0000 2020
>Originator:     Tobias Nygren
>Release:        9.99.57
>Organization:
>Environment:
>Description:
The kernel does not correctly switch to the user defined signal stack when running 32-bit binaries on an aarch64 kernel.
>How-To-Repeat:
/* SS_ONSTACK assertion should not fail, but does. */

#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdio.h>

char mystack[SIGSTKSZ];

void handler(int signum) {
        uint8_t a;
        stack_t oss;
        if (sigaltstack(NULL, &oss) < 0)
                perror("sigaltstack");
        assert(oss.ss_flags & SS_ONSTACK);
}

int main(void) {
        stack_t s = (stack_t){.ss_sp = mystack, .ss_size = sizeof(mystack), .ss_flags = 0 };
        struct sigaction act = (struct sigaction){ .sa_handler = handler, .sa_flags = SA_ONSTACK };
        sigemptyset(&act.sa_mask);
        if (sigaltstack(&s, 0) < 0)
                perror("sigaltstack");
        if (sigaction(SIGUSR1, &act, NULL) < 0)
                perror("sigaction");
        kill(getpid(), SIGUSR1);
        sleep(1);
        return 0;
}

>Fix:
Something wrong in netbsd32_sendsig_siginfo?

>Release-Note:

>Audit-Trail:
From: "Tobias Nygren" <tnn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55200 CVS commit: src/sys/arch/aarch64/aarch64
Date: Thu, 23 Apr 2020 16:37:39 +0000

 Module Name:	src
 Committed By:	tnn
 Date:		Thu Apr 23 16:37:39 UTC 2020

 Modified Files:
 	src/sys/arch/aarch64/aarch64: netbsd32_machdep.c

 Log Message:
 fix inverted logic in NETBSD32 user signal stack handling (PR evbarm/55200)


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: tnn@NetBSD.org
State-Changed-When: Thu, 23 Apr 2020 16:44:34 +0000
State-Changed-Why:
Should be pulled up.


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: tnn@NetBSD.org
State-Changed-When: Fri, 01 May 2020 18:24:19 +0000
State-Changed-Why:
pullup-9 #883 and #884.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55200 CVS commit: [netbsd-9] src/sys/arch/aarch64/aarch64
Date: Sat, 2 May 2020 16:26:04 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat May  2 16:26:04 UTC 2020

 Modified Files:
 	src/sys/arch/aarch64/aarch64 [netbsd-9]: netbsd32_machdep.c

 Log Message:
 Pull up following revision(s) (requested by tnn in ticket #883):

 	sys/arch/aarch64/aarch64/netbsd32_machdep.c: revision 1.11

 fix inverted logic in NETBSD32 user signal stack handling (PR evbarm/55200)


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.