Visitar URL original
Throw exceptions when rule violating UDS paths been passed in. by ran-su · Pull Request #11663 · netty/netty · GitHub
Skip to content

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

Merged
normanmaurer merged 1 commit into
netty:4.1from
ran-su:uds-path-check
Sep 8, 2021
Merged

normanmaurer merged 1 commit into
netty:4.1from
ran-su:uds-path-check

Conversation

@ran-su

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

@ran-su can you sign the icla ?

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

@ran-su

ran-su commented Sep 7, 2021

Copy link
Copy Markdown
Contributor Author

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

@violetagg

Copy link
Copy Markdown
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

ran-su commented Sep 7, 2021

Copy link
Copy Markdown
Contributor Author

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