Date: Wed, 3 Feb 2010 22:30:00 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 174284 for review Message-ID: <201002032230.o13MU01c028751@repoman.freebsd.org>
index | next in thread | raw e-mail
http://p4web.freebsd.org/chv.cgi?CH=174284 Change 174284 by rwatson@rwatson_vimage_client on 2010/02/03 22:29:44 Micro-benchmarks for chroot() and setuid(). Affected files ... .. //depot/projects/trustedbsd/capabilities/src/tools/tools/syscall_timing/syscall_timing.c#14 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/tools/tools/syscall_timing/syscall_timing.c#14 (text+ko) ==== @@ -565,6 +565,38 @@ benchmark_stop(); } +void +test_chroot(int num) +{ + int i; + + if (chroot("/") < 0) + err(-1, "test_chroot: chroot"); + benchmark_start(); + for (i = 0; i < num; i++) { + if (chroot("/") < 0) + err(-1, "test_chroot: chroot"); + } + benchmark_stop(); +} + +void +test_setuid(int num) +{ + uid_t uid; + int i; + + uid = getuid(); + if (setuid(uid) < 0) + err(-1, "test_setuid: setuid"); + benchmark_start(); + for (i = 0; i < num; i++) { + if (setuid(uid) < 0) + err(-1, "test_setuid: setuid"); + } + benchmark_stop(); +} + /* * A bit like sandbox, in that a process is forked, IPC ping-pong is done, * but with none of the sandboxing goo. @@ -773,6 +805,8 @@ { "fork_exec", test_fork_exec }, { "vfork_exec", test_vfork_exec }, { "pdfork_exec", test_pdfork_exec }, + { "chroot", test_chroot }, + { "setuid", test_setuid }, { "pingpong", test_pingpong }, { "sandbox", test_sandbox }, };help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002032230.o13MU01c028751>
