From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 18200 invoked from network); 30 Mar 2023 13:57:18 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 30 Mar 2023 13:57:18 -0000 Received: (qmail 28312 invoked by uid 550); 30 Mar 2023 13:57:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 28265 invoked from network); 30 Mar 2023 13:57:15 -0000 Date: Thu, 30 Mar 2023 09:57:03 -0400 From: Rich Felker To: Matthias =?utf-8?Q?G=C3=B6rgens?= Cc: musl@lists.openwall.com Message-ID: <20230330135703.GC4163@brightrain.aerifal.cx> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [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. Rich