Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

partial: add faccessat2 syscall #338

Merged
merged 2 commits into from
Oct 29, 2022
Merged

Conversation

deliciouslytyped
Copy link

This is a minimal amount of work I did to get it to work (I think.) on my system to the extent of having bash -c '[ -w /somepath ]; echo $?' work correctly.

Currently faccess2 is used (proven by strace outside of proot) on my system, which isn't implemented, and isn't translate()-ed, and so is broken.

I don't know if any behavioral modifications need to be made to handle the flags added to faccessat2 as opposed to faccessat not having them and being handled in glibc. (see the man page)

src/syscall/seccomp.c Outdated Show resolved Hide resolved
@Tuupertunut
Copy link

Tuupertunut commented May 9, 2023

This fix turns out to be quite important. All recent versions of bash use faccessat2 for its [ -w ], [ -x ] and [ -r ] tests. These test statements are in turn used in many bash scripts. Usually they are in form [ -x someprogram ] && run someprogram Notable examples are:

  • The default .bashrc in Ubuntu. It shows an error every time I login to a Ubuntu Proot. Reproduction:
user@machine:~/containers$ proot -r ubuntu-rootfs -b /etc/resolv.conf -b /proc -b /sys -b /dev -0 -w /root /bin/su --login
-bash: /usr/lib/command-not-found: No such file or directory
root@machine:~#
  • The postinstall script for an important Ubuntu package ca-certificates. In a Ubuntu Proot, apt fails to install any package that has ca-certificates as its dependency and that's quite a lot of packages.
  • The postinstall script of another core Ubuntu package dmsetup. Quite a lot of packages depend on this too.

After applying the fix in this PR, Ubuntu 22.04 now runs perfectly. It might be worth releasing this PR as a hotfix release, what do you think @oxr463 ?

@oxr463
Copy link
Collaborator

oxr463 commented May 9, 2023

Sure, I can release a new patch version soon.

@oxr463
Copy link
Collaborator

oxr463 commented May 13, 2023

New release here: https://github.com/proot-me/proot/releases/tag/v5.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants