Skip to content

Ignore status of killUser() process on darwin. - #66

Closed
aszlig wants to merge 1 commit into
NixOS:masterfrom
aszlig:kill-darwin
Closed

aszlig wants to merge 1 commit into
NixOS:masterfrom
aszlig:kill-darwin

Conversation

@aszlig

@aszlig aszlig commented Nov 15, 2012

Copy link
Copy Markdown
Member

Quoting from the man page of kill(2):

If pid is -1:
    If the user has super-user privileges, the signal is
    sent to all processes excluding system processes and the
    process sending the signal. If the user is not the super
    user, the signal is sent to all processes with the same
    uid as the user, excluding the process sending the
    signal. No error is returned if any process could be
    signaled.

Unfortunately this is not the case and the process sending the signal is killed as well, so we can't assume that wait() will return 0 if the process drops dead in-between.

Quoting from the man page of kill(2):

If pid is -1:
    If the user has super-user privileges, the signal is sent to all processes
    excluding system processes and the process sending the signal.  If the user
    is not the super user, the signal is sent to all processes with the same uid
    as the user, excluding the process sending the signal.  No error is returned
    if any process could be signaled.

Unfortunately this is not the case and the process sending the signal is killed
as well, so we can't assume that wait() will return 0 if the process drops dead
in-between.

Signed-off-by: aszlig <[email protected]>
@aszlig

aszlig commented Nov 15, 2012

Copy link
Copy Markdown
Member Author

@edolstra

Copy link
Copy Markdown
Member

There is a security issue here: the builder could kill the killer process before it does kill(-1), thereby preventing the builder from being killed. Thus it can stick around to interfere with other builds running under the same uid.

@aszlig

aszlig commented Feb 12, 2013

Copy link
Copy Markdown
Member Author

Which would mean that this security issue exists because of a broken kill() implementation on Darwin?
i'm not even sure if it is really broken or if my tests were faulty in some way. Unfortunately I'm not able to verify this anymore as I don't have access to a Mac OS X machine.

Maybe some Darwin people can shed some light on what's the issue here?

@aszlig

aszlig commented Mar 15, 2013

Copy link
Copy Markdown
Member Author

Closing in favour of #99.

@aszlig aszlig closed this Mar 15, 2013
meditans pushed a commit to Ericson2314/nix that referenced this pull request Aug 28, 2020
…merge

Merge NixOS#3801 Constant space `addToStoreFromDump`
edolstra referenced this pull request in DeterminateSystems/nix-src Mar 5, 2025
Bump version to 3.0.0, rename nix to determinate-nix
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 23, 2026
The nine `builtins.isXxx` primops (`isNull`, `__isFunction`, `__isInt`,
`__isFloat`, `__isString`, `__isBool`, `__isPath`, `__isAttrs`,
`__isList`) had byte-identical bodies that only varied in the
`ValueType` enum tag they compared against:

    state.forceValue(*args[0], pos);
    v.mkBool(args[0]->type() == <tag>);

Replace each `prim_isXxx` definition with a call to a single
`makeTypeCheck(ValueType target)` factory that returns a closure with
the same shape. The nine `RegisterPrimOp` registrations keep their
own names, args and docstrings - only their `.impl` is now
`makeTypeCheck(<tag>)` rather than a dedicated free function.

`fun<PrimOpFun>` (the type of `PrimOp::impl`) accepts capturing
lambdas via its `std::function`-based constructor, so no extra
trampoline is needed.

Refs candidate NixOS#66.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 23, 2026
…ards

Adds **Branch:** lines to the 30 catalog entries that landed as commits
on the four cleanup shard branches (libexpr, libstore, libutil,
nix-cli) over the previous batch.

Per-shard tally (commits on each branch beyond the previously-pushed
tip):

