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 102915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:02:28+00:00 2026-05-11T01:02:28+00:00

Does there exist a way to catch a write into write-protected page? I plan

  • 0

Does there exist a way to catch a write into write-protected page?

I plan doing a self -like object system where you copy the object to instantiate it. (because it sounds simple and compact thing compared to the rest) Obviously, the objects created for this purpose ought be write-protected some way. I’ve seen there’s a way to flag something write-protected from the program headers in the ELF. (RE, RWE, RW -flags)

Does this provide write-protection at all? I remember it should raise a segfault, is this true? How to catch the write into a write-protected page. Is this a good way to implement what I’m wanting for and is there a better way?

  • 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. 2026-05-11T01:02:28+00:00Added an answer on May 11, 2026 at 1:02 am

    Yes, you can use mprotect.

    Yes, a write to protected memory will raise a segfault. You can install a handler, e.g. in C++:

    std::signal(SIGSEGV, my_segv_handler_func); 

    This is a plausible way of doing what you want, although you’d have to add a lot of extra management goo to make it work. For example, this sort of write-detection is done in hardware, and on x86 architectures you’ve got a page size of 4k. So you can protect things 4k at a time, aligned on 4k boundaries — not a generic ‘start at address X and go N bytes’. I believe you’d either have to

    1. have a mapping of objects to pages such that you can identify whether a write to a page is a write to a particular protected object, or
    2. roll your own malloc that always allocates on 4k boundaries, which would force you to use a minimum alloc’d block size of 4k

    I don’t know off the top of my head if there’s a better way, but it sounds fun to play with. 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 217k
  • Answers 217k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Obviously, there is no elegant solution. I chose the first… May 12, 2026 at 11:21 pm
  • Editorial Team
    Editorial Team added an answer Second div must float to right and next element should… May 12, 2026 at 11:21 pm
  • Editorial Team
    Editorial Team added an answer Yes, just like including any field in an index duplicates… May 12, 2026 at 11:21 pm

Related Questions

BACKGROUND: I use an offset into a file and the Filestream lock/unlock menthods to
I'm trying to figure out the best way to insert a record into a
I have been working with Exceptions lately. I think it makes sense to log
Sadly, I have a legacy PHP4 system that I continuously need to add features

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.