Skip to content

Commit

Permalink
Block netlink mmap sockets in syscallbuf
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed May 21, 2020
1 parent e62c972 commit bbebba2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/preload/syscallbuf.c
Expand Up @@ -61,6 +61,7 @@
#include <linux/ioctl.h>
#include <linux/mman.h>
#include <linux/net.h>
#include <linux/netlink.h>
#include <linux/perf_event.h>
#include <linux/ptrace.h>
#include <linux/quota.h>
Expand All @@ -81,6 +82,10 @@
#include "preload_interface.h"
#include "rr/rr.h"

#ifndef SOL_NETLINK
#define SOL_NETLINK 270
#endif

#ifndef BTRFS_IOCTL_MAGIC
#define BTRFS_IOCTL_MAGIC 0x94
#endif
Expand Down Expand Up @@ -2578,6 +2583,11 @@ static long sys_setsockopt(const struct syscall_info* call) {
// Let rr intercept this (and probably disable it)
return traced_raw_syscall(call);
}
if (level == SOL_NETLINK &&
(optname == NETLINK_RX_RING || optname == NETLINK_TX_RING)) {
// Let rr intercept this (and probably disable it)
return traced_raw_syscall(call);
}

void* ptr = prep_syscall_for_fd(sockfd);
long ret;
Expand Down

0 comments on commit bbebba2

Please sign in to comment.