NetBSD Problem Report #55657

From www@netbsd.org  Sun Sep 13 20:08:50 2020
Return-Path: <www@netbsd.org>
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 B91681A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 13 Sep 2020 20:08:50 +0000 (UTC)
Message-Id: <20200913200849.919EF1A923A@mollari.NetBSD.org>
Date: Sun, 13 Sep 2020 20:08:49 +0000 (UTC)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@NetBSD.org
Subject: libsa ffs support is not endian independent
X-Send-Pr-Version: www-1.0

>Number:         55657
>Category:       lib
>Synopsis:       libsa ffs support is not endian independent
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mrg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 13 20:10:01 +0000 2020
>Closed-Date:    Thu May 27 19:59:05 +0000 2021
>Last-Modified:  Thu May 27 19:59:05 +0000 2021
>Originator:     Jared McNeill
>Release:        9.99.72
>Organization:
>Environment:
NetBSD 9.99.72 (GENERIC64) #173: Sun Sep 13 16:29:07 ADT 2020
>Description:
LIBSA_BIENDIAN_SUPPORT allows for loading opposite endian kernels than the bootloader, but the ffs code only allows for loading kernels from a partition that is the same endian as the bootloader.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: lib-bug-people->mrg
Responsible-Changed-By: mrg@NetBSD.org
Responsible-Changed-When: Tue, 11 May 2021 21:05:58 +0000
Responsible-Changed-Why:
i have a patch that is starting to work for this.  additionally to the
ufs code, the disklabel code needs bi-endian support (i have this
part working, but need to clean up, perhaps move ffs_bswap.c into
libkern.)


From: Rin Okuyama <rokuyama.rk@gmail.com>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: lib/55657 (libsa ffs support is not endian independent)
Date: Thu, 27 May 2021 17:34:03 +0900

 -------- Forwarded Message --------
 Subject: CVS commit: src/sys
 Date: Thu, 27 May 2021 06:54:45 +0000
 From: matthew green <mrg@netbsd.org>
 Reply-To: source-changes-d@NetBSD.org
 To: source-changes-full@NetBSD.org

 Module Name:	src
 Committed By:	mrg
 Date:		Thu May 27 06:54:45 UTC 2021

 Modified Files:
 	src/sys/lib/libsa: Makefile ffsv1.c ffsv2.c lfsv1.c lfsv2.c ufs.c ufs.h
 	src/sys/stand/efiboot: Makefile.efiboot version
 Added Files:
 	src/sys/lib/libsa: ffs_bswap.c

 Log Message:
 add bi-endian support to the libsa ufs reader and enable it in efiboot.

 ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
 and FS_MAGIC (moved from ufs.c #if segments.)  these are used to call
 the right (32/64 bit) ffsv1/v2 version.

 ufs.c 'struct file' gains f_swapped member.  accessors for d_magic,
 d_reclen, and d_ino are introduced (they need to be swapped.)  sfter
 reading an inode from disk, read_inode() may call ufs_dinode_swap().
 indirect block number and caches may be swapped.

 error handling in ffs_find_superblock() is cleaned up.  (size is slightly
 reduced on some ports with this part.)

 defaults for new defines added to ufs.c.  (XXX: we build ufs.c but i think
 all the consumers don't use it, and we can stop building it.)

 LFS support is not included.

 add a cut-down copy of ffs_bswap.c from the kernel.

 also enable bi-endian disklabel support in efiboot.

 most ports build and sizes compared for platforms that don't enable this
 code and all but one saw reduced code size.  booted several platforms with
 new boot code.


 To generate a diff of this commit:
 cvs rdiff -u -r1.94 -r1.95 src/sys/lib/libsa/Makefile
 cvs rdiff -u -r0 -r1.1 src/sys/lib/libsa/ffs_bswap.c
 cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libsa/ffsv1.c src/sys/lib/libsa/ffsv2.c
 cvs rdiff -u -r1.14 -r1.15 src/sys/lib/libsa/lfsv1.c \
      src/sys/lib/libsa/lfsv2.c
 cvs rdiff -u -r1.79 -r1.80 src/sys/lib/libsa/ufs.c
 cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/ufs.h
 cvs rdiff -u -r1.20 -r1.21 src/sys/stand/efiboot/Makefile.efiboot
 cvs rdiff -u -r1.24 -r1.25 src/sys/stand/efiboot/version

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

State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Thu, 27 May 2021 19:59:05 +0000
State-Changed-Why:
fixed now.


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