SELinuxProject / selinux-testsuite

This is the upstream SELinux testsuite which is designed as a basic set of regression tests for the SELinux kernel functionality.
GNU General Public License v2.0
54 stars 43 forks source link

BUG: fix use of uninitialized variable in sctp test #45

Closed WOnder93 closed 5 years ago

WOnder93 commented 5 years ago

The sctp_recvmsg() function passes the value of the *msg_flags argument to the recvmsg(2) system call [1], but in sctp_server.c the flags variable is never initialized. This lead to sctp_recvmsg() sometimes returning -EAGAIN, because the garbage flags sometimes marked the recvmsg(2) call as non-blocking.

Since the function allows to pass NULL in msg_flags and we do not care about the returned flags, let's just pass NULL and remove the flags variable entirely.

[1] https://github.com/sctp/lksctp-tools/blob/356de6906c5b6d563f2d0568e86e3875ad482c66/src/lib/recvmsg.c#L77

Fixes: c38b57ffdac4 ("selinux-testsuite: Add SCTP test support") Signed-off-by: Ondrej Mosnacek omosnace@redhat.com

pcmoore commented 5 years ago

I just now hit this bug on an aarch64 system; thanks for the fix!

The patch looks good to me, merged via 1c5d0ed008cfa8e6e2cb342e68dd323f77457b7a.