Re: How is the definition of stack canary on MIPS arch?

2010-09-06 Thread Adam Jiang
On Tue, Aug 31, 2010 at 09:12:57AM -0700, David Daney wrote:
 On 08/30/2010 08:36 PM, Adam Jiang wrote:
 On Mon, Aug 30, 2010 at 10:43:44AM -0700, David Daney wrote:
 On 08/30/2010 09:46 AM, Richard Henderson wrote:
 On 08/30/2010 03:45 AM, Adam Jiang wrote:
 When I read the source in Linux kerne, it was said that stack canary for
 implementing stack protector is defined as an offset to %gs on x86
 architecture. How about stack canary defined on MIPS?
 
 It's not implemented for MIPS.
 
 
 
 For the Linux kernel, the MIPS stack canary would be a constant
 offset (that depends on PAGE_SIZE) from register $28.
 
 David Daney
 
 Thanks, David and Richard.
 
 Is there code, doc or anything on this topic I can refer to? Is it
 defined in gcc internally or in kernel source itself? Would you please
 redirect me to the right place?
 
 
 I am unaware of any documents.  The MIPS Linux kernel ABI is not
 really documented anywhere, one learns it by studying and hacking on
 the source code.
 
 32-bit kernels use a variant of the o32 ABI, 64-bit kernels use a
 variant of n64.  Both dedicate register $28 as a pointer to the
 thread area of which the stack is a part.
 
 The form any stack canary for the MIPS Linux kernel will be
 determined by whomever implements it.
 
 I have done some research by googling. Here are what I've gotten.
 
 http://www.trl.ibm.com/projects/security/ssp/main.html
 http://www.trl.ibm.com/projects/security/ssp/
 http://lxr.linux.no/linux+v2.6.35/arch/x86/include/asm/stackprotector.h
 
 However, it seems there is no documents about how this is done on MIPS.
 Do I miss something?
 
 
 At RTH said, It's not implemented for MIPS., so there was really
 nothing to miss.

I found this.

http://gcc.gnu.org/ml/gcc-patches/2009-04/msg02164.html

However, my toolchain which I downloaded from CodeSourcery complained
-fstack-protector was not supported when I tried this out. So, my
question is what's the meaning by It's not implemented for MIPS.

Linaro added stack protector in Linux kernel about two month ago. This
patch has been pulled into a new release. Does this mean there is only
one step left on Linux Kernel side to get support SSP on MIPS?

/Adam

 
 David Daney


Re: How is the definition of stack canary on MIPS arch?

2010-08-31 Thread David Daney

On 08/30/2010 08:36 PM, Adam Jiang wrote:

On Mon, Aug 30, 2010 at 10:43:44AM -0700, David Daney wrote:

On 08/30/2010 09:46 AM, Richard Henderson wrote:

On 08/30/2010 03:45 AM, Adam Jiang wrote:

When I read the source in Linux kerne, it was said that stack canary for
implementing stack protector is defined as an offset to %gs on x86
architecture. How about stack canary defined on MIPS?


It's not implemented for MIPS.




For the Linux kernel, the MIPS stack canary would be a constant
offset (that depends on PAGE_SIZE) from register $28.

David Daney


Thanks, David and Richard.

Is there code, doc or anything on this topic I can refer to? Is it
defined in gcc internally or in kernel source itself? Would you please
redirect me to the right place?



I am unaware of any documents.  The MIPS Linux kernel ABI is not really 
documented anywhere, one learns it by studying and hacking on the source 
code.


32-bit kernels use a variant of the o32 ABI, 64-bit kernels use a 
variant of n64.  Both dedicate register $28 as a pointer to the thread 
area of which the stack is a part.


The form any stack canary for the MIPS Linux kernel will be determined 
by whomever implements it.



I have done some research by googling. Here are what I've gotten.

http://www.trl.ibm.com/projects/security/ssp/main.html
http://www.trl.ibm.com/projects/security/ssp/
http://lxr.linux.no/linux+v2.6.35/arch/x86/include/asm/stackprotector.h

However, it seems there is no documents about how this is done on MIPS.
Do I miss something?



At RTH said, It's not implemented for MIPS., so there was really 
nothing to miss.


David Daney


Re: How is the definition of stack canary on MIPS arch?

2010-08-30 Thread Richard Henderson
On 08/30/2010 03:45 AM, Adam Jiang wrote:
 When I read the source in Linux kerne, it was said that stack canary for
 implementing stack protector is defined as an offset to %gs on x86
 architecture. How about stack canary defined on MIPS?

It's not implemented for MIPS.


r~


Re: How is the definition of stack canary on MIPS arch?

2010-08-30 Thread David Daney

On 08/30/2010 09:46 AM, Richard Henderson wrote:

On 08/30/2010 03:45 AM, Adam Jiang wrote:

When I read the source in Linux kerne, it was said that stack canary for
implementing stack protector is defined as an offset to %gs on x86
architecture. How about stack canary defined on MIPS?


It's not implemented for MIPS.




For the Linux kernel, the MIPS stack canary would be a constant offset 
(that depends on PAGE_SIZE) from register $28.


David Daney


Re: How is the definition of stack canary on MIPS arch?

2010-08-30 Thread Adam Jiang
On Mon, Aug 30, 2010 at 10:43:44AM -0700, David Daney wrote:
 On 08/30/2010 09:46 AM, Richard Henderson wrote:
 On 08/30/2010 03:45 AM, Adam Jiang wrote:
 When I read the source in Linux kerne, it was said that stack canary for
 implementing stack protector is defined as an offset to %gs on x86
 architecture. How about stack canary defined on MIPS?
 
 It's not implemented for MIPS.
 
 
 
 For the Linux kernel, the MIPS stack canary would be a constant
 offset (that depends on PAGE_SIZE) from register $28.
 
 David Daney

Thanks, David and Richard.

Is there code, doc or anything on this topic I can refer to? Is it
defined in gcc internally or in kernel source itself? Would you please
redirect me to the right place?

I have done some research by googling. Here are what I've gotten.

http://www.trl.ibm.com/projects/security/ssp/main.html
http://www.trl.ibm.com/projects/security/ssp/
http://lxr.linux.no/linux+v2.6.35/arch/x86/include/asm/stackprotector.h

However, it seems there is no documents about how this is done on MIPS.
Do I miss something?

/Adam