NetBSD Problem Report #53260

From tsutsui@ceres.dti.ne.jp  Fri May  4 03:59:29 2018
Return-Path: <tsutsui@ceres.dti.ne.jp>
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 BF1D97A1B6
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  4 May 2018 03:59:29 +0000 (UTC)
Message-Id: <201805040359.w443xOno003191@ceres.dti.ne.jp>
Date: Fri, 4 May 2018 12:59:24 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: No compat_16_sys___sigaction14 syscall in 8.0_RC1 GENERIC
X-Send-Pr-Version: 3.95

>Number:         53260
>Category:       kern
>Synopsis:       No compat_16_sys___sigaction14 syscall in 8.0_RC1 GENERIC
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pgoyette
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 04 04:00:00 +0000 2018
>Closed-Date:    Sun May 06 11:48:43 +0000 2018
>Last-Modified:  Sun May 06 11:48:43 +0000 2018
>Originator:     Izumi Tsutsui
>Release:        NetBSD 8.0_RC1
>Organization:
>Environment:
System: NetBSD mirage 8.0_RC1 NetBSD 8.0_RC1 (GENERIC.201804191727Z) i386
Architecture: i386
Machine: i386
>Description:
It looks there is no compat_16_sys___sigaction14() compat function
in NetBSD/i386 8.0_RC1 GENERIC kernel.

An old a.out in my /usr/local/bin binary dumps core:
---
% /usr/local/bin/fd

[...]

Bad system call (core dumped)
                             % 
---

ktrace(1)/kdump(1) says:
---
  2589      1 fd       RET   write 15/0xf
  2589      1 fd       CALL  ioctl(3,TIOCGWINSZ,0xbfbfeb6c)
  2589      1 fd       GIO   fd 3 read 8 bytes
       "\^^\0P\0\M^S\^B\M-d\^A"
  2589      1 fd       RET   ioctl 0
  2589      1 fd       CALL  compat_16___sigaction14(SIGALRM,0xbfbfeb64,0xbfbfeb4c)
  2589      1 fd       RET   compat_16___sigaction14 -1 errno 78 Function not implemented
  2589      1 fd       PSIG  SIGSYS SIG_DFL: code=SI_NOINFO
  2589      1 fd       NAMI  "fd.core"
---

