Re: [PATCH v1 00/17] selftests/nolibc: allow run with minimal kernel config

From: Thomas Weißschuh
Date: Sat Jun 24 2023 - 03:30:29 EST


On 2023-06-24 08:52:55+0200, Thomas Weißschuh wrote:
> As for the CONFIG_NET dependency, which I would guess is one of the more
> expensive configs to enable:
>
> link_cross can be easily adapted to instead use /proc/self.
>
> chmod_net relies on /proc/$PID/net accepting chmod().
> It is the only file in /proc/$PID/ that works that way.
>
> Maybe its a kernel bug anyways and we shouldn't rely on it anyways?
> I'm taking a look.

It indeed seems to be a kernel bug. The following patch aligns
/proc/$PID/net with all the other /proc/$PID stuff.

diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index a0c0419872e3..8c5e9abf4380 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -320,6 +320,7 @@ static int proc_tgid_net_getattr(struct mnt_idmap *idmap,

const struct inode_operations proc_net_inode_operations = {
.lookup = proc_tgid_net_lookup,
+ .setattr = proc_setattr,
.getattr = proc_tgid_net_getattr,
};

I'm not entirely sure about the process to synchronize the application
of the fix in the procfs tree and the fix/removal of the testcase in the
nolibc tree so we avoid broken states.
Or if this would technically be a (relevant) break of userspace ABI and
therefore has to stay as it is.

Any ideas?

Thomas