What I don't understand though is the incentive, what motivates a program-author to "[b]e careful writing such diffs; you need to fully understand the program and handle all cases"?
What I don't understand though is the incentive, what motivates a program-author to "[b]e careful writing such diffs; you need to fully understand the program and handle all cases"?
At the moment the motivation is to armor existing code, but the general case for tame across its entire lifespan is to be used in new code. In that case the motivation is the same as any other security practice... not to see your code be fingered as the vulnerability that let $BAD_THING happen.
This a very smart application of the least privilege principle. The idea is that most programs don't need most syscalls after they complete their initialization, and thus dropping the privilege to use them is both cheap, safe and effective.
However, in terms of things like "which files will this program need to access", the system administrator is in a much better position, because these kinds of questions often depend on how the program is used in a particular environment.
The approaches are complementary.
It might be interesting adding the ability to do something like:
#define TAME_ENABLE
#define TAME_ENABLE_FOO
#define TAME_ENABLE_BAR
#include <foo.h>
which would cause a compile error by removing declarations for uncallable functions.>Some BPF-style approaches have showed up. So you need to write a program to observe your program, to keep things secure? That is insane.
>So I asked myself if I could invent a simple system call, which people would place directly into programs, between initialization and main-loop.
>Subsequent calls to tame() can reduce abilities further, but abilities can never be regained.
What you are suggesting is not compatible with tame.
The only thing that my suggestion optionally changes is that using, eg, socket() would be a compile time error AND a runtime error, instead of only a runtime error, if you tell the system that you want it. Don't define the macros to disable functions that you are trying to make uncallable? Your code is 100% unaffected.
It just prevents random-seeming issues off of the common path due to calling a function that you shouldn't have called.