NetBSD Problem Report #56878

From www@netbsd.org  Sun Jun 12 16:06:59 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_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 A2E521A921F
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 12 Jun 2022 16:06:59 +0000 (UTC)
Message-Id: <20220612160658.3171B1A923C@mollari.NetBSD.org>
Date: Sun, 12 Jun 2022 16:06:58 +0000 (UTC)
From: tgl@sss.pgh.pa.us
Reply-To: tgl@sss.pgh.pa.us
To: gnats-bugs@NetBSD.org
Subject: hppa: kernel module lua fails to load
X-Send-Pr-Version: www-1.0

>Number:         56878
>Category:       port-hppa
>Synopsis:       hppa: kernel module lua fails to load
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-hppa-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 12 16:10:00 +0000 2022
>Closed-Date:    Mon Aug 29 14:58:54 +0000 2022
>Last-Modified:  Mon Aug 29 14:58:54 +0000 2022
>Originator:     Tom Lane
>Release:        HEAD/202206101540Z
>Organization:
PostgreSQL Global Development Group
>Environment:
NetBSD sss2.sss.pgh.pa.us 9.99.97 NetBSD 9.99.97 (SD0) #1: Sat Jun 11 17:32:11 EDT 2022  tgl@nuc1.sss.pgh.pa.us:/home/tgl/netbsd-H-202206101540Z/obj.hppa/sys/arch/hppa/compile/SD0 hppa
>Description:
I noticed that /usr/tests/modules/t_klua_pr_52864 fails on HPPA, because the "lua" module won't load.  Apparently this is because it tries to compare some function pointers, but the necessary support function __canonicalize_funcptr_for_compare isn't present in the kernel environment.
>How-To-Repeat:
$ sudo modload lua
modload: lua: Exec format error
$ dmesg | tail
...
[ 65548.541189] kobj_checksyms, 994: [lua]: linker error: symbol `__canonicalize_funcptr_for_compare' not found
[ 65548.565380] WARNING: module error: unable to affix module `lua', error 8


>Fix:
Seems like either there needs to be a kernel version of __canonicalize_funcptr_for_compare, or the module needs to be fixed to not do function pointer comparison.  I've no idea how hard either one would be.

>Release-Note:

>Audit-Trail:
From: Tom Lane <tgl@sss.pgh.pa.us>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/56878: hppa: kernel module lua fails to load
Date: Sun, 12 Jun 2022 12:20:09 -0400

 Ooops, I should have assigned this to port-hppa category.

 			regards, tom lane

Responsible-Changed-From-To: kern-bug-people->port-hppa-maintainer
Responsible-Changed-By: jdolecek@NetBSD.org
Responsible-Changed-When: Sun, 12 Jun 2022 16:52:24 +0000
Responsible-Changed-Why:
Changed category to port-hppa


From: "Nick Hudson" <skrll@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56878 CVS commit: src/sys/lib/libkern/arch/hppa
Date: Mon, 13 Jun 2022 16:03:07 +0000

 Module Name:	src
 Committed By:	skrll
 Date:		Mon Jun 13 16:03:07 UTC 2022

 Modified Files:
 	src/sys/lib/libkern/arch/hppa: Makefile.inc
 Added Files:
 	src/sys/lib/libkern/arch/hppa: milli_extra.S

 Log Message:
 Provide a __canonicalize_funcptr_for_compare which only needs to return
 the passed value as the kernel doesn't do PLABELS.

 PR/56878 (hppa: kernel module lua fails to load)


 To generate a diff of this commit:
 cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libkern/arch/hppa/Makefile.inc
 cvs rdiff -u -r0 -r1.1 src/sys/lib/libkern/arch/hppa/milli_extra.S

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

