On 2025-09-02 12:30, Linus Torvalds wrote:
On Tue, 2 Sept 2025 at 08:03, Siddhesh Poyarekar <siddhesh@xxxxxxxxxx> wrote:
This was actually the original issue I had tried to address, escaping
'#' in the beginning of the devname because it ends up in the beginning
of the line, thus masking out the entire line in mounts. I don't
remember at what point I concluded that escaping '#' always was the
answer (maybe to protect against any future instances where userspace
ends up ignoring the rest of the line following the '#'), but it appears
to be wrong.
I wonder if instead of escaping hash-marks we could just disallow them
as the first character in devname.
How did this issue with hash-marks get found? Is there some real use -
in which case we obviously can't disallow them - or was this from some
fuzzing test that happened to hit it?
The original issue was that devname being blank broke parsing of mounts,
which was fixed with Ian's patch[1]. While debugging that issue I
stumbled onto the fact that if the devname started with #, it would make
the mount invisible to getmntent in glibc, since it ignores lines
starting with #.
Sid
[1] https://lkml.org/lkml/2022/6/17/27