Skip to main content
Explain the requirement in more detail.
Source Link
Stephen Kitt
  • 484k
  • 60
  • 1.2k
  • 1.4k

You’re not initialising the kprobe structure in full, so you’re failing the exclusive or requirement between symbol_name and addr (point 3 in the table in the register_kprobe documentation): addr contains whatever is on the stack on function entry, which is likely to be non-zero, so both symbol_name and addr are non-zero and register_kprobe fails with EINVAL (22).

You can fix this as follows:

 int ret; struct kprobe kp = { .symbol_name = name }; unsigned long retval; 

which will ensure that the other members of the structure are initialised to their default values.

You’re not initialising the kprobe structure in full, so you’re failing the exclusive or requirement between symbol_name and addr (point 3 in the table in the register_kprobe documentation): addr contains whatever is on the stack on function entry.

You can fix this as follows:

 int ret; struct kprobe kp = { .symbol_name = name }; unsigned long retval; 

which will ensure that the other members of the structure are initialised to their default values.

You’re not initialising the kprobe structure in full, so you’re failing the exclusive or requirement between symbol_name and addr (point 3 in the table in the register_kprobe documentation): addr contains whatever is on the stack on function entry, which is likely to be non-zero, so both symbol_name and addr are non-zero and register_kprobe fails with EINVAL (22).

You can fix this as follows:

 int ret; struct kprobe kp = { .symbol_name = name }; unsigned long retval; 

which will ensure that the other members of the structure are initialised to their default values.

Source Link
Stephen Kitt
  • 484k
  • 60
  • 1.2k
  • 1.4k

You’re not initialising the kprobe structure in full, so you’re failing the exclusive or requirement between symbol_name and addr (point 3 in the table in the register_kprobe documentation): addr contains whatever is on the stack on function entry.

You can fix this as follows:

 int ret; struct kprobe kp = { .symbol_name = name }; unsigned long retval; 

which will ensure that the other members of the structure are initialised to their default values.