NetBSD Problem Report #50183

From gson@gson.org  Mon Aug 31 08:17:35 2015
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 564FCA6551
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Aug 2015 08:17:35 +0000 (UTC)
Message-Id: <20150831081647.81A1C743D68@guava.gson.org>
Date: Mon, 31 Aug 2015 11:16:47 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@gnats.NetBSD.org
Subject: Executing #!-less script causes compat_freebsd errors
X-Send-Pr-Version: 3.95

>Number:         50183
>Category:       port-i386
>Synopsis:       Executing #!-less script causes compat_freebsd errors
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 31 08:20:00 +0000 2015
>Closed-Date:    Thu Aug 10 13:50:58 +0000 2017
>Last-Modified:  Thu Aug 10 13:50:58 +0000 2017
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current, source date 2015.08.30.18.20.27
>Organization:

>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:

On a freshly installed -current/i386 system, running a shell script
with no #! line causes compat_freebsd related error messages to be
printed on the console.

>How-To-Repeat:

# >true
# chmod 755 true
# ./true
kobj_checksyms, 884: [compat_freebsd]: linker error: symbol `compat_14_sys___semctl' not found
WARNING: module error: unable to affix module `compat_freebsd', error 8
kobj_checksyms, 884: [compat_freebsd]: linker error: symbol `compat_14_sys___semctl' not found
WARNING: module error: unable to affix module `compat_freebsd', error 8

>Fix:

>Release-Note:

>Audit-Trail:
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/50183: Executing #!-less script causes compat_freebsd
 errors
Date: Mon, 31 Aug 2015 05:15:34 -0500 (CDT)

 I would guess the issue with the actual subject of this PR is related to
 the default ellision of COMPAT_FREEBSD from i386 GENERIC kernels some time
 ago.

 I've seen similar errors but on my sparc systems and so far as I can
 tell only during boot (right after root file system type determination).
 I think there are other situations which trigger these messages during
 normal operation, but I don't recall now what they are.  I don't notice
 any loss of function on the system as a result, however.

 It only happens with my custom kernels from which I've removed all
 COMPAT_* options (as I don't need them for my usage).  In my case, the
 messages are as follows:

 [...]
 kobj_checksyms, 882: [compat]: linker error: symbol `esigcode' not found
 kobj_checksyms, 882: [compat]: linker error: symbol `sigcode' not found
 WARNING: module error: unable to affix module `compat', error 8
 kobj_checksyms, 882: [compat]: linker error: symbol `esigcode' not found
 kobj_checksyms, 882: [compat]: linker error: symbol `sigcode' not found
 WARNING: module error: unable to affix module `compat', error 8
 kobj_checksyms, 882: [compat]: linker error: symbol `esigcode' not found
 kobj_checksyms, 882: [compat]: linker error: symbol `sigcode' not found
 WARNING: module error: unable to affix module `compat', error 8
 kobj_checksyms, 882: [compat]: linker error: symbol `esigcode' not found
 kobj_checksyms, 882: [compat]: linker error: symbol `sigcode' not found
 WARNING: module error: unable to affix module `compat', error 8
 [...]

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, port-i386-maintainer@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	gson@gson.org (Andreas Gustafsson)
Cc: 
Subject: Re: port-i386/50183: Executing #!-less script causes compat_freebsd errors
Date: Mon, 31 Aug 2015 06:29:59 -0400

 On Aug 31, 10:20am, jdbaker@mylinuxisp.com ("John D. Baker") wrote:
 -- Subject: Re: port-i386/50183: Executing #!-less script causes compat_freeb

 | The following reply was made to PR port-i386/50183; it has been noted by GNATS.
 | 
 | From: "John D. Baker" <jdbaker@mylinuxisp.com>
 | To: gnats-bugs@NetBSD.org
 | Cc: 
 | Subject: Re: port-i386/50183: Executing #!-less script causes compat_freebsd
 |  errors
 | Date: Mon, 31 Aug 2015 05:15:34 -0500 (CDT)
 | 
 |  I would guess the issue with the actual subject of this PR is related to
 |  the default ellision of COMPAT_FREEBSD from i386 GENERIC kernels some time
 |  ago.
 |  
 |  I've seen similar errors but on my sparc systems and so far as I can
 |  tell only during boot (right after root file system type determination).
 |  I think there are other situations which trigger these messages during
 |  normal operation, but I don't recall now what they are.  I don't notice
 |  any loss of function on the system as a result, however.
 |  
 |  It only happens with my custom kernels from which I've removed all
 |  COMPAT_* options (as I don't need them for my usage).  In my case, the
 |  messages are as follows:
 |  
 |  [...]
 |  kobj_checksyms, 882: [compat]: linker error: symbol `esigcode' not found
 |  kobj_checksyms, 882: [compat]: linker error: symbol `sigcode' not found
 |  WARNING: module error: unable to affix module `compat', error 8
 |  kobj_checksyms, 882: [compat]: linker error: symbol `esigcode' not found
 |  kobj_checksyms, 882: [compat]: linker error: symbol `sigcode' not found
 |  WARNING: module error: unable to affix module `compat', error 8
 |  kobj_checksyms, 882: [compat]: linker error: symbol `esigcode' not found
 |  kobj_checksyms, 882: [compat]: linker error: symbol `sigcode' not found
 |  WARNING: module error: unable to affix module `compat', error 8
 |  kobj_checksyms, 882: [compat]: linker error: symbol `esigcode' not found
 |  kobj_checksyms, 882: [compat]: linker error: symbol `sigcode' not found
 |  WARNING: module error: unable to affix module `compat', error 8
 |  [...]

 This means that the the module is missing required symbols. You can
 repeat this ad-nauseum manually by running 'modload compat' or the name
 of the module that is failing. The fix is to add the missing symbols, files,
 dependencies etc. to the module.

 christos

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/50183: Executing #!-less script causes compat_freebsd errors
Date: Mon, 31 Aug 2015 12:30:24 +0200

 There are two issues here:

  - The default for kern.module.autoload is 1, which allows loading the
    compat_freebsd module in MODULAR kernels. There is no code dealing
    with failures properly at that level, so if the modload fails, it
    is retried next time an unidentified "binary" is executed.

  - The compat freebsd module is not loadable, which needs to be fixed.

 Another issue is maybe that we should create a module black list (for modules
 to never try auto-loading), but setting kern.module.autoload=0 in 
 /etc/sysctl.conf is a good aproximation (at least for the systems
 I admin).

 Martin

From: Andreas Gustafsson <gson@gson.org>
To: christos@zoulas.com (Christos Zoulas)
Cc: gnats-bugs@NetBSD.org,
    port-i386-maintainer@netbsd.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org,
    gson@gson.org (Andreas Gustafsson),
    jdbaker@mylinuxisp.com,
    maxv@NetBSD.org
Subject: Re: port-i386/50183: Executing #!-less script causes compat_freebsd errors
Date: Mon, 31 Aug 2015 13:44:56 +0300

 I just noticed that the error message also appears when running the 
 lib/libc/gen/posix_spawn/t_spawn tests:

   lib/libc/gen/posix_spawn/t_spawn (99/621): 6 test cases
       t_spawn_child: [0.091366s] Passed.
       t_spawn_ls: [0.048769s] Passed.
       t_spawn_missing: [0.043265s] Passed.
       t_spawn_nonexec: [0.043607s] Passed.
       t_spawn_zero: kobj_checksyms, 882: [compat_freebsd]: linker error: symbol `compat_14_sys___semctl' not found
   WARNING: module error: unable to affix module `compat_freebsd', error 8
   [0.117056s] Passed.
       t_spawnp_ls: [0.047041s] Passed.
   [0.436963s]

 Grepping for the error message in the log files from the automated
 test runs on babylon5.netbsd.org, I found that the first time the
 message appared was in

   http://releng.netbsd.org/b5reports/i386/build/2015.05.23.18.13.31/test.log

 which means the bug was introduced by the following commit by maxv:

    2015.05.23.18.13.31 maxv src/sys/arch/i386/conf/GENERIC 1.1125
    2015.05.23.18.13.31 maxv src/sys/arch/i386/conf/XEN3_DOM0 1.95
    2015.05.23.18.13.31 maxv src/sys/arch/i386/conf/XEN3_DOMU 1.67

 with the commit message:

    Disable COMPAT_FREEBSD. The implementation is poor, not well tested and
    almost irrelevant. People who need it (for tw_cli for example) can still
    recompile their kernels with this option.

    Discussed on tech-kern@

 -- 
 Andreas Gustafsson, gson@gson.org

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/50183: Executing #!-less script causes compat_freebsd
 errors
Date: Mon, 31 Aug 2015 06:39:14 -0500 (CDT)

 I realized that I had at least one machine that did not emit those
 messages.  The output of 'modstat' on all such machines indicates that
 all modules are builtins, even though they have "options MODULAR".  The
 difference appears to be that on the affected machines I eliminate
 COMPAT_SUNOS and COMPAT_SVR4, while on the unaffected machine I don't.

 I still have the SYSV IPC options enabled.  Perhaps there's an adverse
 interaction there?

 (My perspective is that if the affected machines are ever asked to
 run a SunOS 4.x or 5.x binary they've been compromised, so I eliminate
 the compatibility options.)

 I'll build a test kernel soon to see what changes elicit the behavior
 on the currently-unaffected machine.

 Apologies for hijacking the PR.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

State-Changed-From-To: open->closed
State-Changed-By: maxv@NetBSD.org
State-Changed-When: Thu, 10 Aug 2017 13:50:58 +0000
State-Changed-Why:
This issue is not triggered anymore, the COMPAT_* options that
compat_freebsd needs are turned on. Besides, compat_freebsd got removed
from the list of auto-loaded modules.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.