public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: Update mmap() flags and errors lists
Date: Fri, 14 Jun 2024 12:40:37 -0400	[thread overview]
Message-ID: <xn34pftr3u.fsf@greed.delorie.com> (raw)
In-Reply-To: <87y178szz5.fsf@oldenburg.str.redhat.com> (message from Florian Weimer on Fri, 14 Jun 2024 10:14:22 +0200)

Florian Weimer <fweimer@redhat.com> writes:
>>> The question is if MAP_FIXED_NOREPLACE can be silently treated as
>>> MAP_FIXED.
>>
>> I wouldn't think so.  If the kernel supports it, it automatically
>> includes MAP_FIXED.  If the kernel doesn't support it, it's ignored.
>> You'd have to pass MAP_FIXED | MAP_FIXED_NOREPLACE to get the "silent"
>> treatment.
>
> Ahh, so the application has to if the return address changed and unmap?

I suppose that's one way of auto-detecting it, yes.

>>>> The code I was looking at was talking about having 2^32 *pages* mapped.
>>>
>>> See MMAP2_PAGE_UNIT.  On most architectures, it's fixed at 4096,
>>> regardless of page size.
>>>
>>> And it turns out that we do not check that the offset argument fits into
>>> 32 bits after dividing by MMAP2_PAGE_UNIT (on targets where this
>>> matters).  The documentation implies we should return EOVERFLOW in this
>>> case.
>>
>>
>> 	/* offset overflow? */
>> 	if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
>> 		return -EOVERFLOW;
>
> This is kernel code.  We have a shift in userspace on some
> architectures, too.

That shouldn't affect the kernel's computation of that error code,
though?


  reply	other threads:[~2024-06-14 16:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 18:59 DJ Delorie
2024-06-04 22:16 ` Florian Weimer
2024-06-05  4:10   ` DJ Delorie
2024-06-05  6:38     ` Florian Weimer
2024-06-05 18:42       ` DJ Delorie
2024-06-14  8:14         ` Florian Weimer
2024-06-14 16:40           ` DJ Delorie [this message]
2024-06-05 18:50       ` [v3] " DJ Delorie
2024-06-14  8:21         ` Florian Weimer
2024-06-14 18:19           ` DJ Delorie
2024-06-14 18:46           ` [v4] " DJ Delorie
2024-06-18 20:13             ` Mathieu Desnoyers
2024-06-18 20:57               ` DJ Delorie
2024-06-21 13:02                 ` Mathieu Desnoyers
2024-06-21 16:17                   ` DJ Delorie
2024-06-21 16:20                     ` Mathieu Desnoyers
2024-06-19  7:16             ` Florian Weimer
2024-06-05  4:11   ` [v2] " DJ Delorie
2024-06-05  7:44     ` Andreas Schwab
2024-06-05 18:42       ` DJ Delorie

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=xn34pftr3u.fsf@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).