NetBSD Problem Report #61007

From tuxi@gb-backup.localdomain  Sat Nov 14 14:33:09 2026
Return-Path: <tuxi@gb-backup.localdomain>
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 "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 27EF61A923F
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Nov 2026 14:33:09 +0000 (UTC)
Message-Id: <20261114142418.4F17A392931@gb-backup.localdomain>
Date: Sat, 14 Nov 2026 14:24:18 +0000 (GMT)
From: tuxi@gb-backup.localdomain
Reply-To: tuxifan@posteo.de
To: gnats-bugs@NetBSD.org
Subject: compat_linux: setsockopt misinterprets SOL_SOCKET as IPPROTO_ICMP
X-Send-Pr-Version: 3.95
X-From4GNATS: "tuxi@gb-backup.localdomain via gnats" <gnats-admin@NetBSD.org>

>Number:         61007
>Category:       kern
>Synopsis:       compat_linux: setsockopt misinterprets SOL_SOCKET as IPPROTO_ICMP
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 14 14:35:00 +0000 2026
>Last-Modified:  Mon Nov 16 17:45:01 +0000 2026
>Originator:     tuxifan@posteo.de
>Release:        NetBSD 11.1
>Organization:
>Environment:
System: NetBSD gb-backup 11.1 NetBSD 11.1 (GENERIC) #0: Mon Nov 2 16:34:32 UTC 2026 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	When calling setsockopt(sock_, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const char *>(&1), 4) under compat_linux the kernel (according to ktrace) interprets the call as setsockopt(5,IPPROTO_ICMP,8,0x7f7fffffc6bc,4).
>How-To-Repeat:
	Simply call setsockopt(socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP), SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const char *>(&1), 4) under compat_linux.
>Fix:
	I am not knowledgable enough on the kernel side of things to be able to come up with a fix.

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/61007 CVS commit: src/usr.bin/kdump
Date: Sun, 15 Nov 2026 17:32:54 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sun Nov 15 22:32:54 UTC 2026

 Modified Files:
 	src/usr.bin/kdump: kdump.c

 Log Message:
 PR/61007: tuxifan@posteo.de: Don't attempt to translate syscall arguments to
 names for non-native emulations


 To generate a diff of this commit:
 cvs rdiff -u -r1.152 -r1.153 src/usr.bin/kdump/kdump.c

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

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: kern/61007: compat_linux: setsockopt misinterprets SOL_SOCKET as
 IPPROTO_ICMP
Date: Sun, 15 Nov 2026 17:33:10 -0500

 This is just confusion on kdump. On linux SOL_SOCKET and IPPROTO_ICMP =
 are both 1, so the ktrace code
 can't tall the difference because it is printing the arguments before =
 the system call glue code translates them.

 christos

From: "Nils (Tuxifan)" <tuxifan@posteo.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/61007: =?UTF-8?Q?compat=5Flinux=3A=20setsockopt=20misint?=
 =?UTF-8?Q?erprets=20SOL=5FSOCKET=20as=20IPPROTO=5FICMP?=
Date: Mon, 16 Nov 2026 17:12:11 +0000

 Christos Zoulas via gnats:
 >  This is just confusion on kdump. On linux SOL_SOCKET and IPPROTO_ICMP 
 > =
 >  are both 1, so the ktrace code
 >  can't tall the difference because it is printing the arguments before 
 > =
 >  the system call glue code translates them.

 Ah, okay. I was getting a "buffer full" error in response to the call so 
 I assumed there must be something weird going on on the kernel side too.
 Or do the error codes not map properly either?

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org, tuxifan@posteo.de
Subject: Re: kern/61007: compat_linux: setsockopt misinterprets SOL_SOCKET as
 IPPROTO_ICMP
Date: Mon, 16 Nov 2026 12:40:03 -0500

 On 2026-11-16 12:15 pm, Tuxifan via gnats wrote:

 >  Ah, okay. I was getting a "buffer full" error in response to the call 
 > so
 >  I assumed there must be something weird going on on the kernel side 
 > too.
 >  Or do the error codes not map properly either?

 I think they map correctly, there is code to do that.

 christos

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 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.