NetBSD Problem Report #54656

From martin@duskware.de  Tue Oct 29 15:04:07 2019
Return-Path: <martin@duskware.de>
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 5E5877A24B
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 29 Oct 2019 15:04:07 +0000 (UTC)
Message-Id: <20191029150357.3E9D15CC879@emmas.aprisoft.de>
Date: Tue, 29 Oct 2019 16:03:57 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: vi crash on aarch64 since gcc 8
X-Send-Pr-Version: 3.95

>Number:         54656
>Category:       bin
>Synopsis:       vi crash on aarch64 since gcc 8
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 29 15:05:00 +0000 2019
>Closed-Date:    Sun Apr 12 17:29:40 +0000 2020
>Last-Modified:  Sun Apr 12 17:50:01 +0000 2020
>Originator:     Martin Husemann
>Release:        NetBSD 9.99.17
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD painkiller.duskware.de 9.99.17 NetBSD 9.99.17 (GENERIC64) #85: Tue Oct 29 14:45:49 CET 2019 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:
vi crashes when running external programs.

(gdb) bt
#0  0x000000020011e158 in ex_writefp (sp=sp@entry=0xfffffba1b000, 
    name=name@entry=0x20014b540 "filter", fp=0xfffffbc1d170, 
    fm=fm@entry=0xfffffbe6b118, tm=tm@entry=0x0, nlno=nlno@entry=0x0, 
    nch=nch@entry=0x0, silent=silent@entry=1)
    at /work/src/external/bsd/nvi/dist/ex/ex_write.c:305
#1  0x000000020011201c in ex_filter (sp=sp@entry=0xfffffba1b000, 
    cmdp=cmdp@entry=0xfffffbe6b050, fm=fm@entry=0xfffffbe6b118, tm=0x0, 
    tm@entry=0xfffffbe6b128, rp=rp@entry=0xffffffffde30, cmd=0x0, 
    ftype=FILTER_BANG) at /work/src/external/bsd/nvi/dist/ex/ex_filter.c:238
#2  0x000000020010f784 in ex_bang (sp=0xfffffba1b000, cmdp=0xfffffbe6b050)
    at /work/src/external/bsd/nvi/dist/ex/ex_bang.c:162
#3  0x000000020010b4ac in ex_cmd (sp=sp@entry=0xfffffba1b000)
    at /work/src/external/bsd/nvi/dist/ex/ex.c:1391
#4  0x000000020012b990 in v_ex (sp=0xfffffba1b000, vp=0xffffffffe020)
    at /work/src/external/bsd/nvi/dist/vi/v_ex.c:418
#5  0x0000000200137638 in vi (spp=0xffffffffe240)
    at /work/src/external/bsd/nvi/dist/vi/vi.c:248
#6  0x00000002001221ec in editor (wp=wp@entry=0xfffffbe6b000, 
    argc=<optimized out>, argc@entry=1, argv=<optimized out>, 
    argv@entry=0xffffffffe468)
    at /work/src/external/bsd/nvi/dist/common/main.c:136
#7  0x0000000200147258 in main (argc=1, argv=0xffffffffe468)
    at /work/src/external/bsd/nvi/dist/cl/cl_main.c:134
