我已经编写了一个程序 .c 和 Makefile。Makefile 创建了一个文件 .ko,之后我使用了以下命令:
sudo insmod filename.ko
sudo sysctl kernel.dmesg_restrict=0
dmesg | tail
结果,我收到了这样的字符串:
[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="unconfined"
[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="unconfined"
[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"
我没有修复这些问题。我发现问题与我的代码无关。我有 Ubuntu 22.04.2 LTS。我该怎么办?
我尝试让我的程序响应该命令:dmesg | tail
答案1
我应该怎么办?
没有什么。 当 snapped(SANDBOXED!)工具包运行并尝试访问不允许的函数调用时,这是标准行为。
您看到的是 Python AI Toolkit snap 的 jupyter 组件正在尝试调用ptrace
但未被允许。 ptrace
是一个执行此操作的系统调用(来自手册页):
The ptrace() system call provides a means by which one process
(the "tracer") may observe and control the execution of another
process (the "tracee"), and examine and change the tracee's
memory and registers. It is primarily used to implement
breakpoint debugging and system call tracing.
默认情况下,Snap 的 AppArmor 配置文件设置为拒绝 ptrace。这是标准行为你不需要做任何事物关于这些通知。
这些也与您正在使用的 C 代码无关。
请注意,这有绝对没有dmesg
与...有关一切与您正在执行的系统上运行的内容有关dmesg
。 dmesg
只是一个日志读取器/显示器。它不会生成此输出 - 它只是重播启动和内核日志中的内容。
您会在不同的系统和硬件上看到不同的输出因为它们都不同并且运行不同的软件。这就是为什么你会在不同的系统上看到不同的输出。