Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw exceptions when rule violating UDS paths been passed in. #11663

Merged
merged 1 commit into from Sep 8, 2021

Conversation

ran-su
Copy link
Contributor

@ran-su ran-su commented Sep 7, 2021

Motivation:

Currently, Netty is silently truncating all over the limit UDS paths and ignoring the sun_path's null-termination role, which hurts compatibility with other UDS clients and servers.

Modifications:

Adding a validation in the JNI code, if the UDS path is not satisfying the system limit or Linux spec throw a NativeIoException.

Result:

All UDS paths Netty can successfully bind are connectable by other programs.

Fixes #11652

There is also an alternative fix which is let the JNI layer expose the system's sun_path limit to Java. After that, the checks can be put into Java layer.

Motivation:

Currently, Netty is silently truncating all over the limit UDS paths and ignoring the `sun_path`'s null-termination role, which hurts compatibility with other UDS clients and servers.

Modifications:

Adding a validation in the JNI code, if the UDS path is not satisfying the system limit or Linux spec throw a NativeIoException.

Result:

All UDS paths Netty can successfully bind are connectable by other programs.
@normanmaurer
Copy link
Member

@ran-su can you sign the icla ?

https://netty.io/s/icla ?

@ran-su
Copy link
Contributor Author

ran-su commented Sep 7, 2021

I think so, because I submitted PR to Netty before, and I just signed it again to be sure.

@violetagg
Copy link
Member

@ran-su What about _send... methods or we do not expect that issue there?

socket_path_len = (*env)->GetArrayLength(env, socketPath);
if (socket_path_len > sizeof(addr.sun_path)) {
socket_path_len = sizeof(addr.sun_path);
}

socket_path_len = (*env)->GetArrayLength(env, socketPath);
if (socket_path_len > sizeof(addr.sun_path)) {
socket_path_len = sizeof(addr.sun_path);
}

@ran-su
Copy link
Contributor Author

ran-su commented Sep 7, 2021

I don't think the paths in _sends will cause issues as those paths are already validated during the connect process. All remote address changes are happening in doConncet() which will trigger connect()s.

@normanmaurer normanmaurer added this to the 4.1.68.Final milestone Sep 8, 2021
@normanmaurer normanmaurer merged commit a53eb80 into netty:4.1 Sep 8, 2021
normanmaurer pushed a commit that referenced this pull request Sep 8, 2021
Motivation:

Currently, Netty is silently truncating all over the limit UDS paths and ignoring the `sun_path`'s null-termination role, which hurts compatibility with other UDS clients and servers.

Modifications:

Adding a validation in the JNI code, if the UDS path is not satisfying the system limit or Linux spec throw a NativeIoException.

Result:

All UDS paths Netty can successfully bind are connectable by other programs.
laosijikaichele pushed a commit to laosijikaichele/netty that referenced this pull request Dec 16, 2021
…#11663)

Motivation:

Currently, Netty is silently truncating all over the limit UDS paths and ignoring the `sun_path`'s null-termination role, which hurts compatibility with other UDS clients and servers.

Modifications:

Adding a validation in the JNI code, if the UDS path is not satisfying the system limit or Linux spec throw a NativeIoException.

Result:

All UDS paths Netty can successfully bind are connectable by other programs.
laosijikaichele pushed a commit to laosijikaichele/netty that referenced this pull request Dec 16, 2021
…#11663)

Motivation:

Currently, Netty is silently truncating all over the limit UDS paths and ignoring the `sun_path`'s null-termination role, which hurts compatibility with other UDS clients and servers.

Modifications:

Adding a validation in the JNI code, if the UDS path is not satisfying the system limit or Linux spec throw a NativeIoException.

Result:

All UDS paths Netty can successfully bind are connectable by other programs.
raidyue pushed a commit to raidyue/netty that referenced this pull request Jul 8, 2022
…#11663)

Motivation:

Currently, Netty is silently truncating all over the limit UDS paths and ignoring the `sun_path`'s null-termination role, which hurts compatibility with other UDS clients and servers.

Modifications:

Adding a validation in the JNI code, if the UDS path is not satisfying the system limit or Linux spec throw a NativeIoException.

Result:

All UDS paths Netty can successfully bind are connectable by other programs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues on UDS path binding
3 participants