From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f66.google.com ([209.85.218.66]:36086 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758226AbcIRUSu (ORCPT ); Sun, 18 Sep 2016 16:18:50 -0400 MIME-Version: 1.0 In-Reply-To: <1474211117-16674-8-git-send-email-jann@thejh.net> References: <1474211117-16674-1-git-send-email-jann@thejh.net> <1474211117-16674-8-git-send-email-jann@thejh.net> From: Linus Torvalds Date: Sun, 18 Sep 2016 13:18:48 -0700 Message-ID: Subject: Re: [PATCH 7/9] ptrace: forbid ptrace checks against current_cred() from VFS context To: Jann Horn Cc: Alexander Viro , Roland McGrath , Oleg Nesterov , John Johansen , James Morris , "Serge E. Hallyn" , Paul Moore , Stephen Smalley , Eric Paris , Casey Schaufler , Kees Cook , Andrew Morton , Janis Danisevskis , Seth Forshee , "Eric . Biederman" , Thomas Gleixner , Benjamin LaHaise , linux-fsdevel , LSM List , "security@kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, Sep 18, 2016 at 8:05 AM, Jann Horn wrote: > This ensures that VFS implementations don't call ptrace_may_access() from > VFS read or write handlers. In order for file descriptor passing to have > its intended security properties, VFS read/write handlers must not do any > kind of privilege checking. Quite frankly, this smells like it should be a static check, not some kind of runtime one. Or if runtime, it should be abstracted out so that you can do an occasional "let's run a checking pass" rather than enable it unconditionally and universally. It's just too specialized. Soon you'll want to do other random context checking, and we can't just keep adding those kinds of ad-hoc things without it becoming a maintenance nightmare. I can well imagine somebody ending up writing some stupid patch to take that "in_unprivileged_vfs" thing into account for some semantics, and then we're *really* screwed. So there are many reasons to make sure this is *not* something that people actually expect to always be there. Linus