tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: hand over arg/env pages on exec (was: Deadlock on fragmented memory?)



    Date:        Wed, 25 Oct 2017 11:29:34 +0200
    From:        Edgar =?iso-8859-1?B?RnXf?= <ef%math.uni-bonn.de@localhost>
    Message-ID:  <20171025092934.GV73396%trav.math.uni-bonn.de@localhost>

  | vfork childs aside, the kernel could just zero out what it wouldn't copy; 
  | no new interface needed.

Yes, it could, but it should not need to.

  | However, how do you deal with the case that the strings are scattered
  | around the dying process' address space?

The old way.

  | Or is it intentional to have a new exec interface only to be used when the 
  | caller knows the arguments are contigous?

Yes, intentional - processes using it would have to know what they're
doing, and deliberately plan to set things up correctly.   (Maybe there
could be a library function to help, but it might not.)

There are all kinds of issues, like the arg pointers, which can be just
as much an issue as the args themselves - I would have the calling
process make those be page relative offsets (from the start of the
arg list (or env list) and then have the exec code create a new list
of pointers by (validating and then) adding the base addr of the arg
pages in the new process's addr space (a separate copy, so the
originals remain - which isn't important for the args, but allows the
env to simply be passed along unchanged, and the kernel could detect
that).   Perhaps.

kre



Home | Main Index | Thread Index | Old Index