Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751797AbdISVzz (ORCPT ); Tue, 19 Sep 2017 17:55:55 -0400 Received: from mail-io0-f178.google.com ([209.85.223.178]:55530 "EHLO mail-io0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751780AbdISVzy (ORCPT ); Tue, 19 Sep 2017 17:55:54 -0400 X-Google-Smtp-Source: AOwi7QC8AcIlw/zhVuP0uwsyqu9f6STVpQhoIiCk0AK7KwvlYI+vhBAAzZMEW+wCPPt9OBfAqUk2Eg== Date: Tue, 19 Sep 2017 15:55:51 -0600 From: Tycho Andersen To: Kees Cook Cc: LKML , criu@openvz.org, Andy Lutomirski , Oleg Nesterov Subject: Re: [PATCH] ptrace, seccomp: add support for retrieving seccomp flags Message-ID: <20170919215551.kaphydcaqzoesgvy@smitten> References: <20170919174743.19814-1-tycho@docker.com> <20170919210916.6r5janszdtx7eoes@smitten> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1869 Lines: 53 On Tue, Sep 19, 2017 at 02:43:51PM -0700, Kees Cook wrote: > On Tue, Sep 19, 2017 at 2:09 PM, Tycho Andersen wrote: > > Hi Kees, > > > > On Tue, Sep 19, 2017 at 01:08:28PM -0700, Kees Cook wrote: > >> On Tue, Sep 19, 2017 at 10:47 AM, Tycho Andersen wrote: > >> > With the new SECCOMP_FILTER_FLAG_LOG, we need to be able to extract these > >> > flags for checkpoint restore, since they describe the state of a filter. > >> > > >> > So, let's add PTRACE_SECCOMP_GET_FLAGS, similar to ..._GET_FILTER, which > >> > returns the flags of the nth filter. > >> > >> Can you split this up into factoring out the nth helper, and then > >> adding the new get? > >> > >> For naming, perhaps "GET_FILTER_FLAGS" instead of "GET_FLAGS" since > >> there may be seccomp flags in the future, etc. > > > > Sure, I'll do both of these. > > > >> Is there any sane way to add the flags to the existing GET_FILTER? > > > > I looked at this, and I don't think so. Unfortunately, we didn't use > > any structure for the output, it's just the raw bytes of the filter > > with the length used as the return value. I suppose we could append > > the flags after the bytes of the filter, but that seems... very ugly > > :). Let me know if you want to go that route. > > I think if we can make the new GET_FILTER_stuff interface more > extensible, we should cover any future needs for per-filter content. Ok, are you interested in something more general than GET_FILTER_FLAGS? Maybe GET_FILTER_METADATA with uapi struct like: struct seccomp_metadata { unsigned int flags; }; which you call by something like, struct seccomp_metadata mymeta; size = ptrace(PTRACE_SECCOMP_GET_FILTER_METADATA, pid, sizeof(mymeta), &mymeta); if (size < 0) { /* error */ } if (size != sizeof(mymeta)) { /* struct seccomp_metadata sizes are different */ } ? Tycho