1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:58:11 +00:00

Tests: Add Kernel tests for unveil system call browse 'b' flag

This commit is contained in:
Brendan Coles 2020-11-28 07:03:28 +00:00 committed by Andreas Kling
parent 7dd77020ae
commit 2adcdbcc1e

View file

@ -31,7 +31,7 @@ int main()
{
int res = unveil("/etc", "r");
if (res < 0) {
perror("unveil");
fprintf(stderr, "FAIL, unveil read only failed\n");
return 1;
}
@ -59,13 +59,37 @@ int main()
return 1;
}
res = unveil("/home", "b");
if (res < 0) {
fprintf(stderr, "FAIL, unveil browse failed\n");
return 1;
}
res = unveil("/home", "w");
if (res >= 0) {
fprintf(stderr, "FAIL, unveil write permitted after unveil browse only\n");
return 1;
}
res = unveil("/home", "x");
if (res >= 0) {
fprintf(stderr, "FAIL, unveil execute permitted after unveil browse only\n");
return 1;
}
res = unveil("/home", "c");
if (res >= 0) {
fprintf(stderr, "FAIL, unveil create permitted after unveil browse only\n");
return 1;
}
res = unveil(nullptr, nullptr);
if (res < 0) {
fprintf(stderr, "FAIL, unveil state lock failed\n");
return 1;
}
res = unveil("/home", "w");
res = unveil("/bin", "w");
if (res >= 0) {
fprintf(stderr, "FAIL, unveil permitted after unveil state locked\n");
return 1;