State-Changed-From-To: open->pending-pullups
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Tue, 14 Jun 2022 05:59:22 +0000
State-Changed-Why:
[pullup-9 #1472]


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56878 CVS commit: [netbsd-9] src/sys/lib/libkern/arch/hppa
Date: Tue, 14 Jun 2022 10:41:19 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Tue Jun 14 10:41:19 UTC 2022

 Modified Files:
 	src/sys/lib/libkern/arch/hppa [netbsd-9]: Makefile.inc milli.S
 Added Files:
 	src/sys/lib/libkern/arch/hppa [netbsd-9]: milli_extra.S

 Log Message:
 Pull up following revision(s) (requested by skrll in ticket #1472):

 	sys/lib/libkern/arch/hppa/Makefile.inc: revision 1.13
 	sys/lib/libkern/arch/hppa/milli.S: revision 1.3
 	sys/lib/libkern/arch/hppa/milli_extra.S: revision 1.1

 Don't need $$sh_func_adrs

 Provide a __canonicalize_funcptr_for_compare which only needs to return
 the passed value as the kernel doesn't do PLABELS.
 PR/56878 (hppa: kernel module lua fails to load)


 To generate a diff of this commit:
 cvs rdiff -u -r1.12 -r1.12.34.1 src/sys/lib/libkern/arch/hppa/Makefile.inc
 cvs rdiff -u -r1.1 -r1.1.204.1 src/sys/lib/libkern/arch/hppa/milli.S
 cvs rdiff -u -r0 -r1.1.2.2 src/sys/lib/libkern/arch/hppa/milli_extra.S

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: gnats-bugs@netbsd.org
Cc: port-hppa-maintainer@netbsd.org
Subject: Re: port-hppa/56878 (hppa: kernel module lua fails to load)
Date: Wed, 15 Jun 2022 14:12:54 -0400

 Nick Hudson writes:
 > Provide a __canonicalize_funcptr_for_compare which only needs to return
 > the passed value as the kernel doesn't do PLABELS.

 Hmmm ... surely that should be

 Index: sys/lib/libkern/arch/hppa/milli_extra.S
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvsroot/src/sys/lib/libkern/arch/hppa/milli_extra.S,v
 retrieving revision 1.1
 diff -u -r1.1 milli_extra.S
 --- sys/lib/libkern/arch/hppa/milli_extra.S     13 Jun 2022 16:03:07 -0000=
       1.1
 +++ sys/lib/libkern/arch/hppa/milli_extra.S     15 Jun 2022 17:58:02 -0000
 @@ -37,6 +37,6 @@
         .entry
  =

  MILLI_ENTRY(__canonicalize_funcptr_for_compare)
 -       bv      %r0(%sp)
 +       bv      %r0(%rp)
          copy   %arg0, %ret0
  EXIT(__canonicalize_funcptr_for_compare)

 ???  I am not sure how come the lua test is managing to pass with
 your version, but what I'm seeing is that lots of the tests that
 use a rump kernel are falling over rather badly.  As an example,

 $ cd /usr/tests
 $ atf-run net/icmp/t_ping:floodping2
 ...
 tp-start: 1655314910.933652, net/icmp/t_ping, 1
 tc-start: 1655314910.934813, floodping2
 tc-se:Test program crashed; attempting to get stack trace
 tc-se:[New process 11219]
 tc-se:Core was generated by `t_ping'.
 tc-se:Program terminated with signal SIGSEGV, Segmentation fault.
 tc-se:#0  0xb0002180 in ?? ()
 tc-se:#0  0xb0002180 in ?? ()
 tc-se:#1  0xae8c9af8 in sysctl_createv (log=3D0x0, cflags=3D<optimized out=
 >, rnode=3D<optimized out>, cnode=3D0xb0001ec8, flags=3D16777729, type=3D<=
 optimized out>, namep=3D<optimized out>, descr=3D<optimized out>, func=3D<=
 optimized out>, qv=3D<optimized out>, newp=3D<optimized out>, newlen=3D<op=
 timized out>) at /home/tgl/netbsd-H-202206150250Z/usr/src/lib/librump/../.=
 ./sys/rump/../kern/kern_sysctl.c:2090
 tc-se:#2  0xae84e838 in sysctl_security_suser_setup (clog=3D0x0) at /home/=
 tgl/netbsd-H-202206150250Z/usr/src/lib/librump/../../sys/rump/../secmodel/=
 suser/secmodel_suser.c:69
 tc-se:#3  0xae8c8784 in sysctl_init () at /home/tgl/netbsd-H-202206150250Z=
 /usr/src/lib/librump/../../sys/rump/../kern/kern_sysctl.c:245
 tc-se:#4  0xae90d4c8 in rump_init_callback (cpuinit_callback=3D0x0) at /ho=
 me/tgl/netbsd-H-202206150250Z/usr/src/lib/librump/../../sys/rump/librump/r=
 umpkern/rump.c:307
 tc-se:#5  0xae90ddc0 in rump_init () at /home/tgl/netbsd-H-202206150250Z/u=
 sr/src/lib/librump/../../sys/rump/librump/rumpkern/rump.c:507
 tc-se:#6  0x0001231c in atfu_floodping2_body (tc=3D<optimized out>) at /ho=
 me/tgl/netbsd-H-202206150250Z/usr/src/tests/net/icmp/t_ping.c:253
 tc-se:#7  0xad80bc7c in atf_tc_run (tc=3D<optimized out>, resfile=3D<optim=
 ized out>) at /home/tgl/netbsd-H-202206150250Z/usr/src/external/bsd/atf/di=
 st/atf-c/tc.c:1024

 Poking about with gdb confirms that this crash is occuring at
 a function pointer comparison.  (BTW, I wonder how that code
 worked at all before this patch.)

 			regards, tom lane

From: Nick Hudson <nick.hudson@gmx.co.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>, gnats-bugs@netbsd.org
Cc: port-hppa-maintainer@netbsd.org
Subject: Re: port-hppa/56878 (hppa: kernel module lua fails to load)
Date: Wed, 15 Jun 2022 22:35:01 +0100

 On 15/06/2022 19:12, Tom Lane wrote:
 > Nick Hudson writes:
 >> Provide a __canonicalize_funcptr_for_compare which only needs to return
 >> the passed value as the kernel doesn't do PLABELS.
 >
 > Hmmm ... surely that should be
 >
 > Index: sys/lib/libkern/arch/hppa/milli_extra.S
 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 > RCS file: /cvsroot/src/sys/lib/libkern/arch/hppa/milli_extra.S,v
 > retrieving revision 1.1
 > diff -u -r1.1 milli_extra.S
 > --- sys/lib/libkern/arch/hppa/milli_extra.S     13 Jun 2022 16:03:07 -00=
 00      1.1
 > +++ sys/lib/libkern/arch/hppa/milli_extra.S     15 Jun 2022 17:58:02 -00=
 00
 > @@ -37,6 +37,6 @@
 >          .entry
 >
 >   MILLI_ENTRY(__canonicalize_funcptr_for_compare)
 > -       bv      %r0(%sp)
 > +       bv      %r0(%rp)
 >           copy   %arg0, %ret0
 >   EXIT(__canonicalize_funcptr_for_compare)

 Fixed, thanks.

 >
 > ???  I am not sure how come the lua test is managing to pass with
 > your version,

 me either... I definitely tested it and saw it pass.


 [snip]

 > Poking about with gdb confirms that this crash is occuring at
 > a function pointer comparison.  (BTW, I wonder how that code
 > worked at all before this patch.)

 Probably some more rump symbol magic, i.e. it was getting the libgcc
 version until I added the libkern version. grrrrrr rump.

 Thanks for spotting this.

 Nick

From: Tom Lane <tgl@sss.pgh.pa.us>
To: gnats-bugs@netbsd.org, Nick Hudson <nick.hudson@gmx.co.uk>
Cc: port-hppa-maintainer@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org
Subject: Re: port-hppa/56878 (hppa: kernel module lua fails to load)
Date: Wed, 15 Jun 2022 17:48:36 -0400

 Nick Hudson <nick.hudson@gmx.co.uk> writes:
 >  On 15/06/2022 19:12, Tom Lane wrote:
 >>> ???  I am not sure how come the lua test is managing to pass with
 >>> your version,

 >  me either... I definitely tested it and saw it pass.

 Yeah, it passed for me too.  But on reflection maybe that's not so
 unexplainable: the test was failing before because a function-pointer
 comparison couldn't link.  The erroneous patch did fix that, but it
 would crash if that comparison was reached at runtime.  However,
 there's no reason to assume that this test case exercises the lua
 module very thoroughly, so it's easy to believe that the comparison
 isn't reached.

 >>> Poking about with gdb confirms that this crash is occuring at
 >>> a function pointer comparison.  (BTW, I wonder how that code
 >>> worked at all before this patch.)

 >  Probably some more rump symbol magic, i.e. it was getting the libgcc
 >  version until I added the libkern version. grrrrrr rump.

 Yeah.  In connection with PR 56788, I've been trying to trace down
 whether __libc_atomic_init gets called at all in the rump environment,
 and I'm just lost in a hall of mirrors :-(.  Probably somebody with
 more familiarity with librump needs to look at that one.

 			regards, tom lane

State-Changed-From-To: pending-pullups->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Mon, 29 Aug 2022 14:58:54 +0000
State-Changed-Why:
pullups done.


>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.