- libexpr (HEAD 437eea9 -> +10): NixOS#64, NixOS#66, NixOS#68, NixOS#106, NixOS#107, NixOS#109,
  NixOS#110, NixOS#112, NixOS#196, NixOS#199. Two of the original twelve were skipped on
  rule grounds: NixOS#194 (LookupPath::Elem flatten) — the candidate
  framing claimed the types were internal, but search-path.hh ships
  via install_headers, so collapsing is a public-ABI break, not a
  trivial flatten; NixOS#197 (one-arg findFile drop) — EvalState::lookupPath
  is a private member, so the candidate's "have callers pass it
  explicitly" prescription cannot apply.

- libstore (HEAD 5f5b815 -> +12): NixOS#4, NixOS#5, NixOS#6, NixOS#14, NixOS#47, NixOS#82, NixOS#114,
  NixOS#115, NixOS#119, NixOS#157, NixOS#159, NixOS#165. Several departures from the literal
  prescription, recorded in each commit body and in the per-candidate
  Branch line: NixOS#14 lifted only getRemoteFSAccessor with a
  getLocalNarCacheDir hook (left the trivial getFSAccessor overrides
  per-class); NixOS#115 extracted only the prelude (lockProfile +
  findGenerations) since two callers use stateful reverse iteration;
  NixOS#119 confirmed init's setDefault is a different shape and stayed
  out; NixOS#159 dropped the assert(!childEOF) defensive check after walking
  Goal::handleEOF producers; NixOS#165 used option (b) of the prescription
  (a new derivation-output-fwd.hh) because option (a) would have
  introduced an include cycle.

- libutil (HEAD 784a4f4 -> +3): NixOS#29, NixOS#99, NixOS#117. NixOS#29's commit body
  caveat (XDG_*_HOME / XDG_CONFIG_DIRS reads moved from per-call to
  cached) is recorded on the candidate Branch line.

- nix-cli (HEAD 48524e0 -> +5): NixOS#24, NixOS#77, NixOS#89, NixOS#91, NixOS#187. NixOS#91 shipped
  the GcRootNamer + nameForCurrent consolidation but deferred the
  candidate's addPermRootWithCounter free helper because three
  behavioural differences across call sites (rootNr increment
  position, absPath timing, printGCWarning conditions on store2 null)
  would have either changed user-visible path naming or grown the API.

STATUS.md's cleanup-branches table is updated with each shard's
expanded Addresses list, and the Status column now distinguishes the
already-pushed tips (libfetchers/libflake/libmain remain Pushed since
they got no new commits) from the four shards whose new commits are
local-only.

Push policy is explicit-only — none of the four shard branches has
been pushed past its prior tip.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 24, 2026
The nine `builtins.isXxx` primops (`isNull`, `__isFunction`, `__isInt`,
`__isFloat`, `__isString`, `__isBool`, `__isPath`, `__isAttrs`,
`__isList`) had byte-identical bodies that only varied in the
`ValueType` enum tag they compared against:

    state.forceValue(*args[0], pos);
    v.mkBool(args[0]->type() == <tag>);

Replace each `prim_isXxx` definition with a call to a single
`makeTypeCheck(ValueType target)` factory that returns a closure with
the same shape. The nine `RegisterPrimOp` registrations keep their
own names, args and docstrings - only their `.impl` is now
`makeTypeCheck(<tag>)` rather than a dedicated free function.

`fun<PrimOpFun>` (the type of `PrimOp::impl`) accepts capturing
lambdas via its `std::function`-based constructor, so no extra
trampoline is needed.

Refs candidate NixOS#66.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
roberth added a commit to roberth/nix that referenced this pull request Aug 9, 2026
Task NixOS#66 targeted argCdiHex specifically, but the audit turned up
peers: initialCdi, childCdi (locals), getCdi() (method on
OuterObject / TracingCallbackArg), plus scattered "CDI" / "CID" /
"CDIs" / "CIDs" in comments. All refer to what the vocabulary now
calls a state hash.

Renames:
  argCdiHex (local)      → argSubjectHashHex
  initialCdi (local)     → initialStateHash
  childCdi (test locals) → childStateHash
  getCdi() (method)      → getStateHash()
  CDI[s] / CID[s] (prose) → state hash[es]

No behaviour change. Tests green (325/0/7).

Assisted-by: Claude Code (Claude Opus 4.6-4.7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants