class FrrCliFuzzer::LinuxNamespace
Public Class Methods
new()
click to toggle source
# File lib/frr-cli-fuzzer/linux_namespace.rb, line 3 def initialize fork_and_unshare do # This is the init process of the new PID namespace. We need to reap # the zombies. trap(:CHLD) { Process.wait } trap(:INT, :IGNORE) sleep end end
Public Instance Methods
mount_proc()
click to toggle source
Mount the proc filesystem (useful after creating a new PID namespace).
# File lib/frr-cli-fuzzer/linux_namespace.rb, line 57 def mount_proc LibC.mount("none", "/proc", nil, LibC::MS_REC | LibC::MS_PRIVATE, nil) LibC.mount("proc", "/proc", "proc", LibC::MS_NOSUID | LibC::MS_NOEXEC | LibC::MS_NODEV, nil) end
mount_propagation(flags)
click to toggle source
Set the mount propagation of the process.
# File lib/frr-cli-fuzzer/linux_namespace.rb, line 52 def mount_propagation(flags) LibC.mount("none", "/", nil, flags, nil) end
nsenter()
click to toggle source
nsenter(1) is a standard tool from the util-linux package. It can be used to run a program with namespaces of other processes.
# File lib/frr-cli-fuzzer/linux_namespace.rb, line 65 def nsenter "nsenter -t #{@pid} --mount --pid --net" end