Re: [RFC] User stack pointer randomisation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ralf Baechle wrote:
> On Thu, Jul 19, 2007 at 01:47:19PM +0200, Franck Bui-Huu wrote:
> 
>> 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))
> 

> <asm/asm.h> which is fairly similar to it's userspace equivalent
> <sys/asm.h> contains definitions which are some sort of
> pseudo-standard in the MIPS world, including ALSZ and ALMASK. If I
> had choosen them I'd have set ALSZ to 8 rsp. 16, just like you ...
> Anyway, having similar macros makes porting of assembler code
> easier.  This also is why <asm/regdef.h> and <asm/fpregdef.h> are as
> they are.  RISC/os, IRIX, some of the BSD variants, even the
> non-Linux SDE variants for example for baremetal use a similar set
> of macros and headers.

Thanks for explanations.

That makes me think that we may have the same alignement issue in
include/asm-mips/ptrace.h header file:

	struct pt_regs {
	#ifdef CONFIG_32BIT
	        /* Pad bytes for argument save space on the stack. */
	        unsigned long pad0[6];
	#endif
	
	        /* Saved main processor registers. */
	        unsigned long regs[32];
	
	        /* Saved special registers. */
	        unsigned long cp0_status;
	        unsigned long hi;
	        unsigned long lo;
	#ifdef CONFIG_CPU_HAS_SMARTMIPS
	        unsigned long acx;
	#endif
	        unsigned long cp0_badvaddr;
	        unsigned long cp0_cause;
	        unsigned long cp0_epc;
	#ifdef CONFIG_MIPS_MT_SMTC
	        unsigned long cp0_tcstatus;
	#endif /* CONFIG_MIPS_MT_SMTC */
	} __attribute__ ((aligned (8)));

Note that the structure is aligned on a 8 bytes boundary which is not
correct for a 64 bit kernel, is it ?

Thanks
		Franck


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux