Set SHMLBA to page size on hppa (BZ locale/19838)
Commit Message
Setting SHMLBA to 4MB results in applications failing to allocate memory using mmap too early.
Examples are localedef and perl.
The attached patch fixes this by reducing SHMLBA to the page size (4096).
The patch has been installed on Debian for a long time. It goes back to the following discussion:
https://patchwork.kernel.org/patch/3933841/
Although there may be issues in old IPC applications, the general consensus is that the smaller
4KB value is more useful. I might add that the kernel code in sys_parisc.c does 4MB color alignment
for file and shared maps.
Please install.
Dave
--
John David Anglin dave.anglin@bell.net
2017-04-16 John David Anglin <danglin@gcc.gnu.org>
[BZ locale/19838]
* sysdeps/unix/sysv/linux/hppa/bits/shm.h (SHMLBA): Align to page
boundary using __getpagesize.
Comments
On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote:
> +#define SHMLBA (__getpagesize ())
SHMLBA must be a constant.
Andreas.
On 2017-04-16, at 4:00 PM, Andreas Schwab wrote:
> On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote:
>
>> +#define SHMLBA (__getpagesize ())
>
> SHMLBA must be a constant.
Are you sure? __getpagesize() is used on some other targets including x86.
Dave
--
John David Anglin dave.anglin@bell.net
On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote:
> On 2017-04-16, at 4:00 PM, Andreas Schwab wrote:
>
>> On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote:
>>
>>> +#define SHMLBA (__getpagesize ())
>>
>> SHMLBA must be a constant.
>
>
> Are you sure?
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_shm.h.html#tag_13_59_03
Andreas.
* John David Anglin:
> On 2017-04-16, at 4:00 PM, Andreas Schwab wrote:
>
>> On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote:
>>
>>> +#define SHMLBA (__getpagesize ())
>>
>> SHMLBA must be a constant.
>
>
> Are you sure? __getpagesize() is used on some other targets including x86.
Well, we should probably fix that.
I find it difficult to believe that we will ever get anything but 4K
pages on x86-64 because much too much would break as a result.
But it seems to me that POSIX is wrong here because the page size
isn't a context in other contexts, and as you describe, just having
some arbitrary multiple of the actual page size tends to cause
problems.
@@ -37,7 +37,7 @@
#define SHM_UNLOCK 12 /* unlock segment (root only) */
/* Segment low boundary address multiple. */
-#define SHMLBA 0x00400000 /* address needs to be 4 Mb aligned */
+#define SHMLBA (__getpagesize ())
/* Type to count number of attaches. */
typedef unsigned long int shmatt_t;