From owner-p4-projects@FreeBSD.ORG Fri Jun 19 12:44:30 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E43A51065679; Fri, 19 Jun 2009 12:44:29 +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 A482A1065675 for ; Fri, 19 Jun 2009 12:44:29 +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 90D878FC16 for ; Fri, 19 Jun 2009 12:44:29 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5JCiTgF024970 for ; Fri, 19 Jun 2009 12:44:29 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 n5JCiTPb024968 for perforce@freebsd.org; Fri, 19 Jun 2009 12:44:29 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Fri, 19 Jun 2009 12:44:29 GMT Message-Id: <200906191244.n5JCiTPb024968@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 Cc: Subject: PERFORCE change 164706 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 12:44:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=164706 Change 164706 by rwatson@rwatson_freebsd_capabilities on 2009/06/19 12:43:48 After a very confusing debugging session, only run 'cap_main' for sandbox-mode binaries, don't fall back to 'main' as frequently that will be code unintended to run in sandbox mode. Affected files ... .. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/rtld-elf-cap.1#7 edit .. //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf/rtld.c#20 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf-cap/rtld-elf-cap.1#7 (text+ko) ==== @@ -60,8 +60,8 @@ .It Recognizes the addition symbol .Dv cap_main , -which will be used in preference to the normal ELF entry point for a binary -when in sandbox mode. +which will be used instead of the normal ELF entry point for a binary when in +sandbox mode. This makes it easy a single binary to select different behavior when run in the different environments. .It ==== //depot/projects/trustedbsd/capabilities/src/libexec/rtld-elf/rtld.c#20 (text+ko) ==== @@ -657,10 +657,14 @@ * ELF default. */ cap_main_ptr = find_cap_main(obj_main); - if (cap_main_ptr != NULL) - return (func_ptr_type) cap_main_ptr; + if (cap_main_ptr == NULL) { + _rtld_error("cap_main not found"); + die(); + } + return (func_ptr_type) cap_main_ptr; +#else + return (func_ptr_type) obj_main->entry; #endif - return (func_ptr_type) obj_main->entry; } Elf_Addr