NetBSD Problem Report #55486

From martin@aprisoft.de  Mon Jul 13 18:09:24 2020
Return-Path: <martin@aprisoft.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 A90631A9213
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 13 Jul 2020 18:09:24 +0000 (UTC)
Message-Id: <20200713180915.391795CC80A@emmas.aprisoft.de>
Date: Mon, 13 Jul 2020 20:09:15 +0200 (CEST)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: bootaa64.efi is broken
X-Send-Pr-Version: 3.95

>Number:         55486
>Category:       port-arm
>Synopsis:       bootaa64.efi is broken
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-arm-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 13 18:10:01 +0000 2020
>Closed-Date:    Thu Jan 21 12:40:47 +0000 2021
>Last-Modified:  Thu Jan 21 12:40:47 +0000 2021
>Originator:     Martin Husemann
>Release:        NetBSD 9.99.69
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD h-pulse.aprisoft.de 9.99.69 NetBSD 9.99.69 (GENERIC64) #138: Mon Jul 13 18:00:41 CEST 2020 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:

The efi bootloader in -current is broken for boards booting via u-boot (or
at least some). It crashes and can not boot the kernel. Using an older
boot binary makes -current work fine.

>How-To-Repeat:

Try to boot -current on something like [output from old bootloader]:

 > ver
Version: 1.13 (Mon Apr 20 12:41:34 UTC 2020) (9.99.56)
EFI: 2.70
Firmware: Das U-Boot (rev 0x20181100)
FDT: SolidRun i.MX8MQ HummingBoard Pulse [solidrun,hummingboard-pulse,fsl,imx8mq]

Also strikes on Odroid C2, haven't tried other boards.

The crashes are "random" in parts of the bootloader that have not
changed in ages, probably u-boot is loading the PE differently and
something overwrites something at runtime - or whatever.

>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: port-arm-maintainer@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: port-arm/55486: bootaa64.efi is broken
Date: Mon, 13 Jul 2020 14:24:55 -0400

 --Apple-Mail=_D8497675-F4E8-485D-8FFC-9F12566770B7
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Could that be binutils related?


 --Apple-Mail=_D8497675-F4E8-485D-8FFC-9F12566770B7
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCXwym9wAKCRBxESqxbLM7
 OiI+AJ0fSN18UYU26rJUotlIaG795e//YgCgyzKrc4a1wOzwgdPXi7iceoobaMw=
 =TvCQ
 -----END PGP SIGNATURE-----

 --Apple-Mail=_D8497675-F4E8-485D-8FFC-9F12566770B7--

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org
Cc: port-arm-maintainer@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: port-arm/55486: bootaa64.efi is broken
Date: Tue, 14 Jul 2020 07:14:47 +1000

 FWIW, i just installed a very -current efiboot on my pinebookpro
 and it works just from with it's u-boot, so the problem is not
 generic across all platforms.

From: Jared McNeill <jmcneill@invisible.ca>
To: matthew green <mrg@eterna.com.au>
Cc: gnats-bugs@netbsd.org, port-arm-maintainer@netbsd.org, 
    gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: re: port-arm/55486: bootaa64.efi is broken
Date: Mon, 13 Jul 2020 20:58:40 -0300 (ADT)

 On Tue, 14 Jul 2020, matthew green wrote:

 > FWIW, i just installed a very -current efiboot on my pinebookpro
 > and it works just from with it's u-boot, so the problem is not
 > generic across all platforms.

 Working for me on QEMU (Tianocore EDK2) and Ampere eMAG (AMI).

 Failing for me on ODROID-C2 (U-Boot).

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-arm/55486: bootaa64.efi is broken
Date: Tue, 14 Jul 2020 15:24:36 +0200

 I tested with old toolchain (using -current sources on netbsd-9) and it
 does not make a difference.

 My bet would be on a size related issue. I started with the netbsd-9 variant
 and added things from current, printing the size of the temporary elf output
 (before conversion to PE):

 OK:

    text	   data	    bss	    dec	    hex	filename
  175320	  10240	      0	 185560	  2d4d8	bootaa64.efi.so.tmp
 [9.0 + efirng]

    text	   data	    bss	    dec	    hex	filename
  175576	  10240	      0	 185816	  2d5d8	bootaa64.efi.so.tmp
 [ + dtoverlay]

    text	   data	    bss	    dec	    hex	filename
  175848	  10240	      0	 186088	  2d6e8	bootaa64.efi.so.tmp
 [ + modules]

 broken:

    text	   data	    bss	    dec	    hex	filename
  176024	  10240	      0	 186264	  2d798	bootaa64.efi.so.tmp
 [ + boot.cfg]

 [current]
    text	   data	    bss	    dec	    hex	filename
  176024	  10240	      0	 186264	  2d798	bootaa64.efi.so.tmp


 Martin

State-Changed-From-To: open->feedback
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Tue, 11 Aug 2020 07:10:04 +0000
State-Changed-Why:
Fixed by this commit?
Module Name:	src
Committed By:	jmcneill
Date:		Wed Jul 15 00:51:40 UTC 2020

Modified Files:
	src/sys/stand/efiboot: efiboot.h efidev.c efifile.c

Log Message:
Fixup OpenSimpleReadFile usage:
 - The "EFI_DEVICE_PATH **FilePath" parameter can change, so do not free
   the output. This was causing crashes on U-Boot when attempting to load
   boot.cfg, even if it didn't exist.
 - Allocate the SIMPLE_READ_FILE in advance and store a pointer to it in
   struct open_file.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/stand/efiboot/efiboot.h
cvs rdiff -u -r1.1 -r1.2 src/sys/stand/efiboot/efidev.c
cvs rdiff -u -r1.4 -r1.5 src/sys/stand/efiboot/efifile.c


State-Changed-From-To: feedback->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Thu, 21 Jan 2021 12:40:47 +0000
State-Changed-Why:
Fixed, thanks!


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