From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752267AbbJBW7n (ORCPT ); Fri, 2 Oct 2015 18:59:43 -0400 Received: from www62.your-server.de ([213.133.104.62]:49569 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970AbbJBW57 (ORCPT ); Fri, 2 Oct 2015 18:57:59 -0400 Message-ID: <560F0BED.2070304@iogearbox.net> Date: Sat, 03 Oct 2015 00:57:49 +0200 From: Daniel Borkmann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Tycho Andersen , Kees Cook CC: Alexei Starovoitov , Will Drewry , Oleg Nesterov , Andy Lutomirski , Pavel Emelyanov , "Serge E. Hallyn" , LKML , Network Development , Linux API Subject: Re: v5 of seccomp filter c/r patches References: <1443803243-25912-1-git-send-email-tycho.andersen@canonical.com> <20151002224443.GN23065@smitten> In-Reply-To: <20151002224443.GN23065@smitten> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/03/2015 12:44 AM, Tycho Andersen wrote: > On Fri, Oct 02, 2015 at 02:10:24PM -0700, Kees Cook wrote: ... > Ok, how about, > > struct sock_filter insns[BPF_MAXINSNS]; > insn_cnt = ptrace(PTRACE_SECCOMP_GET_FILTER, pid, insns, i); Would also be good that when the storage buffer (insns) is NULL, it just returns you the number of sock_filter insns (or 0 when nothing attached). That would be consistent with classic socket filters (see sk_get_filter()), and user space could allocate a specific size instead of always passing in max insns. > when asking for the ith filter? It returns either the number of > instructions, -EINVAL if something was wrong (i, pid, > CONFIG_CHECKPOINT_RESTORE isn't enabled). While it would always > succeed now, if/when the underlying filter was not created from a bpf > classic filter, we can return -EMEDIUMTYPE? (Suggestions welcome, I > picked this mostly based on what sounds nice.) > > Tycho >