public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/26090]  New: IA-64 creates DT_TEXTREL binaries
@ 2006-02-03 14:42 jakub at gcc dot gnu dot org
  2006-02-03 15:33 ` [Bug target/26090] " rth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-02-03 14:42 UTC (permalink / raw)
  To: gcc-bugs

int getpid (void), getppid (void);
struct S { int (*p) (void); int (*q) (void); };
const struct S t = { getpid, getppid };
int
main (void)
{
  return 0;
}
gcc -g -o test test.c
or
int foo (void) { return 1; }
int bar (void) { return 2; }
struct S { int (*p) (void); int (*q) (void); };
const struct S t = { foo, bar };
int
main (void)
{
  return 0;
}
gcc -g -o test2 test2.c -Wl,--export-dynamic
results in DT_TEXTREL binaries, which is very bad from security POV.

E.g. SELinux needs to avoid some execmod checks because of this.
I'd say it is far better to use .data.rel.ro and similar sections for such
constants that require relocations rather than .rodata, with -Wl,-z,relro
they will be write protected as well, but no segment will be executable
and writable at the same time that way.

Looking at config/ia64/, it seems hpux is already doing that with:
/* It is illegal to have relocations in shared segments on HPUX.
   Pretend flag_pic is always set.  */
#undef  TARGET_ASM_SELECT_SECTION
#define TARGET_ASM_SELECT_SECTION  ia64_rwreloc_select_section
#undef  TARGET_ASM_UNIQUE_SECTION
#define TARGET_ASM_UNIQUE_SECTION  ia64_rwreloc_unique_section
#undef  TARGET_ASM_SELECT_RTX_SECTION
#define TARGET_ASM_SELECT_RTX_SECTION  ia64_rwreloc_select_rtx_section
#define TARGET_RWRELOC  true

Any reason why this shouldn't be in config/ia64/linux.h as well?


-- 
           Summary: IA-64 creates DT_TEXTREL binaries
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: ia64-linux


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


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

end of thread, other threads:[~2007-03-12 17:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-03 14:42 [Bug target/26090] New: IA-64 creates DT_TEXTREL binaries jakub at gcc dot gnu dot org
2006-02-03 15:33 ` [Bug target/26090] " rth at gcc dot gnu dot org
2006-02-03 19:14 ` rth at gcc dot gnu dot org
2006-02-03 23:47 ` rth at gcc dot gnu dot org
2007-03-10  0:53 ` rth at gcc dot gnu dot org
2007-03-10  0:59 ` rth at gcc dot gnu dot org
2007-03-11 16:22 ` rth at gcc dot gnu dot org
2007-03-12 17:16 ` rth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).