memcached/memcached — pull request #94 by viraptor (2014-12-13 09:43:25+00:00)
Title: Add drop_privileges() for Linux

Implement an aggressive version of drop_privileges(). Additionally add
similar initialization function for threads drop_worker_privileges().

This version is similar to Solaris one and prohibits memcached from
making any not approved syscalls. Current list narrows down the allowed
calls to socket sends/recvs, accept, epoll handling, futex (and
dependencies - mmap), getrusage (for stats), and signal / exit
handling. fcntl calls are restricted to F_GETFL/F_SETFL only.

Any incorrect behaviour will result in EPERM returned. This should be
restricted further to KILL in the future (after more testing).

The feature is only available for i386 and x86_64. No other
architectures were tested. It depens on bpf filters and seccomp
enabled in the kernel. Both are available since Linux 3.5.

Seccomp filtering can be enabled at compile time with
--enable-seccomp. Currently it breaks the test run - as expected,
because tests require filesystem access.