NetBSD Problem Report #57784

From www@netbsd.org  Tue Dec 19 02:04:14 2023
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 201F11A9238
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 19 Dec 2023 02:04:14 +0000 (UTC)
Message-Id: <20231219020412.68A0D1A923C@mollari.NetBSD.org>
Date: Tue, 19 Dec 2023 02:04:12 +0000 (UTC)
From: 2857@gmx.de
Reply-To: 2857@gmx.de
To: gnats-bugs@NetBSD.org
Subject: iscsi-initiator crashes on sparc64
X-Send-Pr-Version: www-1.0

>Number:         57784
>Category:       port-sparc64
>Synopsis:       iscsi-initiator crashes on sparc64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sparc64-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 19 02:05:00 +0000 2023
>Closed-Date:    Sun Jan 14 16:47:30 +0000 2024
>Last-Modified:  Sun Jan 14 16:47:30 +0000 2024
>Originator:     zip100
>Release:        9.3
>Organization:
>Environment:
NetBSD tango 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug  4 15:30:37 UTC 2022  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/sparc64/compile/GENERIC sparc64
>Description:
# gdb iscsi-initiator
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "sparc64--netbsd".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from iscsi-initiator...
Reading symbols from /usr/libdata/debug//usr/sbin/iscsi-initiator.debug...
(gdb) core iscsi-initiator.core 
[New process 4]
[New process 3]
[New process 2]
[New process 1]
Core was generated by `iscsi-initiator'.
Program terminated with signal SIGBUS, Bus error.
#0  iscsi_logout_rsp_decap (header=header@entry=0x41e2fe28 "&\200", 
    rsp=rsp@entry=0x41e2fe58)
    at /usr/src/external/bsd/iscsi/lib/../dist/src/lib/protocol.c:924
924     /usr/src/external/bsd/iscsi/lib/../dist/src/lib/protocol.c: No such file or directory.
[Current thread is 1 (process 4)]
(gdb) bt full
#0  iscsi_logout_rsp_decap (header=header@entry=0x41e2fe28 "&\200", 
    rsp=rsp@entry=0x41e2fe58)
    at /usr/src/external/bsd/iscsi/lib/../dist/src/lib/protocol.c:924
        errmsg = <optimized out>
        zeros = '\000' <repeats 15 times>
#1  0x0000000040713c60 in logout_response_i (header=0x41e2fe28 "&\200", cmd=0x402d4000, 
    sess=0x40240000) at /usr/src/external/bsd/iscsi/lib/../dist/src/lib/initiator.c:2426
        logout_cmd = 0x402f4ca0
        logout_rsp = {response = 0 '\000', length = 0, tag = 11256102, StatSN = 2632582066, 
          ExpCmdSN = 2, MaxCmdSN = 2, Time2Wait = 171, Time2Retain = 49445}
        logout_cmd = <optimized out>
        logout_rsp = <optimized out>
#2  rx_worker_proc_i (arg=0x40240000)
    at /usr/src/external/bsd/iscsi/lib/../dist/src/lib/initiator.c:1748
        sess = 0x40240000
        me = 0x40240128
        header = "&\200", '\000' <repeats 15 times>, "?\301&\000\000\000\000?\352\003\262\000\000\000\002\000\000\000\002", '\000' <repeats 11 times>
        prev = <optimized out>
        ptr = <optimized out>
        tag = <optimized out>
        sess = <optimized out>
        me = <optimized out>
        arg = 0x40240000
        header = <optimized out>
        cmd = <optimized out>
        prev = <optimized out>
        ptr = <optimized out>
        tag = <optimized out>
        header = <optimized out>
        sess = 0x40240000
        me = 0x40240128
        prev = <optimized out>
        ptr = <optimized out>
        tag = <optimized out>
#3  0x0000000040b0eea8 in pthread__create_tramp (cookie=0x402ae000)
--Type <RET> for more, q to quit, c to continue without paging--c
    at /usr/src/lib/libpthread/pthread.c:592
        self = 0x402ae000
        retval = <optimized out>
        __func__ = <optimized out>
#4  0x0000000040d52f50 in _lwp_kill () from /usr/lib/libc.so.12
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 
>How-To-Repeat:
# iscsi-initiator -h server.name
Bus error (core dumped)
>Fix:
from the IRC discussion:

<@Riastradh>    923          rsp->Time2Wait = ISCSI_NTOHS(*((uint32_t *) (void *) (header + 40)));   /* Time2Wait */
<@Riastradh>    924          rsp->Time2Retain = ISCSI_NTOHS(*((uint32_t *) (void *) (header + 42))); /* Time2Retain */
<@Riastradh> Only one of those can possibly be aligned!
<@Riastradh> Wonder if that was supposed to be uint16_t, or header + 44 instead of header + 42.
<@Riastradh> https://www.rfc-editor.org/rfc/rfc7143#section-11.15
<@Riastradh> Looks like Time2Wait and Time2Retain are both supposed to be uint16_t.
<@Riastradh> ISCSI_NTOHS vs ISCSI_NTOHL is a hint here too
<@Riastradh> as is the matching logic in iscsi_logout_rsp_encap

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 19 Dec 2023 02:17:16 +0000
State-Changed-Why:
fix committed, external/bsd/iscsi/dist/src/lib/protocol.c 1.5
needs pullups to 10, 9, 8 (and maybe some more testing!)


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57784 CVS commit: src/external/bsd/iscsi/dist/src/lib
Date: Tue, 19 Dec 2023 02:16:08 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Dec 19 02:16:07 UTC 2023

 Modified Files:
 	src/external/bsd/iscsi/dist/src/lib: protocol.c

 Log Message:
 libiscsi: Fix types of Time2Wait and Time2Retain in logout decap.

 According to https://www.rfc-editor.org/rfc/rfc7143#section-11.15,
 these are both 2-byte quantities.  Loading 4-byte quantities and
 passing them through ISCSI_NTOHS might have worked by accident on
 x86, but it's not gonna fly on big-endian.  (Fortunately sparc64 is
 not just big-endian but also strict-alignment so it caught this
 problem!)

 XXX Is there an upstream for this code?  doc/3RDPARTY doesn't cite
 any easily-followed references.

 PR port-sparc64/57784

 XXX pullup-10
 XXX pullup-9
 XXX pullup-8


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/external/bsd/iscsi/dist/src/lib/protocol.c

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

State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Wed, 10 Jan 2024 22:41:22 +0000
State-Changed-Why:
pullup-10 #545 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=545
pullup-9 #1789 https://releng.netbsd.org/cgi-bin/req-9.cgi?show=1789
pullup-8 #1930 https://releng.netbsd.org/cgi-bin/req-8.cgi?show=1930


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57784 CVS commit: [netbsd-10] src/external/bsd/iscsi/dist/src/lib
Date: Sun, 14 Jan 2024 15:30:45 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Jan 14 15:30:45 UTC 2024

 Modified Files:
 	src/external/bsd/iscsi/dist/src/lib [netbsd-10]: protocol.c

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #545):

 	external/bsd/iscsi/dist/src/lib/protocol.c: revision 1.5

 libiscsi: Fix types of Time2Wait and Time2Retain in logout decap.

 According to https://www.rfc-editor.org/rfc/rfc7143#section-11.15,
 these are both 2-byte quantities.  Loading 4-byte quantities and
 passing them through ISCSI_NTOHS might have worked by accident on
 x86, but it's not gonna fly on big-endian.  (Fortunately sparc64 is
 not just big-endian but also strict-alignment so it caught this
 problem!)

 XXX Is there an upstream for this code?  doc/3RDPARTY doesn't cite
 any easily-followed references.

 PR port-sparc64/57784


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.4.42.1 src/external/bsd/iscsi/dist/src/lib/protocol.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/57784 CVS commit: [netbsd-9] src/external/bsd/iscsi/dist/src/lib
Date: Sun, 14 Jan 2024 15:31:54 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Jan 14 15:31:53 UTC 2024

 Modified Files:
 	src/external/bsd/iscsi/dist/src/lib [netbsd-9]: protocol.c

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #1789):

 	external/bsd/iscsi/dist/src/lib/protocol.c: revision 1.5

 libiscsi: Fix types of Time2Wait and Time2Retain in logout decap.

 According to https://www.rfc-editor.org/rfc/rfc7143#section-11.15,
 these are both 2-byte quantities.  Loading 4-byte quantities and
 passing them through ISCSI_NTOHS might have worked by accident on
 x86, but it's not gonna fly on big-endian.  (Fortunately sparc64 is
 not just big-endian but also strict-alignment so it caught this
 problem!)

 XXX Is there an upstream for this code?  doc/3RDPARTY doesn't cite
 any easily-followed references.

 PR port-sparc64/57784


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.4.34.1 src/external/bsd/iscsi/dist/src/lib/protocol.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/57784 CVS commit: [netbsd-8] src/external/bsd/iscsi/dist/src/lib
Date: Sun, 14 Jan 2024 15:34:58 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Jan 14 15:34:58 UTC 2024

 Modified Files:
 	src/external/bsd/iscsi/dist/src/lib [netbsd-8]: protocol.c

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #1930):

 	external/bsd/iscsi/dist/src/lib/protocol.c: revision 1.5

 libiscsi: Fix types of Time2Wait and Time2Retain in logout decap.

 According to https://www.rfc-editor.org/rfc/rfc7143#section-11.15,
 these are both 2-byte quantities.  Loading 4-byte quantities and
 passing them through ISCSI_NTOHS might have worked by accident on
 x86, but it's not gonna fly on big-endian.  (Fortunately sparc64 is
 not just big-endian but also strict-alignment so it caught this
 problem!)

 XXX Is there an upstream for this code?  doc/3RDPARTY doesn't cite
 any easily-followed references.

 PR port-sparc64/57784


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.4.24.1 src/external/bsd/iscsi/dist/src/lib/protocol.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: riastradh@NetBSD.org
State-Changed-When: Sun, 14 Jan 2024 16:47:30 +0000
State-Changed-Why:
fixed and pulled up to 10, 9, 8


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.