Re: unsafe functions from signal handler
- From: John Reiser <jreiser@xxxxxxxxxxxx>
- Date: Sun, 05 Feb 2006 07:18:45 -0800
I'm trying to determine if a pointer is writable.
Of course the pointer itself is writable! Perhaps you wish
to determine whether the designated memory is writable. If so,
then open, read and parse /proc/self/maps . [Curse and swear
because the filenames are not quoted.] Or, create a temporary file,
then attempt a filesystem _read_ operation read(fd, ptr, sizeof(*ptr))
and see if the operating system returns sizeof(*ptr) instead of -1
with EFAULT. Some authorities deprecate this use of read(),
but it is fully standards-compliant.
... I suspect it is because
the address being written to is no longer being read from the variable,
but is already in a register. How do I achieve the desired result?
Adding 'volatile' _might_ work: "char *volatile ptr".
Otherwise, there is no substitute for a disassembler
and intimate machine knowledge.
--
.
- References:
- Re: unsafe functions from signal handler
- From: bill pursell
- Re: unsafe functions from signal handler
- From: bill pursell
- Re: unsafe functions from signal handler
- Prev by Date: Re: unsafe functions from signal handler
- Next by Date: Re: read() system call
- Previous by thread: Re: unsafe functions from signal handler
- Next by thread: Re: unsafe functions from signal handler
- Index(es):
Relevant Pages
|