Find the answer to your Linux question:
Results 1 to 4 of 4
Hello people, First of all, sorry for my english...I will try to do the best with my english. I would like to know if there is some mechanism to control ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2005
    Posts
    1

    Hello, how to control memory access


    Hello people,
    First of all, sorry for my english...I will try to do the best with my english.

    I would like to know if there is some mechanism to control the access to a memory address range (for reading or writting). I would like to control the access to a buffer and everytime that is accessed a signal advice me of this. For example, an assigment from one pointer to other one that points to the buffer which I pretend to control...

    I don't know if you understand me correctly, but thanks in advance.

  2. #2
    Just Joined!
    Join Date
    Mar 2005
    Posts
    38
    I'm not terribly knowledgeable in how Linux handles address spaces, but I guess my first question would be:

    Are you trying to check for memory access to memory allocated by the program you're writing? Or are you trying to check for memory access in another running program. These are generally two very different things and the second one, would probably require Kernel-level work. Again, I'm not very knowledgeable about this stuff in Linux, so someone can correct me if I'm wrong.

    If you are trying to check for memory access within a program that you're writing, I would think the best way to handle this would be to write wrapper functions for all access to the specified memory. Then you could isolate the accesses to a specific subset of the code and do whatever handling you want there.

  3. #3
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I'm really not sure what it is that you mean, but could it be the mprotect function that you're interested in? See its man page for details.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Enthusiast
    Join Date
    Jan 2005
    Posts
    575

    Re: Hello, how to control memory access

    Quote Originally Posted by keridito
    I would like to know if there is some mechanism to control the access to a memory address range (for reading or writting). I would like to control the access to a buffer and everytime that is accessed a signal advice me of this. For example, an assigment from one pointer to other one that points to the buffer which I pretend to control...
    So let's say you have two pointers p1 and p2 and p2 points inside
    the memory region you want to control.Do you want to receive
    a signal if a programme contains something like p1=p2; ?
    I doubt this is possible and in any case it doesn't count as memory
    access.Access is when you try to dereference a pointer which
    points inside the memory region you're interested in ie when you
    have something like a=*p2; That may be possible but I don't know how.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •