From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752341AbdIVPWd (ORCPT ); Fri, 22 Sep 2017 11:22:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42044 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752115AbdIVPWc (ORCPT ); Fri, 22 Sep 2017 11:22:32 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1DA5080467 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=oleg@redhat.com Date: Fri, 22 Sep 2017 17:22:29 +0200 From: Oleg Nesterov To: Kees Cook Cc: Chris Salls , Andy Lutomirski , Will Drewry , "security@kernel.org" , LKML , Tycho Andersen Subject: Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Message-ID: <20170922152229.GA19152@redhat.com> References: <20170920125621.GA3599@redhat.com> <20170921105713.GA32672@redhat.com> 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 22 Sep 2017 15:22:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/21, Kees Cook wrote: > > On Thu, Sep 21, 2017 at 3:57 AM, Oleg Nesterov wrote: > > On 09/20, Kees Cook wrote: > >> > >> Given how reference counting is done for filters, I'd be happier with > >> leaving the get_seccomp_filter() as-is, > > > > No, please note that filter != tsk->seccomp.filter, get_seccomp_filter() > > won't work. > > Ah yes, sorry, you're right. > > >> (i.e. don't open-code > >> the refcount_inc()). > > > > agreed, probably another __get_seccomp_filter(filter) makes sense, especially > > if we do other changes like get_nth(). > > > > But imo not in this fix. > > Regardless, whatever lands will need backport adjustment for > refcount_*/atomic_* in -stable. yes, but this adjustment is trivial, and we will need it whatever we do in this fix, > Can you resend the two patches; I can send the backport to -stable manually... Not sure I understand... Do you mean this fix + untested "introduce get_nth_filter()" ? Can't we push this simple fix first? Then we can discuss the cleanups. Besides, the 2nd patch connects to Tycho's "[PATCH] ptrace, seccomp: add support for retrieving seccomp flags", otherwise it could be more simple. Oleg.