Page MenuHomeFreeBSD

linux: Fix sockopt copyout
Needs ReviewPublic

Authored by chuck on Mon, Mar 16, 6:34 PM.

Details

Reviewers
emaste
kib
markj
Summary

The Linux getsockopt did not check the size of the provided buffer when
copying out the value, leading to buffer overflows (e.g., for TCP_INFO).

Fix is to use the smaller of the option value size and the provided
buffer.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71430
Build 68313: arc lint + arc unit

Event Timeline

chuck requested review of this revision.Mon, Mar 16, 6:34 PM
sys/compat/linux/linux_socket.c
2199

Is it right to use FreeBSD-native type for socklen? Do we need e.g. linux_socklen_t, if we do not have it already?

sys/compat/linux/linux_socket.c
2199

There is a l_socklen_t in sys/amd64/linux/linux.h, but it is defined as an l_ulong. Since linux_getsockopt_args defines optlen as l_uintptr_t, perhaps this should be l_uint?

sys/compat/linux/linux_socket.c
2199

But why l_uint? It should be l_socklen_t, no?