Bug in ExtendedSocketOptions: TCP_QUICKACK can't be set in linux due to incorrect syscall level

Bruno Da Silva bruno at bdasilva.com
Wed Jun 7 06:17:08 UTC 2023


Hi all,

Random SWE here. I've found a bug in the LinuxSocketOptions.c native
implementation of getting/setting quickack on a socket. When running
strace, the socket option that is set is actually changing the SO_PRIORITY.

This is because the syscall is incorrectly called with level=SO_SOCKET
rather than level=SOL_TCP. You can see this in the openjdk implementation
on line 92 and 105:
https://github.com/openjdk/jdk/blob/a08c5cb3f1be7a20c8f955951d1605bb8b1c1aa4/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c#L92.
It has existed since the original implementation in JDK-8145635.

I believe the fix is to change both get/set syscalls like this:
setsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &optval, sizeof (optval));
to
setsockopt(fd, SOL_TCP, TCP_QUICKACK, &optval, sizeof (optval));

The bug has existed since JDK 10 and I see it still exists in the most
recent versions of Java. It was found and tested in JDK 11.


As a non-contributor, I don't know of a way of submitting a patch or
directly reporting this bug. Can someone provide guidance on where to take
it from here?

Thank you,
Bruno Da Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/net-dev/attachments/20230607/d5d325a1/attachment.htm>


More information about the net-dev mailing list