Bug in ExtendedSocketOptions: TCP_QUICKACK can't be set in linux due to incorrect syscall level
Jaikiran Pai
jai.forums2013 at gmail.com
Wed Jun 7 10:18:49 UTC 2023
Hello Bruno,
Alan has created the JBS issue to track this. In order to submit a
patch, you can follow the guidelines that are available at
https://openjdk.org/guide/
-Jaikiran
On 07/06/23 3:20 pm, Alan Bateman wrote:
> On 07/06/2023 07:17, Bruno Da Silva wrote:
>> 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?
>>
> Good find, I've created JDK-8309591 [1] to track it. Create a PR if
> you want to run with this, otherwise someone else will need to pick
> this up.
>
> -Alan
>
> [1] https://bugs.openjdk.org/browse/JDK-8309591
More information about the net-dev
mailing list