NetBSD Problem Report #60645
From www@netbsd.org Wed Aug 26 02:08:06 2026
Return-Path: <www@netbsd.org>
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 "YR2" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 39B061A923B
for <gnats-bugs@gnats.NetBSD.org>; Wed, 26 Aug 2026 02:08:06 +0000 (UTC)
Message-Id: <20260826020805.59E1A1A923C@mollari.NetBSD.org>
Date: Wed, 26 Aug 2026 02:08:05 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: nfssvc(2): arithmetic overflow in input array sizing
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
>Number: 60645
>Category: kern
>Synopsis: nfssvc(2): arithmetic overflow in input array sizing
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 26 02:10:00 +0000 2026
>Closed-Date:
>Last-Modified: Thu Sep 17 00:08:03 +0000 2026
>Originator: Taylor R Campbell
>Release: current, 11, 10, 9, ...
>Organization:
The NetBSD Filexportation, In)3^=$,*%928:5%-%76)0
>Environment:
>Description:
Unchecked multiplication for an array malloc can lead to
overflow and various downstream consequences:
343 } else if (flag & (NFSSVC_SETEXPORTSLIST | NFSSVC_REPLACEEXPORTSLIST)) {
344 struct export_args *args;
345 struct mountd_exports_list mel;
346
347 error = ops->setexports_in(&mel, argp);
348 if (error != 0)
349 return error;
350
351 args = (struct export_args *)malloc(mel.mel_nexports *
352 sizeof(struct export_args), M_TEMP, M_WAITOK);
353 error = ops->exp_in(args, mel.mel_exports, mel.mel_nexports);
https://nxr.netbsd.org/xref/src/sys/nfs/nfs_syscalls.c?r=1.165#343
>How-To-Repeat:
code inspection
export a file system too many different ways
>Fix:
set a maximum number of exports per mount point
>Release-Note:
>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60645 CVS commit: src/sys/nfs
Date: Wed, 26 Aug 2026 02:59:47 +0000
Module Name: src
Committed By: riastradh
Date: Wed Aug 26 02:59:47 UTC 2026
Modified Files:
src/sys/nfs: nfs_syscalls.c
Log Message:
nfs_syscalls.c: Sort includes.
No functional change intended.
Preparation for:
PR kern/60645: nfssvc(2): arithmetic overflow in input array sizing
To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/nfs/nfs_syscalls.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60645 CVS commit: src/sys/nfs
Date: Wed, 26 Aug 2026 03:01:25 +0000
Module Name: src
Committed By: riastradh
Date: Wed Aug 26 03:01:25 UTC 2026
Modified Files:
src/sys/nfs: nfs_export.c nfs_syscalls.c nfs_var.h
Log Message:
nfs: New sysctl node vfs.nfsd.maxexportspermount.
Limits the number of different ways a single mount point can be
exported. Default is limited to 256; can be expanded by sysctl up to
anything that won't overflow kva.
XXX Should prevent increasing it at securelevel>0.
PR kern/60645: nfssvc(2): arithmetic overflow in input array sizing
To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/nfs/nfs_export.c
cvs rdiff -u -r1.166 -r1.167 src/sys/nfs/nfs_syscalls.c
cvs rdiff -u -r1.97 -r1.98 src/sys/nfs/nfs_var.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60645 CVS commit: src/sys/nfs
Date: Wed, 26 Aug 2026 03:28:56 +0000
Module Name: src
Committed By: riastradh
Date: Wed Aug 26 03:28:56 UTC 2026
Modified Files:
src/sys/nfs: nfs_syscalls.c
Log Message:
nfs: Work around missing VM_MIN/MAX_KERNEL_ADDRESS on amd64 rump.
PR kern/60645: nfssvc(2): arithmetic overflow in input array sizing
To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/nfs/nfs_syscalls.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60645 CVS commit: src/sys/nfs
Date: Wed, 26 Aug 2026 12:48:02 +0000
Module Name: src
Committed By: riastradh
Date: Wed Aug 26 12:48:01 UTC 2026
Modified Files:
src/sys/nfs: nfs_syscalls.c
Log Message:
nfs: Work around missing VM_MIN/MAX_KERNEL_ADDRESS in rump.
Let's get the builds unbroken before making this perfect.
PR kern/60645: nfssvc(2): arithmetic overflow in input array sizing
To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/nfs/nfs_syscalls.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60645 CVS commit: src/sys/nfs
Date: Wed, 26 Aug 2026 13:28:37 +0000
Module Name: src
Committed By: riastradh
Date: Wed Aug 26 13:28:37 UTC 2026
Modified Files:
src/sys/nfs: nfs_export.c nfs_syscalls.c nfs_var.h
Log Message:
nfs: On reflection, just clamp the export_args buffer to 64 KiB.
Keep it simple, just make sure userland doesn't trigger contiguous
kva allocation of more than 64 KiB.
PR kern/60645: nfssvc(2): arithmetic overflow in input array sizing
To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/nfs/nfs_export.c
cvs rdiff -u -r1.169 -r1.170 src/sys/nfs/nfs_syscalls.c
cvs rdiff -u -r1.98 -r1.99 src/sys/nfs/nfs_var.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 17 Sep 2026 00:08:03 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-11, pullup-10
>Unformatted:
(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.