Thread View: muc.lists.freebsd.bugs
4 messages
4 total messages
Started by bugzilla-noreply
Fri, 27 Nov 2026 13:33
[Bug 301185] ng_netflow: ng_netflow_flow_show() bounds-checks hash_id as a signed int, so values with the high bit set index bef...
Author: bugzilla-noreply
Date: Fri, 27 Nov 2026 13:33
Date: Fri, 27 Nov 2026 13:33
104 lines
6271 bytes
6271 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301185
Bug ID: 301185
Summary: ng_netflow: ng_netflow_flow_show() bounds-checks
hash_id as a signed int, so values with the high bit
set index before the hash array and panic
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: laamalif@proton.me
ng_netflow_flow_show() stores the show command's hash_id in a
signed int and rejects the index only when that int is greater
than NBUCKETS-1 (65535). hash_id is a uint32_t, so a value with
the high bit set passes that test and priv->hash + i points
before the 65536-entry array. mtx_trylock() on that address
page-faults.
At main 69141e71f3ee the test is:
i = req->hash_id;
if (i > NBUCKETS-1)
return (EINVAL);
i is declared int. Those three lines are already in ea7e16388267
(2011-07-05), which added this show message. The function text
matches on stable/15, stable/14, releng/15.1, and releng/14.4
except MTX_WAITERS versus MTX_CONTESTED. The node registers no
ASCII show command, so ngctl cannot name it. flowctl(8) sends
NGM_NETFLOW_SHOW with hash_id 0 and walks the reply. netflow_show
sends one show, version 4, with the hash_id from argv. Creating
the node needs PRIV_NETGRAPH_CONTROL.
On 16.0-CURRENT GENERIC-KASAN amd64 (main-6edecf52def6-dirty,
built Thu Nov 26 10:23:49 UTC 2026) I loaded the stock
/boot/kernel.kasan/ng_netflow.ko. An unprivileged run failed in
NgMkSockNode with "Operation not permitted". As root, at
2026-11-26T17:47:11Z:
cc -Wall -Wextra -Werror -o /tmp/netflow_show /tmp/netflow_show.c -lnetgraph
/tmp/netflow_show 0
show version=4 hash_id=0x0 -> reply version=4 nentries=0 next_hash=0x0
/tmp/netflow_show 65535
show version=4 hash_id=0xffff -> reply version=4 nentries=0 next_hash=0x0
/tmp/netflow_show 65536
show version=4 hash_id=0x10000 -> errno 22 (Invalid argument)
/tmp/netflow_show 0x7fffffff
show version=4 hash_id=0x7fffffff -> errno 22 (Invalid argument)
/tmp/netflow_show 0x80000000 did not print. The SSH session
dropped (connection timed out, then broken pipe).
/var/crash/vmcore.8, dumptime 2026-11-26 17:47:40 UTC, panic
string "page fault". core.txt.8:
#9 0xffffffff8128fa7e in _mtx_trylock_flags_int (m=0xfffffde9595b1000, opts=0,
file=0xffffffff847fd040 <str> "/usr/src/sys/netgraph/netflow/netflow.c",
line=949) at /usr/src/sys/kern/kern_mutex.c:453
#10 0xffffffff847f8aaf in ng_netflow_flow_show () from
/boot/kernel.kasan/ng_netflow.ko
#11 0xffffffff847f3750 in ng_netflow_rcvmsg () from
/boot/kernel.kasan/ng_netflow.ko
#12 0xffffffff84805a2e in ng_apply_item () from /boot/kernel.kasan/netgraph.ko
#13 0xffffffff84805143 in ng_snd_item () from /boot/kernel.kasan/netgraph.ko
#14 0xffffffff8481b550 in ngc_send () from /boot/kernel.kasan/ng_socket.ko
#21 sys_sendto (td=0xfffffe0145361780, uap=<optimized out>) at
/usr/src/sys/kern/uipc_syscalls.c:820
Line 949 in that tree is the mtx_trylock of hsh->mtx. The panic
string is "page fault", not a KASAN report.
The attached patch compares hash_id as unsigned against NBUCKETS
before assigning it to i. I built that as ng_netflow.ko (sha256
50e51d2ea3bc2f5d677f9d3364a7c7f99f7b42ab5fa77de3850aa86a1922c928)
against the same KASAN kernel and loaded it. The same netflow_show
binary (sha256
4dead1b6d7e3552aeb8baee6f904a25d2c5dcc297719a013ccda7469a50fc411)
then returned EINVAL for 0x80000000 and 0xffffffff, and the four
values above behaved the same way. The host stayed up.
I have not run the stock fault or the patched module on
15.1-RELEASE (that run is feasible and was not done for this
report) or on 14.4-RELEASE (no 14.4 system is available here
and its ng_netflow.ko cannot load on the 15.1 boxes, so the
14.4 claim is source-level only), and I have not sent the
message from a vnet jail.
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301185] ng_netflow: ng_netflow_flow_show() bounds-checks hash_id as a signed int, so values with the high bit set index bef...
Author: bugzilla-noreply
Date: Fri, 27 Nov 2026 13:33
Date: Fri, 27 Nov 2026 13:33
16 lines
2574 bytes
2574 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301185 --- Comment #1 from laamalif@proton.me --- Created attachment 277805 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277805&action=edit compare hash_id as unsigned against NBUCKETS before the int assignment -- You are receiving this mail because: You are the assignee for the bug. -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301185] ng_netflow: ng_netflow_flow_show() bounds-checks hash_id as a signed int, so values with the high bit set index bef...
Author: bugzilla-noreply
Date: Fri, 27 Nov 2026 13:34
Date: Fri, 27 Nov 2026 13:34
18 lines
2637 bytes
2637 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301185 --- Comment #2 from laamalif@proton.me --- Created attachment 277806 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277806&action=edit reproducer: sends one NGM_NETFLOW_SHOW with the hash_id from argv; stock cases reply/EINVAL, 0x80000000 panics the unfixed module -- You are receiving this mail because: You are the assignee for the bug. -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301185] ng_netflow: ng_netflow_flow_show() bounds-checks hash_id as a signed int, so values with the high bit set index bef...
Author: bugzilla-noreply
Date: Fri, 27 Nov 2026 16:00
Date: Fri, 27 Nov 2026 16:00
16 lines
2593 bytes
2593 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301185
Mark Linimon <linimon@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|bugs@FreeBSD.org |net@FreeBSD.org
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads