RedPill-TTG / redpill-lkm

Linux kernel module for RedPill
GNU General Public License v3.0
307 stars 168 forks source link

Optimize cmdline lookup #11

Closed ttg-public closed 3 years ago

ttg-public commented 3 years ago

See https://github.com/RedPill-TTG/redpill-lkm/commit/8eea128f229ad7df1e17aa140bcc04e67673056c

@jumkey made a great suggestion here - we think it may work wonderfully and doesn't compromise the functionality.

ttg-public commented 3 years ago

This is actually more needed than we were thinking as the official toolkit for v7 obviously doesn't contain private procfs headers. Well then...

ttg-public commented 3 years ago

Implemented in https://github.com/RedPill-TTG/redpill-lkm/commit/0839dadba1f5ef40a35972c9e201b1d4eada9b5c

Thank you @jumkey!

ttg-public commented 3 years ago

So the kern_path was a small trap - it works while testing but not when loaded on boot. When RP is loaded too early (i.e. before /proc is mounted) the lookup will fail. We added an alternative method - "mounting" the /proc in kernel and getting the dentry from VFS directly (completely bypassing any user-space side-effects).

https://github.com/RedPill-TTG/redpill-lkm/commit/9b65d3ec1da8bae68a34df539eaa39696f967c99