(gdb) x/16i $pc-16
   0x20011e148 <ex_writefp>:    stp     x19, x20, [sp, #-320]!
   0x20011e14c <ex_writefp+4>:  mov     x19, x2
   0x20011e150 <ex_writefp+8>:  ldr     w20, [x3]
   0x20011e154 <ex_writefp+12>: stp     x23, x24, [sp, #32]
=> 0x20011e158 <ex_writefp+16>: ldr     w23, [x4]
   0x20011e15c <ex_writefp+20>: str     d8, [sp, #88]
   0x20011e160 <ex_writefp+24>: fmov    d8, x1
   0x20011e164 <ex_writefp+28>: ldr     x1, [x0, #48]
   0x20011e168 <ex_writefp+32>: stp     x21, x22, [sp, #16]
   0x20011e16c <ex_writefp+36>: stp     x27, x28, [sp, #64]
   0x20011e170 <ex_writefp+40>: mov     x28, x0
   0x20011e174 <ex_writefp+44>: mov     w27, w7
   0x20011e178 <ex_writefp+48>: str     x30, [sp, #80]
   0x20011e17c <ex_writefp+52>: str     x1, [sp, #104]
   0x20011e180 <ex_writefp+56>: stp     x5, x6, [sp, #112]
   0x20011e184 <ex_writefp+60>: cbz     x5, 0x20011e190 <ex_writefp+72>
#0  0x000000020011e158 in ex_writefp (sp=sp@entry=0xfffffba1b000, 
    name=name@entry=0x20014b540 "filter", fp=0xfffffbc1d170, 
    fm=fm@entry=0xfffffbe6b118, tm=tm@entry=0x0, nlno=nlno@entry=0x0, 
    nch=nch@entry=0x0, silent=silent@entry=1)
    at /work/src/external/bsd/nvi/dist/ex/ex_write.c:305
        sb = {st_dev = 281474908540944, st_mode = 4222695696, 
          st_ino = 281474905526488, st_nlink = 4294958288, st_uid = 65535, 
          st_gid = 4222695468, st_rdev = 281474908508176, st_atim = {
            tv_sec = 281474905490120, tv_nsec = 281474904439056}, st_mtim = {
            tv_sec = 281474905490120, tv_nsec = 281474905489408}, st_ctim = {
            tv_sec = 0, tv_nsec = 281474905001240}, st_birthtim = {
            tv_sec = 281474905001240, tv_nsec = 281474903420928}, 
          st_size = 281474976702000, st_blocks = 281474907943192, 
          st_blksize = 0, st_flags = 0, st_gen = 1121984, st_spare = {2, 
            1121984}}
        gp = <optimized out>
        ccnt = <optimized out>
        fline = <optimized out>
        tline = <optimized out>
        lcnt = <optimized out>
        len = 281474976702000
        rval = <optimized out>
        msg = <optimized out>
        p = 0xfffffbe6b118 L"\001"
        f = 0x200111ff0 <ex_filter+560> ""
        flen = 6605590681088
#1  0x000000020011201c in ex_filter (sp=sp@entry=0xfffffba1b000, 
    cmdp=cmdp@entry=0xfffffbe6b050, fm=fm@entry=0xfffffbe6b118, tm=0x0, 
    tm@entry=0xfffffbe6b128, rp=rp@entry=0xffffffffde30, cmd=0x0, 
    ftype=FILTER_BANG) at /work/src/external/bsd/nvi/dist/ex/ex_filter.c:238
        ifp = <optimized out>
        ofp = 0xfffffbc1d0d8
        parent_writer_pid = 0
        utility_pid = 913
        nread = 4221622848
        input = {8, 9}
        output = {10, 11}
        rval = 0
        np = 0xfffffba0e000 "sort"
        nlen = 5
#2  0x000000020010f784 in ex_bang (sp=0xfffffba1b000, cmdp=0xfffffbe6b050)
    at /work/src/external/bsd/nvi/dist/ex/ex_bang.c:162
        ftype = <optimized out>
        ap = 0xfffffba0da00
        exp = 0xfffffba10000
        rm = {lno = 1, cno = 0}
        lno = 65535
        msg = <optimized out>
        np = 0x0
        nlen = 2304
#3  0x000000020010b4ac in ex_cmd (sp=sp@entry=0xfffffba1b000)
    at /work/src/external/bsd/nvi/dist/ex/ex.c:1391
        nret = <optimized out>
        exp = 0xfffffba10000
        ecp = <optimized out>
        gp = 0xfffffba29000
        wp = 0xfffffbe6b000
        cur = {lno = 4221677568, cno = 8591161728}
        lno = 2
        arg1_len = <optimized out>
        discard = <optimized out>
        len = <optimized out>
        flags = <optimized out>
        ltmp = 0
        at_found = <optimized out>
        gv_found = <optimized out>
        cnt = <optimized out>
        delim = <optimized out>
        isaddr = -68767744
        namelen = <optimized out>
        newscreen = <optimized out>
        notempty = <optimized out>
        tmp = <optimized out>
        vi_address = <optimized out>
        arg1 = <optimized out>
        s = <optimized out>
        p = <optimized out>
        t = 0x410180 <error: Cannot access memory at address 0x410180>
        ch = <optimized out>
        n = <optimized out>
        np = <optimized out>
#4  0x000000020012b990 in v_ex (sp=0xfffffba1b000, vp=0xffffffffe020)
    at /work/src/external/bsd/nvi/dist/vi/v_ex.c:418
        wp = 0xfffffbe6b000
        tp = <optimized out>
        do_cedit = 0
        do_resolution = 0
        ifcontinue = 65535
#5  0x0000000200137638 in vi (spp=0xffffffffe240)
    at /work/src/external/bsd/nvi/dist/vi/vi.c:248
        gp = 0xfffffba29000
        wp = 0xfffffbe6b000
        abst = {lno = 4222819484, cno = 1}
        next = 0xfffffbefd240
        sp = 0xfffffba1b000
        cmd = {key = 58, buffer = 0, character = 0, count = 0, count2 = 0, 
          ev = {q = {tqe_next = 0x0, tqe_prev = 0x0}, e_event = E_CHARACTER, 
            e_ipcom = 0, e_c = 58, e_value = K_COLON, e_val1 = 0, e_val2 = 0, 
            e_val3 = 0, e_val4 = 0, e_str1 = 0x0, e_len1 = 0, e_str2 = 0x0, 
            e_len2 = 0}, kp = 0x200150358 <vikeys+1856>, rkp = 0x0, flags = 0, 
          m_start = {lno = 4, cno = 3}, m_stop = {lno = 4, cno = 3}, 
          m_final = {lno = 4, cno = 3}}
        vp = 0xffffffffe020
        vip = 0xfffffba10500
        comcount = 0
        mapped = 0
        rval = 0
        ret = <optimized out>
#6  0x00000002001221ec in editor (wp=wp@entry=0xfffffbe6b000, 
    argc=<optimized out>, argc@entry=1, argv=<optimized out>, 
    argv@entry=0xffffffffe468)
    at /work/src/external/bsd/nvi/dist/common/main.c:136
        p = <optimized out>
        ev = {q = {tqe_next = 0xfffffba29000, tqe_prev = 0xffffffffe468}, 
          e_event = 4226199552, e_ipcom = 65535, e_c = -5535, e_value = 65535, 
          e_val1 = 281474908359484, e_val2 = 281474908536832, e_val3 = 0, 
          e_val4 = 281474908536832, e_str1 = 0x0, e_len1 = 0, e_str2 = 0x0, 
          e_len2 = 0}
        frp = <optimized out>
        sp = 0xfffffba1b000
        gp = 0xfffffba29000
        len = 0
        flags = 2
        ch = <optimized out>
        flagchk = 0
        lflag = <optimized out>
        secure = 0
        startup = 1
        readonly = <optimized out>
        rval = <optimized out>
        silent = 0
        gtags = <optimized out>
        tag_f = 0x0
        wsizearg = <optimized out>
        path = "\377\377\377\377", '\000' <repeats 60 times>, "\357", '\377' <repeats 15 times>, '\000' <repeats 16 times>, "\001", '\000' <repeats 15 times>, "\bH\000\000\000\000\000\000\001\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\370!\357\373\377\377\000\000\274G\25




>How-To-Repeat:
Start vi, enter a few lines, ESC, then:

	:%!sort

>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: Leonardo Taccari <leot@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54656: vi crash on aarch64 since gcc 8
Date: Tue, 29 Oct 2019 16:58:18 +0100

 martin@NetBSD.org writes:
 > [...]
 > >Fix:
 > n/a
 >

 As a possible workaround rebuilding vi with `-O0' do the trick.

 I have tried to collect a couple of information here (apart what Martin
 already shared I have tried to debug corresponding part of vi built
 with `-O0'):

  https://www.NetBSD.org/~leot/tmp/vi-bang-command-crash.txt

 Do not hesitate to contact me if possible further information are
 needed!

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54656 CVS commit: src/external/bsd/nvi/usr.bin/nvi
Date: Tue, 29 Oct 2019 17:14:37 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Tue Oct 29 21:14:37 UTC 2019

 Modified Files:
 	src/external/bsd/nvi/usr.bin/nvi: Makefile

 Log Message:
 PR/54656: Martin Husemann: gcc-8 miscompiles ex_filter.c even with -O1, make
 it -O0. The tm argument gets passed in as non-null and it is non-null after
 the command execution, but then becomes null and causes a null dereference.


 To generate a diff of this commit:
 cvs rdiff -u -r1.19 -r1.20 src/external/bsd/nvi/usr.bin/nvi/Makefile

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

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sat, 11 Apr 2020 13:12:14 +0000
State-Changed-Why:
I vaguely recall testing that this works without the hack. can we revert it now? I think riastradh fixed it with the surprise-it-was-fpu-kernel-code fix that also fixed a few test runs.


State-Changed-From-To: feedback->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 12 Apr 2020 17:29:40 +0000
State-Changed-Why:
Workaround removed - no longer needed.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54656 CVS commit: src/external/bsd/nvi/usr.bin/nvi
Date: Sun, 12 Apr 2020 17:28:57 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Apr 12 17:28:57 UTC 2020

 Modified Files:
 	src/external/bsd/nvi/usr.bin/nvi: Makefile

 Log Message:
 Remove no longer needed workaround for PR/54656.


 To generate a diff of this commit:
 cvs rdiff -u -r1.20 -r1.21 src/external/bsd/nvi/usr.bin/nvi/Makefile

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

From: "Leonardo Taccari" <leot@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54656 CVS commit: src/doc
Date: Sun, 12 Apr 2020 17:49:00 +0000

 Module Name:	src
 Committed By:	leot
 Date:		Sun Apr 12 17:49:00 UTC 2020

 Modified Files:
 	src/doc: HACKS

 Log Message:
 Hack removed in src/external/bsd/nvi/usr.bin/nvi/Makefile,-r1.21

 It is no longer needed, per PR bin/54656.


 To generate a diff of this commit:
 cvs rdiff -u -r1.200 -r1.201 src/doc/HACKS

 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.