Skip to content

Instantly share code, notes, and snippets.

@lovesegfault
Created April 29, 2020 19:21
Show Gist options
  • Save lovesegfault/eea023887a56698b8fad3aca128139ac to your computer and use it in GitHub Desktop.
Save lovesegfault/eea023887a56698b8fad3aca128139ac to your computer and use it in GitHub Desktop.
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 147093fa..4206a2f7 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -3002,19 +3002,19 @@ void setupSeccomp()
printError("unable to add ARM seccomp architecture; this may result in spurious build failures if running 32-bit ARM processes");
/* Prevent builders from creating setuid/setgid binaries. */
- for (int perm : { S_ISUID, S_ISGID }) {
- if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(chmod), 1,
- SCMP_A1(SCMP_CMP_MASKED_EQ, (scmp_datum_t) perm, (scmp_datum_t) perm)) != 0)
- throw SysError("unable to add seccomp rule");
-
- if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(fchmod), 1,
- SCMP_A1(SCMP_CMP_MASKED_EQ, (scmp_datum_t) perm, (scmp_datum_t) perm)) != 0)
- throw SysError("unable to add seccomp rule");
-
- if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(fchmodat), 1,
- SCMP_A2(SCMP_CMP_MASKED_EQ, (scmp_datum_t) perm, (scmp_datum_t) perm)) != 0)
- throw SysError("unable to add seccomp rule");
- }
+ // for (int perm : { S_ISUID, S_ISGID }) {
+ // if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(chmod), 1,
+ // SCMP_A1(SCMP_CMP_MASKED_EQ, (scmp_datum_t) perm, (scmp_datum_t) perm)) != 0)
+ // throw SysError("unable to add seccomp rule");
+
+ // if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(fchmod), 1,
+ // SCMP_A1(SCMP_CMP_MASKED_EQ, (scmp_datum_t) perm, (scmp_datum_t) perm)) != 0)
+ // throw SysError("unable to add seccomp rule");
+
+ // if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(fchmodat), 1,
+ // SCMP_A2(SCMP_CMP_MASKED_EQ, (scmp_datum_t) perm, (scmp_datum_t) perm)) != 0)
+ // throw SysError("unable to add seccomp rule");
+ // }
/* Prevent builders from creating EAs or ACLs. Not all filesystems
support these, and they're not allowed in the Nix store because
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment