[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/16685] New: Read-only data sections should not be executable
From: |
zackw at panix dot com |
Subject: |
[Bug ld/16685] New: Read-only data sections should not be executable |
Date: |
Mon, 10 Mar 2014 21:50:30 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=16685
Bug ID: 16685
Summary: Read-only data sections should not be executable
Product: binutils
Version: unspecified
Status: NEW
Severity: enhancement
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: zackw at panix dot com
The usual ELF linker scripts lump a variety of "read-only data" sections into
the same program segment as the actual code ("text"), thus allowing data in
those sections to be executed, if by chance the PC is misdirected there. As a
somewhat silly demonstration, compile and run
const char main[] = "1\300\303";
on an x86/elf system, and it will execute successfully! (Remove the 'const'
and it will crash, because modifiable data is in a different segment which does
not have execute permission.)
In principle, fixing this is as simple as defining an additional LOAD segment
in the linker script, and moving all of the sections that contain read-only
data but not machine code there. The details might get a little hairy.
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug ld/16685] New: Read-only data sections should not be executable,
zackw at panix dot com <=