In our previous kernel module demo (ch6/current_affairs/current_affairs.c), you noticed, I hope, the usage of printk with the 'special' %pK format specifier. We repeat the relevant code snippet here:
pr_info(
[...]
" current (ptr to our process context's task_struct) :\n"
" 0x%pK (0x%px)\n"
" stack start : 0x%pK (0x%px)\n",
[...]
current, (long unsigned)current,
current->stack, (long unsigned)current->stack); [...]
Recall from our discussion in Chapter 5, Writing Your First Kernel Module – LKMs Part 2, in the Proc filesystem tunables affecting the system log section, that when printing an address (firstly, you really shouldn't be printing addresses in production) I urged you to not use the usual %p (or %px) but the %pK format specifier instead. That's what we've done in the preceding code; this is for security, to prevent a kernel information...