Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbbG3UDq (ORCPT ); Thu, 30 Jul 2015 16:03:46 -0400 Received: from mail-io0-f178.google.com ([209.85.223.178]:33748 "EHLO mail-io0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751228AbbG3UDn (ORCPT ); Thu, 30 Jul 2015 16:03:43 -0400 MIME-Version: 1.0 In-Reply-To: <20150730190434.GD16452@x> References: <1438242731-27756-1-git-send-email-drysdale@google.com> <1438242731-27756-2-git-send-email-drysdale@google.com> <20150730083831.GA22182@gmail.com> <20150730190434.GD16452@x> Date: Thu, 30 Jul 2015 13:03:43 -0700 X-Google-Sender-Auth: qFhcIYHDAmuo-tkn-cS2uh2c7B8 Message-ID: Subject: Re: [PATCHv2 1/1] Documentation: describe how to add a system call From: Kees Cook To: Josh Triplett Cc: David Drysdale , Ingo Molnar , Linux API , Michael Kerrisk , Andrew Morton , Arnd Bergmann , Shuah Khan , Jonathan Corbet , Eric B Munson , Randy Dunlap , Andrea Arcangeli , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Oleg Nesterov , Linus Torvalds , Greg Kroah-Hartman , Andy Lutomirski , Al Viro , Rusty Russell , Peter Zijlstra , Vivek Goyal , Alexei Starovoitov , David Herrmann , "Theodore Ts'o" , Milosz Tanski , Fam Zheng , Mathieu Desnoyers , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Peter Zijlstra Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1368 Lines: 33 On Thu, Jul 30, 2015 at 12:04 PM, Josh Triplett wrote: > On Thu, Jul 30, 2015 at 11:21:54AM -0700, Kees Cook wrote: >> I like this, it's a good description of both options. I'm still biased >> about the approach: I prefer flags, since pointers to user structures >> complicate syscall filtering. ;) > > Seems like we should do two things to make that easier: > > 1) Create a standardized kernel mechanism for parameter-struct handling, > implementing the recommendations mentioned here. It's been suggested in the past that nlmsg is appropriate for such a thing, but I remain suspicious. :) > 2) Integrate into that mechanism a way to filter the resulting parameter > struct with BPF *after* it has been copied to kernel space (and thus > can no longer be tampered with). Yeah, this is a irritating part: the structures operated on are copied from userspace adhoc in each syscall. Doing argument checking would mean double copies initially, and perhaps teaching syscalls about optional "already copied" arguments or something as an optimization. -Kees -- Kees Cook Chrome OS Security -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/