Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp6043256imd; Wed, 31 Oct 2018 06:06:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5diUQn6YlaUgfdQP1iFljrZ5zftJ2XoqH+tr5aWGH5eLmYdDUZhKBz2NdUciOpHKdTHppCG X-Received: by 2002:a17:902:4324:: with SMTP id i33-v6mr3390338pld.253.1540991185873; Wed, 31 Oct 2018 06:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540991185; cv=none; d=google.com; s=arc-20160816; b=fIyvaKBdY5tgDQ/630XSpBCfd9cpPqab2a8TZ0ngjl42IJrP6OV7aAT8MH/84UtMLH uvX+e9gCtcKwITLZkussu1TlQX8W5h91UFP7+Gls/ZZ2Nz7XvsoxcwrfLNo+GBMENVSp 8KAndum6Afjs7LJYg86XHNa1AKavURZcUSBiTHg1dv6FqgZiwGkQlQytckvPX5CKDXQl 7BUG7bOVNFvvDM6fV9KSpxMe4HESymH6BOIOOblVY/Hh8hOChOIptb9xJWUdp9u7OlwW a2zAHIwGCnwS+pgYiZC+VEuTAa0qa06YsiyVHwbhvk3kpF0kcOZG+6/RwyWIt57yefe/ tllQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FBTaiA6iKMUQzgs2Ng6+y3JkyP5dFqL6+nfNhMLfRQs=; b=zilqs5z7sOhtSSj8SoIMe5xwkDNDa1q6CkH0tKvliC9aE9BlQo72/ICad36A95QU9Z QLsiZSPvhhN0bmL7hRmzBilg7WqhdJtqw2tG2LE6EXYimu2QgTYPlUF19MEzSCkH1jYG tMJA/lQ6S2tpvY0JFhHMGDrkKpjHVYNlTpSH2BwmhdAhFqlzxsEF0/w8pN4U9DBq9IqN t5F1Uj6VFS7/jtCdDnin/xMn2N/S53GyotaJIvLUk+Gsqghus8LagRLNHbF1ZoRvvSUZ 1nNthyGjBroLkgIiRHZgaRcB7nbQFTfBX8n/U9mV857NNLuBeGDAT20TvEMTl0nOpVol K8Bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11-v6si25454217plq.280.2018.10.31.06.05.57; Wed, 31 Oct 2018 06:06:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729300AbeJaWCo (ORCPT + 99 others); Wed, 31 Oct 2018 18:02:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58748 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729130AbeJaWCo (ORCPT ); Wed, 31 Oct 2018 18:02:44 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03832C04C26D; Wed, 31 Oct 2018 13:04:47 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.31]) by smtp.corp.redhat.com (Postfix) with SMTP id 6A47D194B7; Wed, 31 Oct 2018 13:04:44 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 31 Oct 2018 14:04:45 +0100 (CET) Date: Wed, 31 Oct 2018 14:04:42 +0100 From: Oleg Nesterov To: Kees Cook Cc: Tycho Andersen , Andy Lutomirski , "Eric W . Biederman" , "Serge E . Hallyn" , Christian Brauner , Tyler Hicks , Akihiro Suda , Aleksa Sarai , LKML , Linux Containers , Linux API Subject: Re: [PATCH v8 1/2] seccomp: add a return code to trap to userspace Message-ID: <20181031130442.GB9007@redhat.com> References: <20181029224031.29809-1-tycho@tycho.ws> <20181029224031.29809-2-tycho@tycho.ws> <20181030150254.GB3385@redhat.com> <20181030155403.GC7343@cisco> <20181030162752.GB7643@redhat.com> <20181030163926.GC7643@redhat.com> <20181030172143.GD7343@cisco> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 31 Oct 2018 13:04:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/30, Kees Cook wrote: > > I'd like to avoid changing the return value of __secure_computing() to > just avoid having to touch all the callers. And I'd prefer not to > change __seccomp_filter() to a bool, since I'd like the return values > to be consistent through the call chain. Sure, please forget. > I find the existing code more readable than a single-line return, just > because it's very explicit. I don't want to have to think any harder > when reading seccomp. ;) Heh ;) Again, please forget, this is cosmetic. But I simply can't resist. I asked this question exactly because I was confused by these 2 lines: if (__seccomp_filter(this_syscall, NULL, true)) return -1; return 0; to me it looks as if we need to filter out some non-zero return values and turn them into -1. I had to spend some time (and think harder ;) to verify that this is just the recursive call and nothing more. nevermind, please ignore. Oleg.