Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:53:28+00:00 2026-06-05T15:53:28+00:00

I am running some C code, compiled to 32bit x86 on Linux. And I

  • 0

I am running some C code, compiled to 32bit x86 on Linux. And I am trying to access some memory. Apperently I can write to .bss and .data and to the stack. Some time ago, the .ctors and .dtors segments used to be writable, but it seems they are gone.

Without trial-and-error, how can I found out to which sections in memory the segments are mapped? How can I find out which addresses are mapped to writable memory and which are executable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:53:31+00:00Added an answer on June 5, 2026 at 3:53 pm

    Without trial-and-error, how can I found out to which sections in memory the segments are mapped?

    Sections and segments have specific meaning when you talk about ELF executables, and your usage above doesn’t agree with that meaning.

    ELF sections don’t matter at load time, only (loadable) segments do.

    The readelf -l a.out command provides exactly the mapping from ELF sections to segments. E.g.

    readelf -l /bin/date
    
    Elf file type is EXEC (Executable file)
    Entry point 0x8048c60
    There are 6 program headers, starting at offset 52
    
    Program Headers:
      Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
      PHDR           0x000034 0x08048034 0x08048034 0x000c0 0x000c0 R E 0x4
      INTERP         0x0000f4 0x080480f4 0x080480f4 0x00013 0x00013 R   0x1
          [Requesting program interpreter: /lib/ld-linux.so.2]
      LOAD           0x000000 0x08048000 0x08048000 0x05fe0 0x05fe0 R E 0x1000
      LOAD           0x006000 0x0804e000 0x0804e000 0x00208 0x00334 RW  0x1000
      DYNAMIC        0x006078 0x0804e078 0x0804e078 0x000c8 0x000c8 RW  0x4
      NOTE           0x000108 0x08048108 0x08048108 0x00020 0x00020 R   0x4
    
     Section to Segment mapping:
      Segment Sections...
       00
       01     .interp
       02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata
       03     .data .eh_frame .dynamic .ctors .dtors .jcr .got .bss
       04     .dynamic
       05     .note.ABI-tag
    

    This tells you that .ctors is mapped to segment 3, which is writable (this output is from ancient UnitedLinux 1.0 distribution).

    Nowadays, .ctors is put into a segment different from .data, and protected from writing after relocation via special GNU_RELRO segment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to update the contents of an element after running some php code.
Trying to truncate some code here and running into a problem: <script type=text/javascript> $(function()
I have been trying to write some code that asks the user for several
I'm curious about how, running Windows 7 on x86, you could execute some code
I'm running some code through FxCop and am currently looking at clearing all of
I am running some import code asynchronously from a simple WinForms app using a
I've been refactoring some code running on a simple LAMP box on my network.
I'm using Unity with an Asp.net MVC 3 app. Here is some code running
I have some code which is been running by a backgroundworker I'd like some
I have some code that attempts to test whether my application is running with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.