lkml.org 
[lkml]   [2009]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: RFC: disablenetwork facility. (v4)
From
Date
Pavel Machek wrote:
> Syscalls are very wrong granularity for security system. But easy to
> implement, see seccomp.

Quoting from http://en.wikipedia.org/wiki/Seccomp
> It allows a process to make a one-way transition into a "secure" state where
> it cannot make any system calls except exit(), read() and write() to
> already-open file descriptors.

I think seccomp() is too much restricted to apply for general applications.
Most applications will need some other syscalls in addition to exit(), read()
and write(). Most applications cannot use seccomp().

What I want to do is similar to seccomp(), but allows userland process to
forbid some syscalls like execve(), mount(), chroot(), link(), unlink(),
socket(), bind(), listen() etc. selectively.

Al Viro wrote:
>> Application writers know better what syscalls the application will call than
>> application users.
>
> Aren't you forgetting about libc? Seriously, any interface along the
> lines of "pass a set of syscall numbers to kernel" is DOA:

We can determine what syscalls we need from application's code and libc's code,
can't we?
Otherwise, I think disablenetwork can't be used. If we simply forbid use of
sendmsg() because application's code doesn't use UDP sockets, DNS requests (UDP
port 53) by libc's code cannot be handled and applications will stop working.
We must know what syscalls we need to allow when we forbid some syscalls.

> * syscall numbers are architecture-dependent
> * there are socketcall-style multiplexors (sys_ipc, anyone?)
> * libc is free to substitute one for another
> * libc is free to do so in arch-specific manner
> * libc is free to do so in kernel-revision-specific manner
> * libc is free to do so in libc-revision-specific manner
> (... and does all of the above)
> * new syscalls get added
> * e.g. on sparc64 32bit task can issue 64bit syscalls

I don't mean to tell the kernel by "syscall numbers".
To be able to handle socketcall-style multiplexors, we will need a hook inside
each syscall functions.


\
 
 \ /
  Last update: 2009-12-27 12:51    [W:0.200 / U:0.460 seconds]
©2003-2014 Jasper Spaans. Advertise on this site