I have written a program .c and Makefile. Makefile created a file .ko, afer this I used the next commands:
sudo insmod filename.ko sudo sysctl kernel.dmesg_restrict=0 dmesg | tail
As result, I recieved such strings:
[169396.221688] audit: type=1400 audit(1697726842.148:30133473): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined" [169396.221693] audit: type=1400 audit(1697726842.148:30133474): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined" [169396.221695] audit: type=1400 audit(1697726842.148:30133475): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined" [169396.221706] audit: type=1400 audit(1697726842.148:30133476): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined" [169396.221745] audit: type=1400 audit(1697726842.148:30133477): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="/usr/sbin/cupsd" [169396.221760] audit: type=1400 audit(1697726842.148:30133478): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="/usr/sbin/cups-browsed" [169396.221881] audit: type=1400 audit(1697726842.148:30133479): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined" [169396.221890] audit: type=1400 audit(1697726842.148:30133480): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined" [169396.221903] audit: type=1400 audit(1697726842.148:30133481): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined" [169396.221917] audit: type=1400 audit(1697726842.148:30133482): apparmor="DENIED" operation="ptrace" class="ptrace" profile="snap.python-ai-toolkit.jupyter" pid=1133 comm="python3" requested_mask="read" denied_mask="read" peer="unconfined"
My code is:
#include <linux/module.h>
#include <linux/init.h>
/* Meta Information */
MODULE_LICENSE("GPU");
MODULE_AUTHOR("Johannes 4 GNU/Linux");
MODULE_DESCRIPTION("A hello world LKM");
/**
* @brief This function is called, when the module is loaded into the kernel
**/
static int __init ModuleInit(void) {
printk("Hello, Kernel!\n");
return 0;
}
/**
* @brief This function is called, when the module is removed from the kernel
* */
static void __exit ModuleExit(void) {
printk("Goodbye, Kernel\n");
}
module_init(ModuleInit);
module_exit(ModuleExit);
And Makefile:
obj-m += mymodule.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
I didn't manage fix those. I have Ubuntu 22.04.2 LTS. What should I do?
I tried that my program responds the command: dmesg | tail