Module: FrrCliFuzzer::LibC

Defined in:
lib/frr-cli-fuzzer/libc.rb

Overview

Bindings for a few libc“s functions.

Defined Under Namespace

Classes: Bindings

Constant Summary collapse

CLONE_NEWNS =

include/uapi/linux/sched.h

0x00020000
CLONE_NEWPID =
0x20000000
CLONE_NEWNET =
0x40000000
MS_NOSUID =

include/uapi/linux/fs.h

(1 << 1)
MS_NODEV =
(1 << 2)
MS_NOEXEC =
(1 << 3)
MS_REC =
(1 << 14)
MS_PRIVATE =
(1 << 18)
PR_SET_PDEATHSIG =

include/uapi/linux/prctl.h

1
PR_SET_CHILD_SUBREAPER =
36

Class Method Summary collapse

Class Method Details

.mount(source, target, fs_type, flags, data) ⇒ Object

Wrapper for mount(2).



16
17
18
19
20
# File 'lib/frr-cli-fuzzer/libc.rb', line 16

def self.mount(source, target, fs_type, flags, data)
  if Bindings.mount(source, target, fs_type, flags, data) < 0
    raise SystemCallError.new("mount failed", FFI::LastError.error)
  end
end

.prctl(option, arg2, arg3, arg4, arg5) ⇒ Object

Wrapper for prctl(2).



30
31
32
33
34
# File 'lib/frr-cli-fuzzer/libc.rb', line 30

def self.prctl(option, arg2, arg3, arg4, arg5)
  if Bindings.prctl(option, arg2, arg3, arg4, arg5) == -1
    raise SystemCallError.new("prctl failed", FFI::LastError.error)
  end
end

.unshare(flags) ⇒ Object

Wrapper for unshare(2).



23
24
25
26
27
# File 'lib/frr-cli-fuzzer/libc.rb', line 23

def self.unshare(flags)
  if Bindings.unshare(flags) < 0
    raise SystemCallError.new("unshare failed", FFI::LastError.error)
  end
end