Skip to content

Conversation

@dmitrym1
Copy link

@dmitrym1 dmitrym1 commented Jan 17, 2025

Fix ERESTARTSYS leak to userspace by replacing it with the appropriate for userspace error codes. Fixes #320

@jason77-wang
Copy link

Hi, what is your change used for? what problem do you find with the current design?

@dmitrym1
Copy link
Author

Hi @jason77-wang, current code returns error 512 in case of timeout of r/w transaction and in case of blocking read of event device. This error code is undefined in userspace and it is a common practice to keep such error codes inside kernel and instead return one of defined error codes. So that programmers don't puzzle over that error code (it's non standard so it is not described anywhere) and instead have a clear understanding of why their syscall returns an error and what to do with it. It may break existing userspace apps if they explicitly expect error code 512, in this case you need either to modify code of such apps, or just don't include that change in your XDMA module build.

@jason77-wang
Copy link

Hi @jason77-wang, current code returns error 512 in case of timeout of r/w transaction and in case of blocking read of event device. This error code is undefined in userspace and it is a common practice to keep such error codes inside kernel and instead return one of defined error codes. So that programmers don't puzzle over that error code (it's non standard so it is not described anywhere) and instead have a clear understanding of why their syscall returns an error and what to do with it. It may break existing userspace apps if they explicitly expect error code 512, in this case you need either to modify code of such apps, or just don't include that change in your XDMA module build.

Got it. thanks.

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.

ERESTARTSYS (aka Error 512) should not leak to userspace

2 participants