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

Re: stackgap removal in linux_socket.c

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

In article <slrnbnd29r.1pn1.daver@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>, David P. Reese, Jr. wrote:
> 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?

Crud...  I just figured out my answer to my question.  You can't copyin from
kernel space.  Thank god I can remove the stackgap code with the new split

   David P. Reese, Jr.                                     daver@xxxxxxxxxxxx

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