mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: lihua.zhao.cn@windriver.com
Cc: musl@lists.openwall.com
Subject: Re: [musl] [PATCH v2] mman: correct length check in __shm_mapname
Date: Tue, 5 Nov 2024 00:15:05 -0500	[thread overview]
Message-ID: <20241105051505.GG10433@brightrain.aerifal.cx> (raw)
In-Reply-To: <20241105045628.1542264-1-lihua.zhao.cn@windriver.com>

On Tue, Nov 05, 2024 at 12:56:28PM +0800, lihua.zhao.cn@windriver.com wrote:
> From: Lihua Zhao <lihua.zhao.cn@windriver.com>
> 
> account for leading slashes when comparing against NAME_MAX.
> 
> Signed-off-by: Lihua Zhao <lihua.zhao.cn@windriver.com>
> ---

I'm still not clear what you're trying to achieve here. If the bug is
"it's different from glibc", that is not a bug.

> According to https://pubs.opengroup.org/onlinepubs/9799919799/:
> 
> leading <slash> character in name is implementation-defined, and
> that the length limits for the name argument are
> implementation-defined and need not be the same as the pathname
> limits {PATH_MAX} and {NAME_MAX}.
> 
> Although it is implementation-defined, glibc obviously calculates the lead slash.

Leading slash is not implementation-defined. The text you quoted says
the opposite if you didn't cut off the earlier part of the sentence:

"...except that the interpretation of <slash> characters other than
the"

A leading slash is necessary to portably open shared memory by a name
in a shared global namespace. Omitting it, or using slashes elsewhere
in the name, is what's implementation-defined.

Indeed the limits need not match NAME_MAX, but since we implement
named shared memory objects as filesystem objects, the implementation
choice we make is to have the limit match.

Rich

  reply	other threads:[~2024-11-05  5:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05  1:06 [musl] [PATCH] " lihua.zhao.cn
2024-11-05  1:46 ` Rich Felker
2024-11-05  2:03   ` Zhao, Lihua (CN)
2024-11-05  3:00     ` Rich Felker
2024-11-05  4:56       ` [musl] [PATCH v2] " lihua.zhao.cn
2024-11-05  5:15         ` Rich Felker [this message]
2024-11-05  6:06           ` Zhao, Lihua (CN)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241105051505.GG10433@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=lihua.zhao.cn@windriver.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).