Hi Ralf, On 7/19/07, Ralf Baechle <ralf@xxxxxxxxxxxxxx> wrote:
On Thu, Jul 19, 2007 at 09:10:23AM +0200, Franck Bui-Huu wrote: > This patch adds a page size range randomisation to the user > stack pointer. Looks fine to me aside of the issue Nigel raised.
I'll fix it.
There is a constant defining the ABI-specific alignment in <asm/asm.h>:
I didn't know about them. ALSZ name is not really self speaking, don't you think ?
#if (_MIPS_SIM == _MIPS_SIM_ABI32) #define ALSZ 7 #define ALMASK ~7 #endif #if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) #define ALSZ 15 #define ALMASK ~15 #endif
this is weird I would have defined them like this instead: #if (_MIPS_SIM == _MIPS_SIM_ABI32) #define ALSZ 8 #elif (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) #define ALSZ 16 #endif #define ALMASK (~(ALSZ-1))
This will unnecessarily increase the alignment of the stack wasting a few bytes of memory for O32 binaries running on 64-bit kernels but I'd just ignore this artefact; the cure would be uglier than the disease ;-)
specially that we don't care to waste a couple of bytes in this case... Thanks -- Franck