lkml.org 
[lkml]   [1999]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: A good reason to use vfork()
Theodore Y. Ts'o writes:
> The problem with the default is at least in theory, every single text
> page could get modified if a debugger attached to the process and set
> breakpoints everywhere.

Excellent point.

> Therefore, Digital Unix doesn't allow a process to fork() unless it can
> commit swap space for every single text and data page for the process.

As I understand it, HP-UX has an interesting way of dealing with this. If
an executable's or shared library's file permissions are read-only, it is
assumed you won't debug it. If an executable or shared library has file
permissions that allow writing by *anyone*, it is assumed you might debug
it. I believe this is checked once at the time of exec() and never again.
Not infallible, but not a bad guess either.

Tradeoff: Once a page is read-only, you don't have the option of setting a
breakpoint on that page. At least this algorithm gives you the *option* of
either behavior (memory saving vs. debugging) via toggling file
permissions.

Removing all write permissions from executables and shared libraries on
HP-UX is a nice, but little known, optimization. I don't know if this is
specific to HP-UX, but so far have only heard of this in reference to
HP-UX.

OT: You can wreak havoc by setting breakpoints in libc.
Impress your friends. :-o

Regards,
Chuck

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.126 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site