NetBSD Problem Report #58801

From martin@duskware.de  Fri Nov  1 07:22:19 2024
Return-Path: <martin@duskware.de>
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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C0A421A9238
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  1 Nov 2024 07:22:19 +0000 (UTC)
Message-Id: <20241101072210.6E3705CC7B9@emmas.aprisoft.de>
Date: Fri,  1 Nov 2024 08:22:10 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: magic symlinks do not work for COMPAT_NETBSD32
X-Send-Pr-Version: 3.95

>Number:         58801
>Category:       kern
>Synopsis:       magic symlinks do not work for COMPAT_NETBSD32
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 01 07:25:00 +0000 2024
>Last-Modified:  Fri Nov 01 07:55:00 +0000 2024
>Originator:     Martin Husemann
>Release:        NetBSD 10.99.12
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD night-owl.duskware.de 10.99.12 NetBSD 10.99.12 (NIGHT-OWL) #2: Thu Oct 24 08:03:58 CEST 2024 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/amd64/compile/NIGHT-OWL amd64
Architecture: x86_64
Machine: amd64
>Description:

Magic symlinks (sysctl vfs.generic.magiclinks=1) do not work properly with
COMPAT_NETBSD32 binaries. The tests for @machine and @machine_arch fail.
This is not trivialy fixable as it is pretty much unclear what string the
emulation should use for that replacement, expecially in cases where
we have lots of userland variation like evbarm. E.g. a kernel compiled
for evbearmv7hf-el can execute userland compiled for evbearmv5 or
evbearmv6hf-el just fine - so what string should an aarch64 kernel use?

Fixing the amd64/i386 and sparc64&/sparc case shoule be relatively simple.

>How-To-Repeat:

install i386 or evbearmv* userland on amd64 or aarch64, chroot to it
and the do

	cd /usr/tests/ kernel && atf-run t_magic_symlinks

>Fix:
n/a

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/58801: magic symlinks do not work for COMPAT_NETBSD32
Date: Fri, 1 Nov 2024 07:51:02 -0000 (UTC)

 martin@NetBSD.org writes:

 >Magic symlinks (sysctl vfs.generic.magiclinks=1) do not work properly with
 >COMPAT_NETBSD32 binaries. The tests for @machine and @machine_arch fail.
 >This is not trivialy fixable as it is pretty much unclear what string the
 >emulation should use for that replacement, expecially in cases where
 >we have lots of userland variation like evbarm.

 That is not a problem for magic links. They should always reflect
 the values you get from sysctl.

 Native:

 # sysctl hw.machine
 hw.machine = evbarm
 # sysctl hw.machine_arch
 hw.machine_arch = aarch64

 armv7hf 32bit chroot:

 # sysctl hw.machine
 hw.machine = evbarm
 # sysctl hw.machine_arch
 hw.machine_arch = earmv7hf

 armv6hf 32bit chroot:

 # sysctl hw.machine
 hw.machine = evbarm
 # sysctl hw.machine_arch
 hw.machine_arch = earmv6hf


 Magic sylinks in netbsd32 emulation still evaluate to the native values,
 and that shouldn't be a problem to fix.

 # sysctl hw.machine
 hw.machine = evbarm
 # sysctl hw.machine_arch
 hw.machine_arch = earmv6hf
 # cat evbarm
 evbarm
 # cat earmv6hf
 earmv6hf
 # cat aarch64
 aarch64
 # ln -s @machine mymachine
 # ln -s @machine_arch myarch
 # cat mymachine
 evbarm
 # cat myarch
 aarch64

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.