NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60880: compat_netbsd32 does not deal properly with timeval args to setsockopt()



>Number:         60880
>Category:       kern
>Synopsis:       compat_netbsd32 does not deal properly with timeval args to setsockopt()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 15 11:55:00 +0000 2026
>Originator:     Martin Husemann
>Release:        NetBSD 11.99.9
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD seven-days-to-the-wolves.aprisoft.de 11.99.9 NetBSD 11.99.9 (GENERIC) #904: Thu Oct 15 09:52:21 CEST 2026 martin%seven-days-to-the-wolves.aprisoft.de@localhost:/work/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

Running 32bit ATF tests on a 64bit kernel leads to failure in
/usr/tests/usr.sbin/inetd/t_inetd in the test_ratelimit test case.

It calls:

        CHECK_ERROR(setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout,
            sizeof(timeout)));

and that is handled in netbsd32_setsockopt() by translating all arguments
and then blindly forwarding to the native setsockopt:

        return sys_setsockopt(l, &ua, retval);

which in this case (I guess) ends up in 

	sockopt_get() being called from sosetop1()

with &tv and sizeof(tv).

sockopt_get verifies the valsize (32bit sizeof(struct timeval)) against
native sizeof(struct timeval) and  fails the call with EINVAL.

>How-To-Repeat:

cd /usr/tests/usr.sbin/inetd && ./t_inetd test_ratelimit

>Fix:
yes please




Home | Main Index | Thread Index | Old Index