From: Paul Barker <paul@pbarker.dev>
To: Dmitry Sakhonchik <frezidok1@gmail.com>
Cc: yocto-patches@lists.yoctoproject.org
Subject: Re: [pseudo] [PATCH v3 1/6] ports/linux/guts: Add open_tree wrapper
Date: Fri, 02 Oct 2026 13:15:01 +0100 [thread overview]
Message-ID: <40c181bbc8e01ae3b4a74b4dc0d82d6a683e10c5.camel@pbarker.dev> (raw)
In-Reply-To: <CAP4GjN5Ti1jQT61PSg9oasO_c7pOwyL80Ek6KsQkZ6LTM=rndQ@mail.gmail.com>
Hi Dmitry,
Apologies for the slow replies here, we're all busy and pseudo is
under-maintained.
On Mon, 2026-09-21 at 14:12 +0300, Dmitry Sakhonchik wrote:
> пн, 21 сент. 2026 г. в 12:28, Paul Barker <paul@pbarker.dev>:
>
> > On Mon, 2026-09-07 at 14:18 +0300, frezidok1@gmail.com wrote:
> > > From: Dmitry Sakhonchik <frezidok1@gmail.com>
> > >
> > > [YOCTO #16379]
> > >
> > > OPEN_TREE_CLONE is not handled since it requires CAP_SYS_ADMIN and is
> > outside the common pseudo use case.
> >
> > We should at least log an error if OPEN_TREE_CLONE is seen instead of
> > silently ignoring it.
> >
> > >
> > > Signed-off-by: Dmitry Sakhonchik <frezidok1@gmail.com>
> > > ---
> > > ports/linux/guts/open_tree.c | 46 ++++++++++++++++++++++++++++++++++++
> > > ports/linux/portdefs.h | 9 +++++++
> > > ports/linux/wrapfuncs.in | 1 +
> > > 3 files changed, 56 insertions(+)
> > > create mode 100644 ports/linux/guts/open_tree.c
> > >
> > > diff --git a/ports/linux/guts/open_tree.c b/ports/linux/guts/open_tree.c
> > > new file mode 100644
> > > index 0000000..6c2aad9
> > > --- /dev/null
> > > +++ b/ports/linux/guts/open_tree.c
> > > @@ -0,0 +1,46 @@
> > > +/*
> > > + * Copyright (c) 2026 Yocto Project
> > > + * guts/COPYRIGHT for information.
> > > + *
> > > + * SPDX-License-Identifier: LGPL-2.1-only
> > > + *
> > > + * int open_tree(int dirfd, const char *path, unsigned int flags)
> > > + * int rc = -1;
> > > + */
> > > +
> > > + struct stat64 buf;
> > > + int save_errno;
> > > + char *pseudo_path;
> > > +
> > > + if (real_open_tree) {
> > > + pseudo_debug(PDBGF_SYSCALL, "open_tree, calling
> > open_tree.\n");
> > > + rc = real_open_tree(dirfd, path, flags);
> > > + } else {
> > > + pseudo_debug(PDBGF_SYSCALL, "open_tree, calling
> > syscall.\n");
> > > + rc = real_syscall(SYS_open_tree, dirfd, path, flags);
> > > + }
> >
> > The commit message or a comment should briefly explain why we need to
> > handle both ways of invoking the real open_tree syscall.
> >
> > > +
> > > + pseudo_path = pseudo_root_path(__func__, __LINE__, dirfd, path, 0);
> >
> > This should be after the (rc != -1) conditional, as this call could
> > clobber errno.
> >
> > If we use preserve_path=1, then the absolute path must go through
> pseudo_root_path before the real open_tree call so that a possible chroot
> is handled correctly.
> So I think these two cases need to be somehow handled separately rather
> than moving pseudo_root_path() entirely below the rc != -1 check.
> By the way, for some reason the openat2 wrapper is ok with the
> pseudo_root_path outside of conditional.
The problem is that the real open_tree() call could set errno if it
fails, and calling pseudo_root_path() after this before returning the
error could overwrite errno. It is safe to call pseudo_root_path()
before calling the real open_tree(), or to only call it if the real
open_tree() call succeeds.
Best regards,
--
Paul Barker
next prev parent reply other threads:[~2026-10-06 7:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 11:18 [pseudo] [PATCH v3 0/6] Add open_tree() wrapper frezidok1
2026-09-07 11:18 ` [pseudo] [PATCH v3 1/6] ports/linux/guts: Add open_tree wrapper frezidok1
2026-09-21 9:28 ` Paul Barker
2026-09-21 11:12 ` Dmitry Sakhonchik
2026-10-02 12:15 ` Paul Barker [this message]
2026-09-07 11:18 ` [pseudo] [PATCH v3 2/6] test: Add open_tree test frezidok1
2026-09-21 9:09 ` Paul Barker
2026-09-21 9:38 ` Dmitry Sakhonchik
2026-10-02 12:16 ` Paul Barker
2026-09-07 11:18 ` [pseudo] [PATCH v3 3/6] ports/linux/pseudo_wrappers.c: Add syscall support for open_tree() wrapper frezidok1
2026-09-21 9:10 ` Paul Barker
2026-09-07 11:18 ` [pseudo] [PATCH v3 4/6] test: Add open_tree syscall test frezidok1
2026-09-07 11:18 ` [pseudo] [PATCH v3 5/6] test: Add open_tree_attr " frezidok1
2026-09-07 11:18 ` [pseudo] [PATCH v3 6/6] ports/linux/guts: Add open_tree_attr wrapper frezidok1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40c181bbc8e01ae3b4a74b4dc0d82d6a683e10c5.camel@pbarker.dev \
--to=paul@pbarker.dev \
--cc=frezidok1@gmail.com \
--cc=yocto-patches@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.