cmd/sharefs: group-accessible permission bits
All checks were successful
Test / Create distribution (push) Successful in 1m16s
Test / Sandbox (push) Successful in 3m17s
Test / Hakurei (push) Successful in 4m21s
Test / ShareFS (push) Successful in 4m30s
Test / Sandbox (race detector) (push) Successful in 5m43s
Test / Hakurei (race detector) (push) Successful in 6m48s
Test / Flake checks (push) Successful in 1m28s

This works around the race in vfs via supplementary group.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-08 16:14:47 +09:00
parent 351d6c5a35
commit b0ba165107
3 changed files with 31 additions and 22 deletions

View File

@@ -7,8 +7,8 @@
#endif #endif
#define SHAREFS_MEDIA_RW_ID (1 << 10) - 1 /* owning gid presented to userspace */ #define SHAREFS_MEDIA_RW_ID (1 << 10) - 1 /* owning gid presented to userspace */
#define SHAREFS_PERM_DIR 0700 /* permission bits for directories presented to userspace */ #define SHAREFS_PERM_DIR 0770 /* permission bits for directories presented to userspace */
#define SHAREFS_PERM_REG 0600 /* permission bits for regular files presented to userspace */ #define SHAREFS_PERM_REG 0660 /* permission bits for regular files presented to userspace */
#define SHAREFS_FORBIDDEN_FLAGS O_DIRECT /* these open flags are cleared unconditionally */ #define SHAREFS_FORBIDDEN_FLAGS O_DIRECT /* these open flags are cleared unconditionally */
/* sharefs_private is populated by sharefs_init and contains process-wide context */ /* sharefs_private is populated by sharefs_init and contains process-wide context */

View File

@@ -8,7 +8,10 @@
description = "Alice Foobar"; description = "Alice Foobar";
password = "foobar"; password = "foobar";
uid = 1000; uid = 1000;
extraGroups = [ "wheel" ]; extraGroups = [
"wheel"
"sharefs"
];
}; };
untrusted = { untrusted = {
isNormalUser = true; isNormalUser = true;

View File

@@ -1,9 +1,14 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let
inherit (pkgs) buildGoModule;
in
{ {
environment.systemPackages = [ security.wrappers.raceattr =
let
inherit (pkgs) buildGoModule;
in
{
setuid = true;
owner = "root";
group = "root";
source = "${
(buildGoModule rec { (buildGoModule rec {
name = "raceattr"; name = "raceattr";
pname = name; pname = name;
@@ -20,5 +25,6 @@ in
go mod init hakurei.app/raceattr >& /dev/null go mod init hakurei.app/raceattr >& /dev/null
''; '';
}) })
]; }/bin/raceattr";
};
} }