Date: Tue, 14 Jan 2025 10:59:00 +0000 From: bugzilla-noreply@freebsd.org To: net@FreeBSD.org Subject: [Bug 173002] [net] data type size problem in if_spppsubr.c Message-ID: <bug-173002-7501-9AKPUwkdSN@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-173002-7501@https.bugs.freebsd.org/bugzilla/> References: <bug-173002-7501@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D173002 --- Comment #7 from commit-hook@FreeBSD.org --- A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D08ec14fecf6a93c0321c31ba1f0b04db6= b888f16 commit 08ec14fecf6a93c0321c31ba1f0b04db6b888f16 Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2025-01-14 10:56:49 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-01-14 10:56:49 +0000 sppp: Fix getting wrong spppreq cmd from ioctl ifr->ifr_data is supposed to point to a struct spppreq. The first member cmd of struct spppreq is int type. It was pre-read via `fueword()` befo= re a full fetching. Unfortunately an user space `struct spppreq spr` may n= ot be zeroed explicitly, on 64bit architectures `fueword()` reads 64bit wo= rd thus the garbage (extra 4 bytes) may be read into kernel space (subcmd). Prior to f9d8181868ee, `subcmd` was declared as int and assigned from `fuword()` and was implicitly converted from long to int. On 64bit litt= le endian architectures the implicitly conversion overflows (undefined bahavior) which happen to trash the garbage (the extra 4 bytes, high 32 bits) and worked, but no luck on 64bit big endian architectures. Since f9d8181868ee `subcmd` was changed to u_long then there is no conversion so we end up mismatching `subcmd` with user space's `cmd`. It is also a bit hackish to get the value of cmd via `fueword()`, inste= ad we refer to it directly from spr->cmd. This is a direct commit to stable/13 as sppp(4) no longer exists in main and stable/14. PR: 173002 Reviewed by: glebius (previous version) Fixes: f9d8181868ee Fixed yet more ioctl breakage due to the type of .= .. Differential Revision: https://reviews.freebsd.org/D47335 sys/net/if_spppsubr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-173002-7501-9AKPUwkdSN>