jarun / spy

:eyes: Linux kernel mode debugfs keylogger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about register_keyboard_notifier

GuyOded opened this issue · comments

Can you please share documentation about this function? Found none on the Internet...

commented

I have added a comment on what we are doing. You can find the function here:

https://elixir.bootlin.com/linux/v3.6/source/drivers/tty/vt/keyboard.c#L149

in brief, it adds a new notifier block (which has a callback function to be called when a console keyboard event happens) to a list of such blocks.

commented

After reading your mail I realized you are trying to figure out keyboard_notifier_list.

See https://elixir.bootlin.com/linux/v3.6/source/drivers/tty/vt/keyboard.c#L143. Now ATOMIC_NOTIFIER_HEAD is a macro which is defined in

https://elixir.bootlin.com/linux/v3.6/source/include/linux/notifier.h#L103

It's a structure that initializes with an unlocked spinlock and a NULL head pointer. Once setup, when you call register_keyboard_notifier, the notifier_block struct you pass is set as the head of the list.

commented

When it's the kernel, in many cases you may really have to look into the code to figure out what's going on. On practice (and not necessarily on Linux kernel code only), it becomes simpler.