Bug 16852

Summary: recvmmsg clobbers const argument
Product: glibc Reporter: Rich Felker <bugdal>
Component: networkAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: drepper.fsp, fweimer, nodakai
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: 2.21   
Host: Target:
Build: Last reconfirmed:

Description Rich Felker 2014-04-18 01:01:47 UTC
In sysdeps/unix/sysv/linux/recvmmsg.c, the const struct timespec *tmo argument is passed directly to the Linux syscall recvmmsg which overwrites the pointed-to struct with the remaining time. If this behavior is desired, the argument needs to be changed to be a pointer-to-non-const, but the policy elsewhere (in other analogous interfaces) seems to be to suppress the kernel behavior by using a temp copy of the timeout to pass to the kernel.
Comment 1 Florian Weimer 2015-02-18 14:43:10 UTC
Shouldn't the prototype be changed instead because the interface is specific to Linux?
Comment 2 Rich Felker 2015-02-18 18:54:00 UTC
This issue was discussed somewhere else -- I don't recall exactly but it was probably the man pages list or something kernel-related -- and the feeling was that the const in glibc is wrong since this is a Linux-specific interface. I'm okay with removing const and updating documentation to reflect Linux behavior if that's what you prefer. That's what we did in musl.
Comment 3 NODA, Kai 2016-04-10 14:46:01 UTC
Already fixed in 20e5a5f aka glibc-2.21~541