Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755383AbZLYAO3 (ORCPT ); Thu, 24 Dec 2009 19:14:29 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753077AbZLYAO2 (ORCPT ); Thu, 24 Dec 2009 19:14:28 -0500 Received: from e3.ny.us.ibm.com ([32.97.182.143]:52080 "EHLO e3.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbZLYAO1 (ORCPT ); Thu, 24 Dec 2009 19:14:27 -0500 Date: Thu, 24 Dec 2009 18:14:22 -0600 From: "Serge E. Hallyn" To: Michael Stone Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Andi Kleen , David Lang , Oliver Hartkopp , Alan Cox , Herbert Xu , Valdis Kletnieks , Bryan Donlan , Evgeniy Polyakov , "C. Scott Ananian" , James Morris , "Eric W. Biederman" , Bernie Innocenti , Mark Seaborn , Randy Dunlap , =?iso-8859-1?Q?Am=E9rico?= Wang Subject: Re: A basic question about the security_* hooks Message-ID: <20091225001422.GB22311@us.ibm.com> References: <20091224022902.GA24234@heat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091224022902.GA24234@heat> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2028 Lines: 42 Quoting Michael Stone (michael@laptop.org): > Dear kernel folks, > > There are a variety of places where I'd like to be able to get the kernel to > return EPERM more often [1]. Many of these places already have security hooks. > > Unfortunately, I don't feel that I can make effective use of these hooks > because they seem to be "occupied" by the large mandatory access control > frameworks. > > I'm hoping that you can tell me why this state of affairs persists. > > More specifically, now that LSMs are statically linked, why is it good for the > security hooks to call into a single monolithic "security_ops" struct instead > of cheaper and simpler alternatives? > > In particular, what would be worse about a kernel in which each security hook > contained nothing but conditionally-compiled function calls to the appropriate > "real" implementation functions with early-exit jumps on non-zero return codes? The problem is that composing any two security policies can quickly have subtle, unforeseen, but dangerous effects. That's why so far we have stuck with the status quo where only one LSM is 'active', but that LSM can manually call hooks from other LSMs. So with your module, I'd recommend following the route of the capabilities LSM. You can provide an optional stand-alone LSM which only hooks your functions. Then smack, for instance, can call the functions in your LSM from within its own hooks, or it can simply explicitly assign its hooks to your functions in smack_ops. Selinux can do the same thing, although I suspect they would more likely implement their own functions for your newly hooked sites. A distro can then compile a kernel with all LSMs compiled in, and switch behavior by using "security=selinux" vs. "security=prctl_network_lsm" -serge -- 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/