Re: Fwd: Need Help regarding Reading and Writting to a file from kernel function file

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

 



On Tue, Sep 24, 2019 at 04:10:07PM +0900, Sahibzada Irfanullah wrote:
> Dear Sir,
> Hope you are doing well. Actually, I have one problem metioned in the
> subject line. The problem is:  I am trying to write/read page faulted
> physical addresses to a file in a kernel (v5.3-1) function, i.e.,
> handle_ept_violation() which is present in vmx.c. I have followed this
> <https://stackoverflow.com/questions/1184274/read-write-files-within-a-linux-kernel-module>,
> it's working as a standalone kernel module when I load/unload this kernel
> module, but when I try to use this code in the handle_ept_violation()
> function, I can't able to open the file and get the error codes, i.e., -2,
> -3, or -13. It's compiled successfully but generate the error at runtime. I
> searched for error codes online but I didn't find any help.
> Can anyone please provide me with any good guidlines, or links where I can
> start and solve this problem in a fast way.

Please do not try to read or write a file from within the kernel, that
way almost always lies madness and major problems.

Step back and try to describe the problem you are attempting to solve
here first.  Odds are it can be done in a much better way.

Also, do you have a pointer to your code anywhere?

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux