From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751804AbbJBWEk (ORCPT ); Fri, 2 Oct 2015 18:04:40 -0400 Received: from mail-oi0-f42.google.com ([209.85.218.42]:34254 "EHLO mail-oi0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751504AbbJBWEi (ORCPT ); Fri, 2 Oct 2015 18:04:38 -0400 MIME-Version: 1.0 In-Reply-To: References: <1443803243-25912-1-git-send-email-tycho.andersen@canonical.com> From: Andy Lutomirski Date: Fri, 2 Oct 2015 15:04:18 -0700 Message-ID: Subject: Re: v5 of seccomp filter c/r patches To: Kees Cook Cc: Tycho Andersen , Alexei Starovoitov , Will Drewry , Oleg Nesterov , Pavel Emelyanov , "Serge E. Hallyn" , Daniel Borkmann , LKML , Network Development , Linux API Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 2, 2015 at 3:02 PM, Kees Cook wrote: > On Fri, Oct 2, 2015 at 2:29 PM, Andy Lutomirski wrote: >> On Fri, Oct 2, 2015 at 2:10 PM, Kees Cook wrote: >>> On Fri, Oct 2, 2015 at 9:27 AM, Tycho Andersen >>> wrote: >>>> Hi all, >>>> >>>> Here's v5 of the seccomp filter c/r set. The individual patch notes have >>>> changes, but two highlights are: >>>> >>>> * This series is now based on http://patchwork.ozlabs.org/patch/525492/ and >>>> will need to be built with that patch applied. This gets rid of two incorrect >>>> patches in the previous series and is a nicer API. >>>> >>>> * I couldn't figure out a nice way to have SECCOMP_GET_FILTER_FD return the >>>> same struct file across calls, so we still need a kcmp command. I've narrowed >>>> the scope of the one being added to only compare seccomp fds. >>>> >>>> Thoughts welcome, >>> >>> Hi, sorry I've been slow/busy. I'm finally reading through these threads. >>> >>> Happy bit: >>> - avoiding eBPF and just saving the original filters makes things much easier. >>> >>> Sad bit: >>> - inventing a new interface for seccompfds feels like massive overkill to me. >>> >>> While Andy has big dreams, we're not presently doing seccompfd >>> monitoring, etc. There's no driving user for that kind of interface, >>> and accepting the maintenance burden of it only for CRIU seems unwise. >>> >>> So, I'll go back to what I originally proposed at LSS (which it looks >>> like we're half way there now): >>> >>> - save the original filter (done!) >>> - extract filters through a single special-purpose interface (looks >>> like ptrace is the way to go: root-only, stopped process, etc) >>> - compare filter content and issue TSYNCs to merge detected sibling >>> threads, since merging things that weren't merged before creates no >>> problems. >>> >>> This means the parenting logic is heuristic, but it's entirely in >>> userspace, so the complexity burden doesn't live in seccomp which we, >>> by design, want to keep as simple as possible. >> >> This is okay with me with a future-proofing caveat: I think that >> whatever reads out the filter should be clearly documented as >> returning some special error code that indicates that that filter it >> tried to read wasn't in the expected form. That would happen for >> native eBPF filters, and it would also happen for seccomp monitors >> even if those monitors use classic BPF. > > As in, it should have something like "give me BPF" and that'll start > failing when it's only eBPF in the future? Yes, but it might also start failing when if my dreams come true, it's still classic BPF, but it's no longer a classic seccomp bpf filter layer with the semantics we expect today. (E.g. if it's classic bpf but has a monitor attached, then the read should fail because restoring it without restoring the monitor will cause all kinds of mess.) --Andy