This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] [BZ #10283] localedef: align fixed maps to SHMLBA
- From: David Miller <davem at davemloft dot net>
- To: dalias at aerifal dot cx
- Cc: carlos at redhat dot com, vapier at gentoo dot org, libc-alpha at sourceware dot org
- Date: Thu, 23 May 2013 18:10:26 -0700 (PDT)
- Subject: Re: [PATCH] [BZ #10283] localedef: align fixed maps to SHMLBA
- References: <1369327649-906-1-git-send-email-vapier at gentoo dot org> <519EA212 dot 6020508 at redhat dot com> <20130524002236 dot GW20323 at brightrain dot aerifal dot cx>
From: Rich Felker <dalias@aerifal.cx>
Date: Thu, 23 May 2013 20:22:37 -0400
> On Thu, May 23, 2013 at 07:11:14PM -0400, Carlos O'Donell wrote:
>> On 05/23/2013 12:47 PM, Mike Frysinger wrote:
>> > Many Linux arches require fixed mmaps to be aligned higher than pagesize,
>> > so use the SHMLBA define as it represents this quantity exactly.
>> >
>> > This fixes spurious errors seen on those arches like:
>> > cannot map archive header: Invalid argument
>>
>> I had a deeper think about this issue and I don't know
>> that you can rely on glibc's SHMLBA to do this correctly.
>>
>> See:
>> http://lkml.indiana.edu/hypermail/linux/kernel/0309.1/1005.html
>>
>> Which says that the kernel and glibc values for SHMLBA don't
>> match.
>>
>> We need correct SHMLBA values in order to ensure that the kernel
>> will be less likely to return EINVAL for an mmap with a fixed
>> address.
>
> It would be helpful to know *why* the kernel is returning EINVAL for
> otherwise-correct (page-aligned) mmap requests. Mapping on a
> page-aligned address over top of an existing mapping *should* always
> be valid, conceptually. Any link to an explanation on why it's
> sometimes not valid?
It's not valid if it would create a bad virtual cache alias, that's
why the SHMLBA restriction exists.