aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2024-02-10 05:02:18 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2024-02-22 01:31:39 +0000
commit99fa799a19abeb70b1034f65407c276b64709bdc (patch)
tree0cd8ff83e4d5c0fe4a0f1ccabbe01ee0efac6a87
parent452c5e9995ab4cd6c7ea230cffe0c53bfa65c1ab (diff)
downloadsrc-99fa799a19abeb70b1034f65407c276b64709bdc.tar.gz
src-99fa799a19abeb70b1034f65407c276b64709bdc.zip
linux_pwd_onexec: do not abort image activation if emul path does not exist
Instead clear the altroot, if any. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43833
-rw-r--r--sys/compat/linux/linux_util.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index 020eb57ea68e..e0c010cb5e48 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -79,22 +79,14 @@ int
linux_pwd_onexec(struct thread *td)
{
struct nameidata nd;
- struct pwd *pwd;
int error;
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path);
error = namei(&nd);
if (error != 0) {
- /*
- * Do not bother if we are in chroot or jail.
- */
- pwd = pwd_hold(td);
- if (pwd->pwd_rdir != rootvnode) {
- pwd_drop(pwd);
- return (0);
- }
- pwd_drop(pwd);
- return (error);
+ /* Do not prevent execution if altroot is non-existent. */
+ pwd_altroot(td, NULL);
+ return (0);
}
NDFREE_PNBUF(&nd);
pwd_altroot(td, nd.ni_vp);