From owner-p4-projects@FreeBSD.ORG Tue Feb 2 19:19:27 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 201E8106568B; Tue, 2 Feb 2010 19:19:27 +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 D8DA5106566B for ; Tue, 2 Feb 2010 19:19:26 +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 ACCD48FC14 for ; Tue, 2 Feb 2010 19:19:26 +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 o12JJQnO003437 for ; Tue, 2 Feb 2010 19:19:26 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 o12JJQiv003435 for perforce@freebsd.org; Tue, 2 Feb 2010 19:19:26 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 2 Feb 2010 19:19:26 GMT Message-Id: <201002021919.o12JJQiv003435@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 174178 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: Tue, 02 Feb 2010 19:19:27 -0000 http://p4web.freebsd.org/chv.cgi?CH=174178 Change 174178 by rwatson@rwatson_vimage_client on 2010/02/02 19:18:45 When compressing in a sandbox, forward 'numflag' for zlib compression, asithat controls the compression level. Reported by: kris Affected files ... .. //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzip.c#9 edit .. //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzip.h#3 edit .. //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzsandbox.c#14 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzip.c#9 (text+ko) ==== @@ -186,7 +186,7 @@ static int cflag; /* stdout mode */ static int dflag; /* decompress mode */ static int lflag; /* list mode */ -static int numflag = 6; /* gzip -1..-9 value */ +int numflag = 6; /* gzip -1..-9 value */ #ifndef SMALL static int fflag; /* force mode */ ==== //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzip.h#3 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009 Robert N. M. Watson + * Copyright (c) 2009-2010 Robert N. M. Watson * All rights reserved. * * WARNING: THIS IS EXPERIMENTAL SECURITY SOFTWARE THAT MUST NOT BE RELIED @@ -34,6 +34,12 @@ #ifndef _GZIP_H_ #define _GZIP_H_ +/* + * We need to forward the global variable 'numflag' to the sandbox as well as + * function arguments. + */ +extern int numflag; + off_t gz_compress(int in, int out, off_t *gsizep, const char *origname, uint32_t mtime); off_t gz_compress_wrapper(int in, int out, off_t *gsizep, ==== //depot/projects/trustedbsd/capabilities/src/usr.bin/gzip/gzsandbox.c#14 (text+ko) ==== @@ -82,6 +82,7 @@ struct host_gz_compress_req { char hgc_req_origname[PATH_MAX]; + int hgc_req_numflag; uint32_t hgc_req_mtime; } __packed; @@ -103,6 +104,7 @@ bzero(&req, sizeof(req)); strlcpy(req.hgc_req_origname, origname, sizeof(req.hgc_req_origname)); + req.hgc_req_numflag = numflag; req.hgc_req_mtime = mtime; iov_req.iov_base = &req; iov_req.iov_len = sizeof(req); @@ -137,6 +139,7 @@ bcopy(buffer, &req, sizeof(req)); bzero(&rep, sizeof(rep)); + numflag = req.hgc_req_numflag; rep.hgc_rep_retval = gz_compress(fd_in, fd_out, &rep.hgc_rep_gsize, req.hgc_req_origname, req.hgc_req_mtime); iov.iov_base = &rep;