Re: [PATCH v5 1/4] openat2: new OPENAT2_REGULAR flag support

Florian Weimer
2026-03-09T17:40:20Z

* Andy Lutomirski:

> On the flip side, /proc itself can certainly be opened. Should
> O_REGULAR be able to open the more magical /proc and /sys files? Are
> there any that are problematic?

It seems reading from /proc/kmsg is destructive. The file doesn't have
an end, either. It's more like a character device. Apparently,
/sys/kernel/tracing/trace_pipe is similar in that regard. Maybe that's
sufficient reason for blocking access? Although the side effect does
not happen on open.

The other issue is the incorrect size reporting in stat, which affects
most (all?) files under /proc and /sys. Userspace has already to around
that, though.

Thanks,
Florian