From owner-p4-projects@FreeBSD.ORG Wed Feb 3 22:30:00 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A1B87106568B; Wed, 3 Feb 2010 22:30:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 665DC1065670 for ; Wed, 3 Feb 2010 22:30:00 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3E8EE8FC0A for ; Wed, 3 Feb 2010 22:30:00 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o13MU0T4028753 for ; Wed, 3 Feb 2010 22:30:00 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o13MU01c028751 for perforce@freebsd.org; Wed, 3 Feb 2010 22:30:00 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 3 Feb 2010 22:30:00 GMT Message-Id: <201002032230.o13MU01c028751@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 174284 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2010 22:30:00 -0000 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 }, };