Page MenuHomeFreeBSD

linux: fix linux_recvmsg() flag handling
ClosedPublic

Authored by melifaro on Jan 8 2022, 1:44 PM.
Tags
None
Referenced Files
F102989463: D33790.diff
Tue, Nov 19, 1:19 PM
Unknown Object (File)
Sun, Nov 10, 2:20 AM
Unknown Object (File)
Sat, Nov 9, 5:11 PM
Unknown Object (File)
Thu, Nov 7, 8:10 AM
Unknown Object (File)
Wed, Nov 6, 10:21 PM
Unknown Object (File)
Sun, Nov 3, 2:33 PM
Unknown Object (File)
Oct 16 2024, 8:37 PM
Unknown Object (File)
Oct 15 2024, 8:46 AM
Subscribers

Details

Summary

Currently, linux_recvmsg() code ignore all flags passed in flag function argument.
For example, it results in completely wrong behavior with MSG_PEEK.

Fix it by passing the flags in the unused msg->msg_flag parameter, following the approach used in sys_recvmsg.

Test Plan

Test code: P534

BEFORE

13:42 [1] m@devel0 ~/peek
socket(2,2,17) -> 3 | Success
bind(fd#3) -> 0 | Success
sendto(fd#4) -> 1024
recvmsg(fd#3) -> 128 | errno Success
load: 0.73  cmd: peek 1915 [sbwait] 2.22r 0.00u 0.00s 0% 1268k
mi_switch+0x157 sleepq_switch+0x107 sleepq_catch_signals+0x266 sleepq_wait_sig+0x9 _sleep+0x2dd sbwait+0x61 soreceive_dgram+0x162 soreceive+0x4b kern_recvit+0x1ba linux_recvmsg_common+0x125 linux_recvmsg+0x1c amd64_syscall+0x12e fast_syscall_common+0xf8
load: 0.73  cmd: peek 1915 [sbwait] 2.41r 0.00u 0.00s 0% 1268k
mi_switch+0x157 sleepq_switch+0x107 sleepq_catch_signals+0x266 sleepq_wait_sig+0x9 _sleep+0x2dd sbwait+0x61 soreceive_dgram+0x162 soreceive+0x4b kern_recvit+0x1ba linux_recvmsg_common+0x125 linux_recvmsg+0x1c amd64_syscall+0x12e fast_syscall_common+0xf8
load: 0.73  cmd: peek 1915 [sbwait] 2.59r 0.00u 0.00s 0% 1268k
mi_switch+0x157 sleepq_switch+0x107 sleepq_catch_signals+0x266 sleepq_wait_sig+0x9 _sleep+0x2dd sbwait+0x61 soreceive_dgram+0x162 soreceive+0x4b kern_recvit+0x1ba linux_recvmsg_common+0x125 linux_recvmsg+0x1c amd64_syscall+0x12e fast_syscall_common+0xf8
^C

AFTER

13:43 [1] m@devel0
13:43 [1] m@devel0 s kldunload linux64
13:43 [1] m@devel0 s kldload linux64
13:43 [1] m@devel0 ~/peek
socket(2,2,17) -> 3 | Success
bind(fd#3) -> 0 | Success
sendto(fd#4) -> 1024
recvmsg(fd#3) -> 128 | errno Success
recvmsg(fd#3) -> 1024 | errno Success
13:43 [1] m@devel0

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 43780
Build 40668: arc lint + arc unit

Event Timeline

melifaro retitled this revision from linux: fix linux_recvmsg() MSG_PEEK flag handling to linux: fix linux_recvmsg() flag handling.Jan 8 2022, 2:01 PM
melifaro edited the summary of this revision. (Show Details)
melifaro edited the test plan for this revision. (Show Details)
melifaro added reviewers: trasz, mjg, kib.
This revision is now accepted and ready to land.Jan 8 2022, 3:07 PM