feat: add permission consent prompts, drop permitted capability mask

This commit is contained in:
daniel committed 2026-09-30 08:32:48 +02:00
1 parent c54181103f
commit ae5e84592d
25 files changed
+1632 -94

No files matched your search

+18 -1
View File
@@ -91,12 +91,16 @@ namespace Sched {
char environment[EnvironmentBytes]; // NUL-separated NAME=VALUE entries
uint32_t environmentLength;
char user[32]; // Owner user name (inherited from parent on spawn)
uint64_t permittedCaps; // Authority owned by this process
uint64_t effectiveCaps; // Authority currently usable by syscalls
uint64_t delegableCaps; // Authority this process may pass to children
int sessionId; // Process-session leader PID (inherited on spawn)
char cwd[256]; // Absolute current working directory
// First-use consent (Sched/Consent.cpp). Primary slot only.
uint64_t consentCeiling; // eligible caps the parent could have delegated at spawn
uint64_t consentDenied; // caps refused for the rest of this process's life
char imagePath[256]; // full resolved image path; name[] truncates
// Thread-local storage. fsBase is loaded into IA32_FS_BASE when
// this thread is dispatched (0 = no TLS). The tls* template fields
// live on the primary slot and describe PT_TLS so sibling threads
@@ -276,6 +280,19 @@ namespace Sched {
// Find a process by PID (returns nullptr if not found or not alive)
Process* GetProcessByPid(int pid);
// Consent support for Sched/Consent.cpp. Each validates the (subject,
// agent) pair and reads or mutates both under the scheduler lock, so a
// grant can never land on a slot that exited and was reused.
//
// The pair is valid when both are live, distinct, in the same session,
// the agent still holds CAP_COMPOSITOR and has `capability` delegable,
// and `capability` lies within the subject's consent ceiling.
bool ConsentSubjectEligible(int pid, int agentPid, uint64_t capability);
bool ApplyConsentGrant(int pid, int agentPid, uint64_t capability);
void ApplyConsentDenial(int pid, uint64_t capability);
// Fill imagePath/imageProtected for the request; false if pid is gone.
bool SnapshotConsentSubject(int pid, montauk::abi::ConsentRequest& out);
// Spawn the crashpad to report on a faulted process (pid `crasherPid`).
// Called by the exception handler when a process faults. If the crasher had
// a redirected console, the crashpad inherits its out-stream so it can print