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

Potential improvements to use of /dev/random on Linux/Android #451

Open
2 tasks
briansmith opened this issue Jun 3, 2024 · 5 comments
Open
2 tasks

Potential improvements to use of /dev/random on Linux/Android #451

briansmith opened this issue Jun 3, 2024 · 5 comments
Labels
documentation enhancement New feature or request

Comments

@briansmith
Copy link
Contributor

briansmith commented Jun 3, 2024

  • 1. The man page says that Linux returns ENOMEM and never EAGAIN. Since this code is Linux-specific, should we remove the EAGAIN case in the poll loop? Should we replace it with an ENOMEM case?
  • 2. The man page directs the user to note that poll may return "spurious readiness notifications" where poll indicates the file is readable when it actually isn't. Especially in the case of pre-getrandom-syscall-capable Linux versions, are such spurious readiness notifications possible? If so, this would be counter to the goal of polling but not reading /dev/random.
@briansmith
Copy link
Contributor Author

briansmith commented Jun 3, 2024

@briansmith
Copy link
Contributor Author

briansmith commented Jun 3, 2024

  • 4. The above PRs mention a few syscalls that poll() may be mapped to. ppoll_time64 is available from Linux 5.1+. Thus, people may need to update their seccomp filters to work on Linux 5.1. In any case, if we're going to document seccomp compatibliity anywhere then we should mention this in that documentation. [Edit: Addressed in PR Linux/Android: Document /dev/random polling considerations. #452].

@briansmith
Copy link
Contributor Author

briansmith commented Jun 3, 2024

@josephlr josephlr added enhancement New feature or request documentation labels Jun 4, 2024
@briansmith
Copy link
Contributor Author

briansmith commented Jun 4, 2024

@josephlr
Copy link
Member

josephlr commented Jun 4, 2024

  1. See https://github.com/llvm/llvm-project/blob/3b2df5b6ee81cf2685c95728ff1baf795051c926/compiler-rt/include/sanitizer/linux_syscall_hooks.h#L1182-L1185. When sanitizers are enabled, it seems like we should be calling __sanitizer_syscall_pre_impl_poll and __sanitizer_syscall_post_impl_poll?

It seems like they also have methods in there for read, open, and close. I'm wondering if sanitizers being enabled just requires using a libc that has been modified to make those particular calls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants