linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jann Horn <jannh@google.com>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-man@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	 "Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	 Vlastimil Babka <vbabka@suse.cz>,
	linux-mm@kvack.org, Jakub Wilk <jwilk@jwilk.net>
Subject: Re: [PATCH man v2] mmap.2: Document danger of mappings larger than PTRDIFF_MAX
Date: Fri, 2 May 2025 14:27:18 +0200	[thread overview]
Message-ID: <CAG48ez398ny2se1000gbta2-FVJ3-+13TQd1v4Ce19oNASqUCg@mail.gmail.com> (raw)
In-Reply-To: <dgzjcjwdldjn7uzgeh6dfwsgkc4ju2zakugwrnpyj5mwbmrnk2@sqqnganfrdvh>

On Thu, May 1, 2025 at 6:43 PM Alejandro Colomar <alx@kernel.org> wrote:
> On Tue, Apr 29, 2025 at 06:43:59PM +0200, Jann Horn wrote:
> > References:
> >  - C99 draft: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
> >    section "6.5.6 Additive operators", paragraph 9
> >  - object size restriction in GCC:
> >    https://gcc.gnu.org/legacy-ml/gcc/2011-08/msg00221.html
> >  - glibc malloc restricts object size to <=PTRDIFF_MAX in
> >    checked_request2size() since glibc v2.30 (released in 2019, as pointed
> >    out by Jakub Wilk):
> >    https://sourceware.org/cgit/glibc/commit/?id=9bf8e29ca136094f
>
> Thanks!  I've applied the patch.  See some comments below.
> <https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=7e5756fdeba1a4729f817079c64f0d87fdcdadfa>

Thanks!

> > +Unlike typical
> > +.BR malloc (3)
> > +implementations,
> > +.BR mmap ()
> > +does not prevent creating objects larger than
> > +.BR PTRDIFF_MAX .
> > +Objects that are larger than
> > +.B PTRDIFF_MAX
> > +only work in limited ways in standard C
>
> I've removed 'standard', since in any C it is problematic.
>
> Is it okay to you?  (We're still in time to amend if you prefer
> something else.)

Sounds good to me.


      reply	other threads:[~2025-05-02 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 16:43 Jann Horn
2025-05-01 16:43 ` Alejandro Colomar
2025-05-02 12:27   ` Jann Horn [this message]

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=CAG48ez398ny2se1000gbta2-FVJ3-+13TQd1v4Ce19oNASqUCg@mail.gmail.com \
    --to=jannh@google.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=alx@kernel.org \
    --cc=jwilk@jwilk.net \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=vbabka@suse.cz \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox