‘--disable-chroot’ don't let guix-daemon skip the ‘personality’ call after be8aca0651 #3917
Labels
No labels
closure-size
deprecation
due-date
good first issue
help-wanted
kind
bug
kind
foreign-distro
kind
moreinfo
kind
system-test
kind
wishlist
kind
wont-fix
package
breakage
package
fix
patch-upgrade
security-fixes
team-ai
team-audio
team-beam
team-bioinformatics
team-bootstrap
team-build-tools
team-core
team-core-packages
team-cpp
team-crypto
team-documentation
team-electronics
team-emacs
team-embedded
team-games
team-gnome
team-go
team-guile
team-hare
team-haskell
team-home
team-hpc
team-hurd
team-installer
team-java
team-javascript
team-julia
team-kde
team-kernel
team-lisp
team-localization
team-lua
team-lxqt
team-mate
team-mozilla
team-ocaml
team-perl
team-python
team-qa-packages
team-qt
team-r
team-racket
team-release
team-reproduciblebuilds
team-ruby
team-rust
team-science
team-sugar
team-sysadmin
team-telephony
team-tex
team-translations
team-vcs
team-xfce
team-zig
user-reviewed
world-rebuild
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
guix/guix#3917
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm trying the GitlabCI guix ready workflow developped by Simon Josefsson https://social.sciences.re/@[email protected] at https://gitlab.com/debdistutils/guix/container
guix describeoutputs:I have no choice to run the guix daemon only using
--disable-chrootThe complete gitlab CI :
Any guix install on the CI return :
guix install: error: while setting up the child process: in phase setPersonality: cannot set personality: Operation not permittedThe full trace here :
https://gitlab.huma-num.fr/gt-notebook/wiki-website/wiki-mkdocs/-/jobs/160915
@civodul say to me on mastodon this is potentially linked to commit
be8aca065118aa4485c02f991c51bea89034defa:Hello,
Thanks for reporting it, @reycoseb! @reepca: Should
setPersonalityActionbe moved fromgetBasicSpawnPhasestogetCloneSpawnPhasesgiven that the former is used whenuseChroot == false?The reasoning behind putting
setPersonalityActionwithgetBasicSpawnPhasesis that it doesn't depend on namespaces in any way, and is nevertheless a useful per-process property to configure.If we want to disable it, this can be done by configuring
SpawnContext.setPersonatofalse, which is the default when not explicitly initialized.The reason that build.cc currently always uses
personalityon linux (as opposed to solely when impersonating a 32-bit system) is twofold: first, to setADDR_NO_RANDOMIZEandUNAME26(where available) for increased determinism, and second, because it's possible that the daemon was run with additional personality flags that could affect reproducibility, in which case they should be reset to some uniform state. Rather than check the current personality flags and reset them only if they don't match the uniform state, it was simpler to just ignore the previous personality flags and unconditionally set to the target personality flags.I had assumed that this was reasonable on the basis that the only error listed in
personality(2)isEINVAL, and there aren't any listed permission requirements. Glancing through the kernel source, I don't immediately see anything that would giveEPERM. Is there a seccomp filter or something similar in place for the container that is preventing its use? When I manually modifytest-envto run with--disable-chroot, it starts builds just fine.We could add a flag or environment variable to disable the
personalitycall, but I'd like to know why it's failing. Does it always fail withEPERM, or only when it's setting it (by passing in an argument other than0xffffffff), or only when it's actually changing it (by passing in an argument that's not0xffffffffand is also different from the current value)? Could you try runningsetarch --showandsetarch --addr-no-randomize true, wheresetarchis from the util-linux package?If the container tool you're using is blocking
personality, does it have some way to unblock it? Some brief searching online suggests that it might be specificallyADDR_NO_RANDOMIZEthat's being blocked, e.g. https://sourceware.org/pipermail/glibc-cvs/2023q2/082573.html.If so, we could perhaps modify build.cc to do a "test" call of
personalityto see if it's allowed to set that, undo it if it succeeds, and leave it out of the personality specification if it doesn't.@reepca Just checked with @reycoseb on Mastodon: @reycoseb confirms that
setarch --addr-no-randomize truealso fails withEPERMin that container.Most likely a seccomp filter installed by Docker?
I confirmed that invoking podman/buildah with
--security-opt seccomp=unconfinedworks around this, so yes indeed seccomp filter is one aspect. I'm working on updating Guix container images, I'm hopeful I got this resolved.build.cc reads:
Is that actually a good idea here? Couldn't build.cc gracefully back down and continue?
I haven't confirmed that this is the only thing causing the seccomp filter to trigger, maybe some of the other capability stuff trigger the error too.
This is now easy to reproduce:
Hi @jas,
Thanks for testing this.
I have mixed feelings here. One one hand it sounds like the right thing to do: it would save headaches to people running
guix-daemonin podman & co.On the other hand, silently ignoring
personalityerrors and similar errors that might occur while setting up the build environment would lead people to perform builds in degraded mode, with fewer reproducibility guarantees, without noticingGranted, disabling ASLR is not the most important aspect of reproducible build environments, but it’s not negligible either and it all adds up.
@civodul wrote in #3917 (comment):
Hi, I will have to do some studying in order to understand better the issue. But one thing that's not clear to me - can personality check give us something when chroot is disabled?
If yes, can we make a flag for disabling such checks for running in containers?
@Rutherther Yes, this call to
personalitydisables address space layout randomization (ASLR), thus removing one source of non-determinism, whether or not the build is being performed in a chroot.Prior to
be8aca0651,--disable-chrootwould also skip the call topersonality, but the two are not fundamentally related.Indeed this seems like a complex area. On one hand, I think the user should be able to control things, so maybe something like
--security chroot,personalityor similar? To override whatever the default logic is.On the other hand, the default logic should be sensible. If some feature is unavailable, maybe it shouldn't downgrade by default? If the above parameter existed, then the user would be able to override things, if there is a need. It is only now that we don't have that parameter that we would like it to do the right thing by default. If we can tell it what to do, the defaults could be to demand all security features.