In a process context kernel_read returns -EINTR, how to proceed?

Greg KH greg at
Fri Dec 21 09:00:55 EST 2018

On Fri, Dec 21, 2018 at 04:51:29PM +0300, Lev Olshvang wrote:
> Hi Valdis,
> I need to read file  inside LSM hook and I can not do it in user space
> I forgot o mention that same error occurried  both in 4.4 and 4.13 kernels
>  What alternative you can recommend to read file in kernel and avoid -EINTR?
> Is vfs_read() different from kernel_read() ?

You should never try to read a file from within the kernel.

That way lies madness and lots and lots and lots of problems.

You really are on your own if you want to do that, you should step back
and reconsider exactly what you are trying to do and redesign your
system to not try to ever do this.

good luck!

greg k-h

More information about the Kernelnewbies mailing list