From owner-freebsd-current@FreeBSD.ORG Wed Sep 10 07:00:26 2014 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C50AE58E for ; Wed, 10 Sep 2014 07:00:26 +0000 (UTC) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46C4D1A1 for ; Wed, 10 Sep 2014 07:00:25 +0000 (UTC) Received: by mail-lb0-f177.google.com with SMTP id l4so7523995lbv.36 for ; Wed, 10 Sep 2014 00:00:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=4dAMvg0ge7yMv48AZKzF1wkiiOnYNtsxOxIkcZnJfKE=; b=ZgN7gx5RHv/HVJw5ceWrn0RHt3/OBvjCRfd2uhuWYg5EZGFBL86Al+OLgnAQu/7B7F XCSZVeOi+7noMXlmjLNXo6AByykFN/U9gU4K5/kuBQkZxQ+pR/ZqQ6lQxzAQJz+0k2wf xxEnbVRr5xJXaJXUF//GmdaQPZwvn3ILelY4nzQ4o11P87lwnptyuNZG04Ew9VgkJASH kyXLXHE0ulAOyX6FcatrhD+q9FzQD12GgPuUDZh4t2NuNauvGp4mIq0Mq886OM9B0Hqn QOE1bhF/mOFdlWUD01R5QsEbtIbFk1Sxv4Aaqt0ABptsOYrtfoS3u1XTu6wLjZktDMfE V/ZQ== X-Gm-Message-State: ALoCoQkZV2jMPAR2XPXj4T8WLF2k5tukMI6PipSX9OAqBS8XJFqe7zEsjLkXaqGDIVadp18llAiQ X-Received: by 10.152.116.80 with SMTP id ju16mr14307667lab.73.1410332423268; Wed, 10 Sep 2014 00:00:23 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id h9sm4993998lae.40.2014.09.10.00.00.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Sep 2014 00:00:22 -0700 (PDT) Message-ID: <540FF706.2050400@freebsd.org> Date: Wed, 10 Sep 2014 11:00:22 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Patrick Kelsey Subject: Re: _ftello() modification requires additional capsicum rights, breaking tcpdump and dhclient References: <540E14C4.9080201@freebsd.org> <540E26E6.5070700@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Cc: George Neville-Neil , current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 07:00:26 -0000 On 09.09.2014 21:53, Patrick Kelsey wrote: > I don't think it is worth the trouble, as given the larger pattern of > libc routines requiring multiple capsicum rights, it seems one will in > general have to have libc implementation knowledge when using it in > concert with capsicum. For example, consider the limitfd() routine in > kdump.c, which provides rights for the TIOCGETA ioctl to be used on > stdout so the eventual call to isatty() via printf() will work as intended. > > I think the above kdump example is a good one for the subtle issues that > can arise when using capsicum with libc. That call to isatty() is via a > widely-used internal libc routine __smakebuf(). __smakebuf() also calls > __swhatbuf(), which in turn calls _fstat(), all to make sure that output > to a tty is line buffered by default. It would appear that programs > that restrict rights on stdout without allowing CAP_IOCTL and CAP_FSTAT > could be disabling the normally default line buffering when stdout is a > tty. kdump goes the distance, but dhclient does not (restricting stdout > to CAP_WRITE only). > > In any event, the patch attached to my first message is seeming like the > way to go. Well, then commit it (if capsicum team agrees). -- http://ache.vniz.net/