From ecaa07c31a68bca0e4c8159d447e0b9ef7c5b350 Mon Sep 17 00:00:00 2001
From: Olivier Brunel <jjk@jjacky.com>
Date: Fri, 14 Apr 2017 22:50:31 +0200
Subject: [PATCH] Fix unable to list dirs w/ more than 31 items

Trying to list directories with more than 31 items would fail due to seccomp
filter being too strict:

ftp> ls dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
500 OOPS: 421 Service not available, remote server has closed connection

This was due to vsftpd calling qsort() and glibc in turn calling
sysinfo(), which wasn't allowed, hence SIGSYS.

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
---
 seccompsandbox.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/seccompsandbox.c b/seccompsandbox.c
index 2c350a9..13c8c78 100644
--- a/seccompsandbox.c
+++ b/seccompsandbox.c
@@ -297,6 +297,8 @@ seccomp_sandbox_setup_base()
   allow_nr_1_arg_mask(__NR_mprotect, 3, PROT_READ);
   allow_nr(__NR_munmap);
   allow_nr(__NR_brk);
+  allow_nr(__NR_sysinfo);
+  allow_nr(__NR_getdents64);
   /* glibc falls back gracefully if mremap() fails during realloc(). */
   reject_nr(__NR_mremap, ENOSYS);
 
-- 
2.12.2

