Re: Working with user space file descriptor in kernel thread

2025-03-11 Thread Michael van Elst
mo...@rodents-montreal.org (Mouse) writes: >> My question is: >> Can I use such retrieved file_fd or struct socket* so in separate >> kernel thread ? >I see no reason why not - but that is not at all the same as "yes". I >do not work with multiple threads often enough to feel confident of my >an

Re: Working with user space file descriptor in kernel thread

2025-03-11 Thread Mouse
> I have created two sockets with socketpair() and one of them is put > into kernel module through ioctl. [...] I am able to retrieve file > descriptor from user mode descriptor (int user_sock) : > file_fd = fd_getfile2(lewepe->l_proc, user_sock); Minor terminological point: the term "file descr

Re: Working with user space file descriptor in kernel thread

2025-03-11 Thread Martin Husemann
On Tue, Mar 11, 2025 at 03:08:15PM +0100, Peter Skvarka wrote: > > ... You can then use the socket directly in the kernel... > > Is this valid also when this socket is used by separate kernel thread ? > It is different than thread which runs in ioctl and provides socket. There is nothing thread-l

Re: Working with user space file descriptor in kernel thread

2025-03-11 Thread Peter Skvarka
... You can then use the socket directly in the kernel... Is this valid also when this socket is used by separate kernel thread ? It is different than thread which runs in ioctl and provides socket. Peter

Re: Working with user space file descriptor in kernel thread

2025-03-11 Thread Jason Thorpe
> On Mar 11, 2025, at 2:20 AM, Peter Skvarka wrote: > > Hello, > I have created two sockets with socketpair() and one of them is put into > kernel module through ioctl. > I need to work with passed socket in separate kernel thread. > In my module ioctl handler I am able to retrieve file descr

Working with user space file descriptor in kernel thread

2025-03-11 Thread Peter Skvarka
Hello, I have created two sockets with socketpair() and one of them is put into kernel module through ioctl. I need to work with passed socket in separate kernel thread. In my module ioctl handler I am able to retrieve file descriptor from user mode descriptor (int user_sock) : file_fd = fd_ge