Thread (9 messages) 9 messages, 3 authors, 2015-11-29

Re: [PATCH iproute2 -next v2 4/5] {f,m}_bpf: allow updates on program arrays

flat view

From: Hannes Frederic Sowa <hidden>
Date: 2015-11-26 15:19:30

On Thu, Nov 26, 2015, at 15:38, Daniel Borkmann wrote:
+static int bpf_mnt_fs(const char *target)
+{
+       bool bind_done = false;
+
+       while (mount("", target, "none", MS_PRIVATE | MS_REC, NULL)) {
+               if (errno != EINVAL || bind_done) {
+                       fprintf(stderr, "mount --make-private %s failed:
%s\n",
+                               target, strerror(errno));
+                       return -1;
+               }
+
+               if (mount(target, target, "none", MS_BIND, NULL)) {
+                       fprintf(stderr, "mount --bind %s %s failed:
%s\n",
+                               target, target, strerror(errno));
+                       return -1;
+               }
+
+               bind_done = true;
+       }
Why does user space actually still have to deal with setting the mount
point private? Isn't this handled by the kernel?
quoted hunk ↗ jump to hunk
+       if (mount("bpf", target, "bpf", 0, NULL)) {
+               fprintf(stderr, "mount -t bpf bpf %s failed: %s\n",
+                       target, strerror(errno));
+               return -1;
+       }
Shouldn't this be just enough?
+       return 0;
+}
Thanks,
Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help