NetBSD Problem Report #60033

From christos@astron.com  Mon Feb 23 17:26:12 2026
Return-Path: <christos@astron.com>
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 "R13" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D90F41A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 23 Feb 2026 17:26:11 +0000 (UTC)
Message-Id: <20260223171810.576BC6C28F@quasar.astron.com>
Date: Mon, 23 Feb 2026 17:18:10 +0000 (UTC)
From: christos@astron.com
Reply-To: christos@astron.com
To: gnats-bugs@NetBSD.org
Subject: sockets currently support fstat but not fchown
X-Send-Pr-Version: 3.95
X-From4GNATS: "christos@astron.com via gnats" <gnats-admin@NetBSD.org>

>Number:         60033
>Category:       kern
>Synopsis:       sockets currently support fstat but not fchown
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 23 17:30:00 +0000 2026
>Originator:     Christos Zoulas
>Release:        NetBSD 11.99.5
>Organization:
	Inconsistencies Unlimited
>Environment:
System: NetBSD quasar.astron.com 11.99.5 NetBSD 11.99.5 (QUASAR) #67: Sun Feb 1 14:39:49 EST 2026 christos@quasar.astron.com:/usr/src/sys/arch/amd64/compile/QUASAR amd64
Architecture: x86_64
Machine: amd64
>Description:
	Sockets support fstat, but not chown. There is also the question
	of fstat/fchown on local domain sockets (how it should affect
	the filesystem objects they correspond to).
>How-To-Repeat:
#include <sys/socket.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <err.h>


int
main(void)
{
	struct stat st;
	int s = socket(PF_INET, SOCK_STREAM, 0);
	if (s == -1)
		err(EXIT_FAILURE, "socket");
	if (fstat(s, &st) == -1)
		err(EXIT_FAILURE, "fstat");

	printf("uid=%d gid=%d\n", st.st_uid, st.st_gid);
	if (fchown(s, 100, 100) == -1)
		err(EXIT_FAILURE, "fchown");
	if (fstat(s, &st) == -1)
		err(EXIT_FAILURE, "fstat");

	printf("uid=%d gid=%d\n", st.st_uid, st.st_gid);
	return 0;
}
>Fix:
	Add fo_chown to struct fileops?

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.