This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/25522] New: zero-initialized constants are place in .bss


Compile this code:

struct foo { int a, b; }
const struct foo f;

The compiler will mark the variable f in .bss instead of, as the const
indicates, into .rodata.  This can be a security problem.  In glibc we
deliberately use const wherever possible (as should everybody) to prevent
anybody from changing the value.  Allowing changes would allw an intruder to
modify the variable and influence the semantics of the program.

Yes, this means that binaries get larger.  But that's what the programmer
requested.


-- 
           Summary: zero-initialized constants are place in .bss
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drepper at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25522


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]