Story Details

  • Disabling kernel functions in your process (2009)

    Posted: 2025-05-21 02:22:25

    The blog post describes a method to disable specific kernel functions within a user-space process by intercepting system calls. It leverages the ptrace system call to attach to a process, modify its system call table entries to point to a custom function, and then detach. The custom function can then choose to emulate the original kernel function, return an error, or perform other actions, effectively blocking or altering the behavior of targeted system calls for the specified process. This technique allows for granular control over kernel interactions within a user-space process, potentially useful for security sandboxing or debugging.

    Summary of Comments ( 6 )
    https://news.ycombinator.com/item?id=44047741

    HN commenters discuss the blog post's method of disabling kernel functions by overwriting the system call table entries with int3 instructions. Several express concerns about the fragility and unsafety of this approach, particularly in multi-threaded environments and due to potential conflicts with security mitigations like SELinux. Some suggest alternatives like using LD_PRELOAD to intercept and redirect function calls or employing seccomp-bpf for finer-grained control. Others question the practical use cases for this technique, acknowledging its potential for debugging or specialized security applications but cautioning against its general use. A few commenters share anecdotal experiences or related techniques, like disabling ptrace to hinder debuggers. The overall sentiment is one of cautious curiosity mixed with skepticism regarding the robustness and practicality of the described method.