From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967625AbdEWTuy (ORCPT ); Tue, 23 May 2017 15:50:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:43926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967333AbdEWTuu (ORCPT ); Tue, 23 May 2017 15:50:50 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5172D239F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org MIME-Version: 1.0 In-Reply-To: References: <1495454226-10027-1-git-send-email-tixxdz@gmail.com> <20170522120848.GA3003@openwall.com> <20170522164323.GA2048@openwall.com> <20170523074808.GA4562@openwall.com> From: Andy Lutomirski Date: Tue, 23 May 2017 12:50:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [kernel-hardening] [PATCH v4 next 0/3] modules: automatic module loading restrictions To: Kees Cook Cc: Solar Designer , Djalal Harouni , linux-kernel , Network Development , LSM List , "kernel-hardening@lists.openwall.com" , Andy Lutomirski , Andrew Morton , Rusty Russell , "Serge E. Hallyn" , Jessica Yu , "David S. Miller" , James Morris , Paul Moore , Stephen Smalley , Greg Kroah-Hartman , Tetsuo Handa , Ingo Molnar , Linux API , Dongsu Park , Casey Schaufler , Jonathan Corbet , Arnaldo Carvalho de Melo , Mauro Carvalho Chehab , Peter Zijlstra , Zendyani , "open list:DOCUMENTATION" , Al Viro , Ben Hutchings 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 Tue, May 23, 2017 at 11:36 AM, Kees Cook wrote: > On Tue, May 23, 2017 at 12:48 AM, Solar Designer wrote: >> For modules_autoload_mode=2, we already seem to have the equivalent of >> modprobe=/bin/true (or does it differ subtly, maybe in return values?), >> which I already use at startup on a GPU box like this (preloading >> modules so that the OpenCL backends wouldn't need the autoloading): >> >> nvidia-smi >> nvidia-modprobe -u -c=0 >> #modprobe nvidia_uvm >> #modprobe fglrx >> >> sysctl -w kernel.modprobe=/bin/true >> sysctl -w kernel.hotplug=/bin/true >> >> but it's good to also have this supported more explicitly and more >> consistently through modules_autoload_mode=2 while we're at it. So I >> support having this mode as well. I just question the need to have it >> non-resettable. > > I agree it's useful to have the explicit =2 state just to avoid > confusion when more systems start implementing > CONFIG_STATIC_USERMODEHELPER and kernel.modprobe becomes read-only > (though the userspace implementation may allow for some way to disable > it, etc). I just like avoiding the upcall to modprobe at all. I fully support =2 to mean "no automatic loading at all". I dislike making it non-resettable. If you can write to sysctls, then, most likely you can either call init_module() directly or the system has module loading disabled entirely.