Re: [asan] WIP protection of globals

2012-10-17 Thread Xinliang David Li
On Tue, Oct 16, 2012 at 11:51 PM, Jakub Jelinek wrote: > On Tue, Oct 16, 2012 at 04:19:09PM -0700, Xinliang David Li wrote: >> I am not sure -- fasan is an error detecting feature -- the goal is to >> find bugs -- missing handling of commons etc. are not desirable. >> Besides if ABI changes consi

Re: [asan] WIP protection of globals

2012-10-16 Thread Jakub Jelinek
On Tue, Oct 16, 2012 at 04:19:09PM -0700, Xinliang David Li wrote: > I am not sure -- fasan is an error detecting feature -- the goal is to > find bugs -- missing handling of commons etc. are not desirable. > Besides if ABI changes consistently for all objects, why does it > matter? > > Or making

Re: [asan] WIP protection of globals

2012-10-16 Thread Xinliang David Li
On Tue, Oct 16, 2012 at 4:02 PM, Jakub Jelinek wrote: > On Tue, Oct 16, 2012 at 03:50:27PM -0700, Xinliang David Li wrote: >> Does that mean that all globals defined in shared libraries can not be >> protected as long as they are not protected or hidden? This sounds >> like a big limitation. We n

Re: [asan] WIP protection of globals

2012-10-16 Thread Jakub Jelinek
On Tue, Oct 16, 2012 at 03:50:27PM -0700, Xinliang David Li wrote: > Does that mean that all globals defined in shared libraries can not be > protected as long as they are not protected or hidden? This sounds > like a big limitation. We need to answer the following two questions: For !DECL_ONE_ON

Re: [asan] WIP protection of globals

2012-10-16 Thread Xinliang David Li
On Tue, Oct 16, 2012 at 3:03 PM, Jakub Jelinek wrote: > On Tue, Oct 16, 2012 at 02:41:42PM -0700, Xinliang David Li wrote: >> > +bool >> > +asan_protect_global (tree decl) >> > +{ >> > + rtx rtl, symbol; >> > + section *sect; >> > + >> > + if (TREE_CODE (decl) != VAR_DECL >> > + || DECL_TH

Re: [asan] WIP protection of globals

2012-10-16 Thread Jakub Jelinek
On Tue, Oct 16, 2012 at 02:41:42PM -0700, Xinliang David Li wrote: > > +bool > > +asan_protect_global (tree decl) > > +{ > > + rtx rtl, symbol; > > + section *sect; > > + > > + if (TREE_CODE (decl) != VAR_DECL > > + || DECL_THREAD_LOCAL_P (decl) > > + || DECL_EXTERNAL (decl) > > +

Re: [asan] WIP protection of globals

2012-10-16 Thread Xinliang David Li
On Tue, Oct 16, 2012 at 7:58 AM, Jakub Jelinek wrote: > Hi! > > This is a WIP patch for globals protection. > I'm not filling names yet and has_dynamic_init is always > false (wonder how to figure it has_dynamic_init out, especially > with LTO, TYPE_ADDRESSABLE (TREE_TYPE (decl)) probably isn't it

Re: [asan] WIP protection of globals

2012-10-16 Thread Marek Polacek
On Tue, Oct 16, 2012 at 04:58:48PM +0200, Jakub Jelinek wrote: > @@ -2022,6 +2036,12 @@ assemble_variable (tree decl, int top_le >if (DECL_ALIGN (decl) > BITS_PER_UNIT) > ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (DECL_ALIGN_UNIT (decl))); >assemble_variable_contents (decl, n

[asan] WIP protection of globals

2012-10-16 Thread Jakub Jelinek
Hi! This is a WIP patch for globals protection. I'm not filling names yet and has_dynamic_init is always false (wonder how to figure it has_dynamic_init out, especially with LTO, TYPE_ADDRESSABLE (TREE_TYPE (decl)) probably isn't it, and for more I'm afraid we need a langhook). --- gcc/varasm.c.j