[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_FUNC_MMAP lacks <unistd.h> include?
From: |
Zack Weinberg |
Subject: |
Re: AC_FUNC_MMAP lacks <unistd.h> include? |
Date: |
Thu, 11 May 2023 10:08:32 -0400 |
User-agent: |
Cyrus-JMAP/3.9.0-alpha0-415-gf2b17fe6c3-fm-20230503.001-gf2b17fe6 |
On Thu, May 11, 2023, at 2:00 AM, Paul Eggert wrote:
> On 2023-05-10 21:06, Matt Turner wrote:
>
>> We're mmap'ing a 1-byte file, and since the pagesize on amd64 is 4096
>> bytes, only the first 4096 byte page (of two) is mapped. Accessing the
>> second page triggers the SIGBUS.
>
> Ouch, I misread that part of the test. Thanks for reporting that. I
> suppose we should go back to invoking getpagesize despite the hassle of
> configuring it. I installed the attached further patch; please give it a
> try.
Off the top of my head, but we can safely assume that the page size is at
least 512 bytes, so why not mmap an 8192-byte region of a 1-byte file, as
in the previous iteration, and then access, like, byte 255? Unless someone
knows of a bug in some old kernel where the first *disk block* of an oversized
mmap would be properly zeroed and then the rest of it would be memory garbage,
I suppose...
zw
- AC_FUNC_MMAP lacks <unistd.h> include?, Sam James, 2023/05/09
- [PATCH] Include unistd.h for getpagesize in AC_FUNC_MMAP, Matt Turner, 2023/05/10
- Re: AC_FUNC_MMAP lacks <unistd.h> include?, Paul Eggert, 2023/05/10
- Re: AC_FUNC_MMAP lacks <unistd.h> include?, Matt Turner, 2023/05/11
- Re: AC_FUNC_MMAP lacks <unistd.h> include?, Florian Weimer, 2023/05/17
- Re: AC_FUNC_MMAP lacks <unistd.h> include?, Paul Eggert, 2023/05/17
- Re: AC_FUNC_MMAP lacks <unistd.h> include?, Florian Weimer, 2023/05/17
- Re: AC_FUNC_MMAP lacks <unistd.h> include?, Paul Eggert, 2023/05/17