From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69EF4C00449 for ; Wed, 3 Oct 2018 18:13:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B15A20835 for ; Wed, 3 Oct 2018 18:13:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B15A20835 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=namei.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727353AbeJDBC5 (ORCPT ); Wed, 3 Oct 2018 21:02:57 -0400 Received: from namei.org ([65.99.196.166]:35396 "EHLO namei.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbeJDBC5 (ORCPT ); Wed, 3 Oct 2018 21:02:57 -0400 Received: from localhost (localhost [127.0.0.1]) by namei.org (8.14.4/8.14.4) with ESMTP id w93ID8Ag015144; Wed, 3 Oct 2018 18:13:08 GMT Date: Thu, 4 Oct 2018 04:13:08 +1000 (AEST) From: James Morris To: Kees Cook cc: Casey Schaufler , LSM , SE Linux , LKLM , John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley , "linux-fsdevel@vger.kernel.org" , Alexey Dobriyan , =?ISO-8859-15?Q?Micka=EBl_Sala=FCn?= , Salvatore Mesoraca Subject: Re: [PATCH v4 14/19] LSM: Infrastructure management of the inode security In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (LRH 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Sep 2018, Kees Cook wrote: > On Fri, Sep 21, 2018 at 5:19 PM, Casey Schaufler wrote: > > + * lsm_early_inode - during initialization allocate a composite inode blob > > + * @inode: the inode that needs a blob > > + * > > + * Allocate the inode blob for all the modules if it's not already there > > + */ > > +void lsm_early_inode(struct inode *inode) > > +{ > > + int rc; > > + > > + if (inode == NULL) > > + panic("%s: NULL inode.\n", __func__); > > + if (inode->i_security != NULL) > > + return; > > + rc = lsm_inode_alloc(inode); > > + if (rc) > > + panic("%s: Early inode alloc failed.\n", __func__); > > +} > > I'm still advising against using panic(), but I'll leave it up to James. > Calling panic() is not appropriate here. Perhaps if it was during boot-time initialization of LSM infrastructure, but not on the fly. Use a WARN_ONCE then propagate the error back and fail the operation. -- James Morris