The same binary worked on 7.1.2 GENERIC and it has the following function:
---
% strings /netbsd.712 | grep '7\.1\.2'
NetBSD 7.1.2 (GENERIC.201803151611Z)
@(#)NetBSD 7.1.2 (GENERIC.201803151611Z)
7.1.2
% nm /netbsd.712 | grep 'compat.*_sigaction'
c0a84529 T compat_13_sys_sigaction
c0a84340 T compat_16_sys___sigaction14
c0a87536 T compat_43_sigaction_to_sigvec
c0a87503 T compat_43_sigvec_to_sigaction
% 
---

8.0_RC1 GENERIC doesn't have the function:
---
% strings /netbsd | grep '8\.0_RC1'
NetBSD 8.0_RC1 (GENERIC.201804191727Z)
@(#)NetBSD 8.0_RC1 (GENERIC.201804191727Z)
8.0_RC1
% nm /netbsd | grep 'compat.*_sigaction'
c0c19a0f T compat_13_sys_sigaction
c0c1cd86 T compat_43_sigaction_to_sigvec
c0c1cd53 T compat_43_sigvec_to_sigaction
% 
---

Note strings(1) shows a bit different names about compat_16_*_sigaction14
in the 7.1.2 and 8.0_RC1 kernels:
---
% strings /netbsd.712 | grep 'compat_.*sigaction'|sort
compat_13_sys_sigaction
compat_16_sys___sigaction14
compat_43_sigaction_to_sigvec
compat_43_sigvec_to_sigaction
% strings /netbsd | grep 'compat_.*sigaction' | sort
compat_13_sigaction13
compat_13_sys_sigaction
compat_16___sigaction14
compat_43_sigaction_to_sigvec
compat_43_sigvec_to_sigaction
% 
---

>How-To-Repeat:
Exec an old a.out (around NetBSD 1.4) binaries
on NetBSD/i386 8.0_RC1 GENERIC?

>Fix:
Not investigated.

>Release-Note:

>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: port-i386/53260: No compat_16_sys___sigaction14 syscall in 8.0_RC1 GENERIC
Date: Fri, 04 May 2018 16:58:06 +1000

 this is likely caused by:

 1.22         (pgoyette 11-May-15): #ifdef _MODULE
 1.1          (ad       19-Nov-08): #ifdef COMPAT_16
 1.15         (christos 22-Jan-13): #if !defined(__amd64__) || defined(COMP=
 AT_NETBSD32)
 1.15         (christos 22-Jan-13): #define COMPAT_SIGCONTEXT

 eliding this code since netbsd-7.  (the rev 1.22 change.)

 _MODULE isn't defined in the base kernel, so only the module
 sees these symbols now.


 .mrg.

From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-i386/53260: No compat_16_sys___sigaction14 syscall in
 8.0_RC1 GENERIC
Date: Fri, 4 May 2018 15:06:45 +0800 (+08)

 I suggest the following change.  It moves the _MODULE conditional
 to surround only the variable definitions.

 Index: compat_mod.c
 ===================================================================
 RCS file: /cvsroot/src/sys/compat/common/compat_mod.c,v
 retrieving revision 1.24
 diff -u -p -r1.24 compat_mod.c
 --- compat_mod.c	5 Nov 2016 23:30:22 -0000	1.24
 +++ compat_mod.c	4 May 2018 07:04:55 -0000
 @@ -69,15 +69,15 @@ MODULE(MODULE_CLASS_EXEC, compat, NULL);

   int	ttcompat(struct tty *, u_long, void *, int, struct lwp *);

 -#ifdef _MODULE
   #ifdef COMPAT_16
   #if !defined(__amd64__) || defined(COMPAT_NETBSD32)
   #define COMPAT_SIGCONTEXT
 +#ifdef _MODULE
   extern char sigcode[], esigcode[];
   struct uvm_object *emul_netbsd_object;
 -#endif
 -#endif
   #endif /* _MODULE */
 +#endif /* !defined(__amd64__) || defined(COMPAT_NETBSD32) */
 +#endif /* COMPAT_16 */

   extern krwlock_t exec_lock;
   extern krwlock_t ttcompat_lock;

 +------------------+--------------------------+----------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
 +------------------+--------------------------+----------------------------+

Responsible-Changed-From-To: port-i386-maintainer->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Fri, 04 May 2018 07:53:15 +0000
Responsible-Changed-Why:
It's my bug, and I'm working on a fix


State-Changed-From-To: open->pending-pullups
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Fri, 04 May 2018 08:59:44 +0000
State-Changed-Why:
Pull-up request for netbsd-8 #807 submitted


From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53260 CVS commit: src/sys/compat/common
Date: Fri, 4 May 2018 08:55:25 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Fri May  4 08:55:25 UTC 2018

 Modified Files:
 	src/sys/compat/common: compat_mod.c

 Log Message:
 Clean up a stray #ifdef _MODULE - it prevented definition of
 COMPAT_SIGCONTEXT which in turn prevented building of the
 SYS_compat16_sigaction_14 code.

 Should address PR kern/53260

 XXX Pull-up to netbsd-8


 To generate a diff of this commit:
 cvs rdiff -u -r1.28 -r1.29 src/sys/compat/common/compat_mod.c

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53260 CVS commit: [netbsd-8] src/sys/compat/common
Date: Sun, 6 May 2018 09:35:33 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun May  6 09:35:33 UTC 2018

 Modified Files:
 	src/sys/compat/common [netbsd-8]: compat_mod.c

 Log Message:
 Pull up following revision(s) (requested by pgoyette in ticket #807):

 	sys/compat/common/compat_mod.c: revision 1.29

 Clean up a stray #ifdef _MODULE - it prevented definition of
 COMPAT_SIGCONTEXT which in turn prevented building of the
 SYS_compat16_sigaction_14 code.

 Should address PR kern/53260

 XXX Pull-up to netbsd-8


 To generate a diff of this commit:
 cvs rdiff -u -r1.24 -r1.24.8.1 src/sys/compat/common/compat_mod.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Sun, 06 May 2018 11:48:43 +0000
State-Changed-Why:
pullup-8 ticket #807 was committed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.