DragonFly BSD
DragonFly kernel List (threaded) for 2003-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

stackgap removal in linux_socket.c

From: "David P. Reese, Jr." <daver@xxxxxxxxxxxx>
Date: 28 Sep 2003 07:07:52 GMT

As I understand, stackgap_init() and stackgap_alloc() allow you to store
temporary data below the stack in a userland process.  I would like to make
sure that the following are in fact correct:

   1)  It is much faster to store data in the stackgap when compared to
       using real dynamic storage like MALLOC() because setting up the
       stackgap simply computes an offset in userspace.

   2)  The stackgap can only be used for a *very* temporary scratch space
       because you have no guarantee that a userland process won't trash
       what you are storing in the stackgap between syscalls.

In removing the use of the stackgap in linux_socket.c, I want to make sure
that I don't overlook a subtlety and shoot myself in the foot.

I would reason that anything small like an int could be defined as a local
variable instead of a stackgap variable while using MALLOC()/FREE() for
allocating large structures in the less often traveled code paths.

Why would anyone use the stackgap in the first place?

   David P. Reese, Jr.                                     daver@xxxxxxxxxxxx

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