[PATCH v2 0/7] [PIDNS] Final
Dmitry V. Levin
ldv at altlinux.org
Thu Jul 23 22:45:14 UTC 2020
On Fri, Jul 24, 2020 at 12:43:36AM +0300, Dmitry V. Levin wrote:
> On Thu, Jul 23, 2020 at 10:40:48PM +0200, Ákos Uzonyi wrote:
> > On Wed, 22 Jul 2020 at 21:23, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > > On Tue, Jul 21, 2020 at 11:19:18PM +0200, Ákos Uzonyi wrote:
> > > > From: Uzonyi Ákos <uzonyi.akos at gmail.com>
> > > >
> > > > I made the requested changes to my prevoius series.
> > > >
> > > > I ran a travis build [1], it seems to be fine, but on x86 all the pidns tests
> > > > are failing. According to the error message, ioctl(NS_GET_PARENT) errors
> > > > with ENOTTY. I have no idea why it happens, on my x86 system all tests pass.
> > > > If you know the reason of it, please tell me.
> > > >
> > > > [1] https://travis-ci.org/github/AkosUzonyi/strace/builds/710483396
> > >
> > > Although this looks odd, it must be something to do with the kernel.
> > > Old kernels do not have to support NS_GET_PARENT at all.
> >
> > Apparently the kernel versions of the two failing builds are 4.4.0 and
> > 5.3.0. The latter should support NS_GET_PARENT, as it was added in
> > 4.9. Is it possible that a 5.3.0 kernel does not support
> > NS_GET_PARENT, or could it be just some travis bug? I'm asking because
> > I'm not sure if I should skip pidns tests by
> > "require_min_kernel_version_or_skip", or by testing at runtime whether
> > ioctl(NS_GET_PARENT) fails with ENOTTY.
>
> Looks like these nsfs ioctls are not enabled for compat processes.
> If I'm reading linux/fs/ioctl.c correctly, .compat_ioctl method must be
> defined in linux/fs/nsfs.c:ns_file_operations for this to work.
I think the kernel needs the following patch to implement nsfs ioctls
for compat processes:
diff --git a/fs/nsfs.c b/fs/nsfs.c
index 800c1d0eb0d0..a00236bffa2c 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -21,6 +21,7 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl,
static const struct file_operations ns_file_operations = {
.llseek = no_llseek,
.unlocked_ioctl = ns_ioctl,
+ .compat_ioctl = compat_ptr_ioctl,
};
static char *ns_dname(struct dentry *dentry, char *buffer, int buflen)
--
ldv
More information about the Strace-devel
mailing list