Code Monkey home page Code Monkey logo

Comments (13)

cormander avatar cormander commented on July 21, 2024

This is due to a run time safety check that's failing. Can you give me the output of this command?

grep ftrace_enabled /proc/kallsyms

For example:

$ grep ftrace_enabled /proc/kallsyms
ffffffff81140480 t ftrace_enabled_open
ffffffff816c0700 r ftrace_enabled_fops
ffffffff81ae40e0 D ftrace_enabled
ffffffff81e6abc4 b kprobe_ftrace_enabled
ffffffff81ee9388 b last_ftrace_enabled

What's happening is it can't find the ftrace_enabled symbol - or it contains something it doesn't expect.

from tpe-lkm.

cormander avatar cormander commented on July 21, 2024

Also, I pushed cb8289c which adds additional logging when there's a problem. You'll see it by running the below after module insert:
sudo dmesg | grep fopskit

from tpe-lkm.

 avatar commented on July 21, 2024
grep ftrace_enabled /proc/kallsyms
ffffffffa112b870 t ftrace_enabled_open
sudo dmesg | grep fopskit
fopskit: fopskit_find_sym_addr() failed with return code -14 for fops_hook { name => ftrace_enabled, addr => 0, found => 0, hooked => 0 } at fopskit_find_sym_addr() line 217

from tpe-lkm.

cormander avatar cormander commented on July 21, 2024

Do you have the kernel.kptr_restric sysctl enabled? Arch Linux appears to enable this by default and may be what's causing the issue. See:

https://bugs.archlinux.org/task/34323

I downloaded the kernel-ml-4.11 package on my CentOS system and this module still goes in fine.

from tpe-lkm.

 avatar commented on July 21, 2024

I had it enabled previously. Above results are with kernel.kptr_restric sysctl=0.
With kernel.kptr_restric sysctl=1 it looks like this:

grep ftrace_enabled /proc/kallsyms
0000000000000000 t ftrace_enabled_open

Here's grep ftrace /proc/kallsyms
ftrace.txt

sysctl -a |grep kernel
sysctl.txt

from tpe-lkm.

cormander avatar cormander commented on July 21, 2024

Do you have CONFIG_DEBUG_INFO=y set in the kernel? I'm also reading how archlinux strips some symbols from the kernel while packaging. If this is the case, symbol address discovery would only be possible with a corresponding System.map of the running kernel, which adds risk of causing a fault on module insert. I haven't used archlinux before, so addressing this issue may take me some time.

from tpe-lkm.

 avatar commented on July 21, 2024
zcat /proc/config.gz | grep CONFIG_DEBUG_INFO
# CONFIG_DEBUG_INFO is not set

Should I recompile it?

from tpe-lkm.

cormander avatar cormander commented on July 21, 2024

This module is meant to be inserted into precompiled distribution kernels. If you're compiling your own, the better approach is to include tpe at compile time. This module will require some changes to get that enabled - would you prefer that approach?

from tpe-lkm.

 avatar commented on July 21, 2024

# CONFIG_DEBUG_INFO is not set is the default option in every Arch kernel, I didn't touch it. Anyway enabling this didn't change anything.

I really don't want to add more burden on you. Of course I can try compiling it with kernel if it's available but if I'm only one who needs this it wouldn't be worth your time.

from tpe-lkm.

cormander avatar cormander commented on July 21, 2024

Testing on Linux archiso 4.10.13-1-ARCH, if I simply remove the ftrace_enabled check it compiles and inserts just fine. Test suite passes. Except, when I rmmod tpe - the kernel panics. The stack trace shows kernel BUG at mm/vmalloc.c:15471 and none of the symbols on the stack are TPE related. Just an FYI.

Please test on your system, letting me know if it faults when you do the rmmod tpe.

Thanks,

from tpe-lkm.

cormander avatar cormander commented on July 21, 2024

Pushed commit 44e9f0a which moves the ftrace_enabled check to where it's really needed, which isn't a code path taken on archlinux. Please let me know if this resolves the issue for you.

from tpe-lkm.

 avatar commented on July 21, 2024
sudo modprobe tpe
fopskit: fopskit_find_sym_addr() failed with return code -14 for fops_hook { name => selinux_enabled, addr => 0, found => 0, hooked => 0 } at fopskit_find_sym_addr() line 223
fopskit: fopskit_find_sym_addr() failed with return code -14 for fops_hook { name => selinux_disabled, addr => 0, found => 0, hooked => 0 } at fopskit_find_sym_addr() line 223
tpe: warning: cred->security was not remapped; the soften_mmap flag won't persist to child processes.
tpe: added to kernel

Module loaded. Arch didn't enable selinux by default. Could this be the issue? I enabled softmode in tpe config.
sudo rmmod tpe
dmesg.txt
Kernel didn't panic. Module unloaded.

from tpe-lkm.

cormander avatar cormander commented on July 21, 2024

Ok so you're at least now in a working state. Don't turn on SELinux - you'll then fail to inset the module, as the ftrace_enabled check only happens if SELinux is enabled. What happens if it is, is soften_mmap xattr flags, is any exist, will persist to child processes. Mostly this is only needed on desktops (Gnome) and byte compile build machines (such as Jenkins). It's only bee tested on kernels with SELinux, and I turn it off at insert time if it isn't enabled for safety. The cred->remap could collide with how other security module alloc memory.

Closing this issue since you're in a working state. If you so desire, send along that module unload dmesg to archlinux. It doesn't happen on my system with an unmodified 4.11 vanilla kernel.

from tpe-lkm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.