I was not talking about 2.2 at all. Not even 2.3. Unlikely 2.4. Maybe 2.5.
What we discuss here is the ability to close another process' file
descriptors in the kernel. Initially, I thought it to be impossible
because POSIX locks were referring to 'current' but Ulisses corrected me
that it is not the case in the do_close() code path.
Therefore, let us look at the possibility of having this:
static inline int
__do_close(struct files_struct *files, unsigned int fd, int release)
{
same stuff as current do_close except 'files' is an argument
}
int do_close(unsigned int fd, int release)
{
return __do_close(current->files, fd, release);
}
do you see any problems with this? I.e. for arbitrary process context to
just pick a process p and call __do_close(p->files, fd, 1)?
I think if we are in __do_close(p->files, fd, 1) and the process 'p' is
inside, for example, sys_close(fd, 1) which called do_close(), it will
have troubles. What troubles? Well, if the check for EBADF possibility
has been done then we will be releasing resources twice - certainly not
right. Do you agree with this?
Therefore, I mentioned a possibility of adding a rw semaphore to struct
file, which would be taken read in fget and write in do_close. I am not
100% sure this will work. Do you have a better idea?
Regards,
Tigran
-
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/