All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] A question about uninitializing static variables
@ 2005-03-29 14:31 Carlo Perassi
  2005-03-29 16:16 ` Howell, David P
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Carlo Perassi @ 2005-03-29 14:31 UTC (permalink / raw)
  To: kernel-janitors

Hi.
One of the tasks at http://janitor.kernelnewbies.org/TODO
is described as

"
uninitialize static variables initialized to 0, to make it go to the
.bss, instead of .data.
"

I made two patches for two maintainers which uninitialize some static
int used as module parameters and actually initialized to 0.

One maintainer do not have problems with the patches but the maintainer
of the file the second patch refers to would like to have some kind of
"proof" that "it is still guaranteed that those variables will be
initialized to 0". I wrote him something like "this simple hello module
shows it is still guaranteed..." but it's not enough for him. I guess
he'd like a more formal explanation of the following statement:

An uninitialized static variable of {the kernel, a kernel module} will
be compiled to go to the .bss and it is guaranteed that will be
"zero-ed" there.

Is there someone with a link or something I could send to this
maintainer to show him the reasons why the previous statement is true?
Maybe it could be useful to put this reference in the TODO itself.

Thanks.

-- 
Carlo Perassi - http://www.linux.it/~carlo/

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [KJ] A question about uninitializing static variables
  2005-03-29 14:31 [KJ] A question about uninitializing static variables Carlo Perassi
@ 2005-03-29 16:16 ` Howell, David P
  2005-03-29 16:39 ` Tom Bradley
  2005-03-30 19:34 ` Carlo Perassi
  2 siblings, 0 replies; 4+ messages in thread
From: Howell, David P @ 2005-03-29 16:16 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1932 bytes --]

Using the symbol table display tools like objcmp or nm on the object
file should show what section the symbol is allocated in after a link.
By definition .bss is always zero'ed by the implementation. If they 
can see all of the symbols in this category allocated in .bss, that 
should be enough.

Thanks,
Dave Howell

david.p.howell@intel.com
 

-----Original Message-----
From: kernel-janitors-bounces@lists.osdl.org
[mailto:kernel-janitors-bounces@lists.osdl.org] On Behalf Of Carlo
Perassi
Sent: Tuesday, March 29, 2005 9:31 AM
To: kernel-janitors@lists.osdl.org
Subject: [KJ] A question about uninitializing static variables

Hi.
One of the tasks at http://janitor.kernelnewbies.org/TODO
is described as

"
uninitialize static variables initialized to 0, to make it go to the
.bss, instead of .data.
"

I made two patches for two maintainers which uninitialize some static
int used as module parameters and actually initialized to 0.

One maintainer do not have problems with the patches but the maintainer
of the file the second patch refers to would like to have some kind of
"proof" that "it is still guaranteed that those variables will be
initialized to 0". I wrote him something like "this simple hello module
shows it is still guaranteed..." but it's not enough for him. I guess
he'd like a more formal explanation of the following statement:

An uninitialized static variable of {the kernel, a kernel module} will
be compiled to go to the .bss and it is guaranteed that will be
"zero-ed" there.

Is there someone with a link or something I could send to this
maintainer to show him the reasons why the previous statement is true?
Maybe it could be useful to put this reference in the TODO itself.

Thanks.

-- 
Carlo Perassi - http://www.linux.it/~carlo/

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [KJ] A question about uninitializing static variables
  2005-03-29 14:31 [KJ] A question about uninitializing static variables Carlo Perassi
  2005-03-29 16:16 ` Howell, David P
@ 2005-03-29 16:39 ` Tom Bradley
  2005-03-30 19:34 ` Carlo Perassi
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Bradley @ 2005-03-29 16:39 UTC (permalink / raw)
  To: kernel-janitors

the default for gcc is `-fzero-initialized-in-bss', the kernel
makefile does not change this therefore bss is zeroed, this is
documented in the gcc manpage.

Tom



On Tue, 29 Mar 2005 16:31:21 +0200 (CEST), Carlo Perassi <carlo@linux.it> wrote:
> Hi.
> One of the tasks at http://janitor.kernelnewbies.org/TODO
> is described as
> 
> "
> uninitialize static variables initialized to 0, to make it go to the
> .bss, instead of .data.
> "
> 
> I made two patches for two maintainers which uninitialize some static
> int used as module parameters and actually initialized to 0.
> 
> One maintainer do not have problems with the patches but the maintainer
> of the file the second patch refers to would like to have some kind of
> "proof" that "it is still guaranteed that those variables will be
> initialized to 0". I wrote him something like "this simple hello module
> shows it is still guaranteed..." but it's not enough for him. I guess
> he'd like a more formal explanation of the following statement:
> 
> An uninitialized static variable of {the kernel, a kernel module} will
> be compiled to go to the .bss and it is guaranteed that will be
> "zero-ed" there.
> 
> Is there someone with a link or something I could send to this
> maintainer to show him the reasons why the previous statement is true?
> Maybe it could be useful to put this reference in the TODO itself.
> 
> Thanks.
> 
> --
> Carlo Perassi - http://www.linux.it/~carlo/
> 
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> http://lists.osdl.org/mailman/listinfo/kernel-janitors
>
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [KJ] A question about uninitializing static variables
  2005-03-29 14:31 [KJ] A question about uninitializing static variables Carlo Perassi
  2005-03-29 16:16 ` Howell, David P
  2005-03-29 16:39 ` Tom Bradley
@ 2005-03-30 19:34 ` Carlo Perassi
  2 siblings, 0 replies; 4+ messages in thread
From: Carlo Perassi @ 2005-03-30 19:34 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 129 bytes --]

> Hi.

Thank you all for your answers.
The maintainer will integrate the patch.

-- 
Carlo Perassi - http://www.linux.it/~carlo/

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-30 19:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-29 14:31 [KJ] A question about uninitializing static variables Carlo Perassi
2005-03-29 16:16 ` Howell, David P
2005-03-29 16:39 ` Tom Bradley
2005-03-30 19:34 ` Carlo Perassi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.