Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 30 Mar 2023 09:57:03 -0400
From: Rich Felker <>
To: Matthias Görgens <>
Subject: Re: [BUG] hasmntopt weirdness

On Thu, Mar 30, 2023 at 06:02:43PM +0800, Matthias Görgens wrote:
> Musl's `hasmntopt` is a bit weird.
> For example, my `/proc/mounts` contains the following line:
> shm /dev/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=65536k,inode64 0 0
> If I run `hasmntopt(entp, "suid")` on that entry with glibc, I get
> NULL. In musl I get: "suid,nodev,noexec,relatime,size=65536k,inode64".
> Do we have a spec for what should happen? I can find multiple
> descriptions online, some of them would allow what musl does, but not
> all. I don't know what's authoritative.
> Arguably the musl behaviour is a bit silly by itself, and would
> actively cause bugs for someone porting programs from glibc.

I'm pretty sure it was agreed upon at one point that this was a bug,
but never pursued further.

>From what I remember, I think hasmntopt needs to check that the match
found is at the start or immediately follows a comma (unless there is
some awful way to embed literal commas) and that it's followed by an
equals sign, comma, or nul terminator. Does this sound correct?

There's not really a need to use strstr to do this, but it might still
be the simplest implementation.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.