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

Fix ERESTARTSYS leak to userspace #319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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