Re: closefd: closes a file of any process

From: Tigran Aivazian (tigran@veritas.com)
Date: Fri Jun 23 2000 - 11:13:08 EST


Hi,

closing a file descriptor of another process context is a serious task -
one could probably write a 200-page book about it and still not know how
to do it quite yet.

Anyway, of course, your simple module has serious problems:

a) POSIX (and probably non-POSIX) locks subsystem needs rewrite before one
can release locks from non-current context.

b) you bravely access p->files without any locking - that is broken

c) you need not emulate put_unused_fd() for non-current context - this is
rge *very* reason why I wrote __put_unused_fd() to allow passing p->files
as a parameter (of course caller needs to lock files->file_lock) which you
do not do, btw.

Regards,
Tigran

PS. I spent about 3 weeks working on these (and related) issues and had to
write a separate filesystem to overcome the various problems. It should be
available late July.

PPS. You could write another module called munmap.o and another fchroot
and another fchdir and another catch_rights_dgram_in_flight.o or if you
see what I mean :)

 On Fri, 23 Jun 2000 uaca@alumni.uv.es wrote:

>
> Hi all
>
> maybe some of you are interested in this:
>
> * closefd: closes a file descriptor of any process
> *
> * >>>>>>>>>>>>>>>>>>> FOR USE IN 2.2.X KERNELS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> *
> * Example: insmod closefd.o pid=<num. of process> fd=<num. of file descriptor>
> *
> * Notes:
> * - Always returns EBUSY, there is nothing to worry about, this
> * allows automatically unload
> * - It's SMP safe
> *
>
> please send me your comments to uaca@alumni.NO_SPAM.uv.es
>
> http://freshmeat.net/appindex/2000/06/22/961682188.html
>
>
>
> Debian/GNU Linux: a dream come true
> -----------------------------------------------------------------------------
> "Computers are useless. They can only give answers." Pablo Picasso
>
> ---> Visita http://www.valux.org/ para saber acerca de la <---
> ---> Asociación Valenciana de Usuarios de Linux <---
>
>
> -
> 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/
>

-
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/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:26 EST