Re: unsafe functions from signal handler



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.

--
.



Relevant Pages

  • Re: slocate bug.
    ... >> Just out of curiosity, ... in code that takes filenames in from directories. ... filesystems now supported under each operating system its been ported to. ... the Solaris support is only 9 months old, ...
    (Vuln-Dev)
  • RE: Bug in glob.glob for files w/o extentions in Windows
    ... More accurate would be to say that the operating system has consistent but ... are stripped from filenames and ignored from file patterns. ... own pattern matching on them. ...
    (comp.lang.python)
  • Re: hello world programme
    ... undefined behaviour -- the operating system might pick up any random ... pointer to the called routine, and that the called routine was ...
    (comp.lang.c)
  • problems with the cursor
    ... Which operating system are you running on your computer? ... I remember Windows 98/ME and Windows NT 3.51 giving you ... the option of changing your mouse pointer to a dinosaur (I ... you the option to "uninstall driver". ...
    (microsoft.public.win2000.general)
  • Re: Is PSHUFW instruction MMX or SSE or SSE2? Is NASM manual correct?
    ... operating system. ... and the system fields would be at negative offsets from this pointer. ... prepend the info to the larger allocated memory blocks, strings, data, etc.? ... Why pollute a scarce resource like the stack with a bunch of header ...
    (alt.lang.asm)