Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/crypto/internal/sysrand/internal/seccomp/seccomp_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ struct seccomp_data {
#define SECCOMP_RET_ALLOW 0x7fff0000U
#define SECCOMP_SET_MODE_FILTER 1

#ifndef SYS_getrandom
#define SYS_getrandom -1
#endif

#ifndef SYS_seccomp
#define SYS_seccomp -1
#endif

int disable_getrandom() {
if (SYS_getrandom == -1 || SYS_seccomp == -1) {
return 3;
}
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
return 1;
}
Expand Down