Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760898AbaGYSbO (ORCPT ); Fri, 25 Jul 2014 14:31:14 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:34452 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758327AbaGYSbK (ORCPT ); Fri, 25 Jul 2014 14:31:10 -0400 MIME-Version: 1.0 From: Andy Lutomirski Date: Fri, 25 Jul 2014 11:30:48 -0700 Message-ID: Subject: General flags to turn things off (getrandom, pid lookup, etc) To: "Eric W. Biederman" , Julien Tinnes , David Drysdale , Al Viro , Paolo Bonzini , LSM List , Greg Kroah-Hartman , Paul Moore , James Morris , Linux API , Meredydd Luff , Christoph Hellwig , "linux-kernel@vger.kernel.org" , Kees Cook , "Theodore Ts'o" , Andy Lutomirski , Henrique de Moraes Holschuh , linux-crypto@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [new thread because this sort of combines two threads] There is recent interest in having a way to turn generally-available kernel features off. Maybe we should add a good one so we can stop bikeshedding and avoid proliferating dumb interfaces. Things that might want to be turn-off-able include: - getrandom with GRND_RANDOM [from the getrandom threads] - Any lookup of a non-self pid [from the capsicum thread] - Any lookup of a pid outside the caller thread group [capsicum] - Various architectural things (personal wishlist), e.g.: - RDTSC and userspace HPET access - CPUID? - 32-bit GDT code segments [huge attack surface] - 64-bit GDT code segments [probably pointless] I would propose a new syscall for this: long restrict_userspace(int mode, int type, int value, int flags); mode is RESTRICT_SET, RESTRICT_GET, or RESTRICT_LOCK. type is RESTRICT_GRND_RANDOM, RESTRICT_PID_SCOPE, RESTRICT_X86_TIMING, etc. Value is zero if RESTRICT_GET. Otherwise value is the desired value, generally 0 or 1. For RESTRICT_PID_SCOPE, value would be RESTRICT_PID_SCOPE_ANY, RESTRICT_PID_SCOPE_THREADGROUP, or RESTRICT_PID_SCOPE_SELF. flags must be zero. Someday, someone will propose a thread-sync flag. restrict_userspace requires either no_new_privs or CAP_SYS_ADMIN in the current user namespace. Thoughts? --Andy -- Andy Lutomirski AMA Capital Management, LLC -- 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/