Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3884793pxf; Mon, 22 Mar 2021 18:48:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxncH8z+S0D117SAQswavXiYBh41gK1+Ve7NDAKFvqSHvLcjoj9T8PMXRyNrKb0cSJc9+aL X-Received: by 2002:a50:eb97:: with SMTP id y23mr2336127edr.170.1616464114560; Mon, 22 Mar 2021 18:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616464114; cv=none; d=google.com; s=arc-20160816; b=Ms/S/Nz60l2V8TVUSIl1q319+VP8QR3zVDlxZmCLuUi+5CCqCs0Gi4vUfHEAnxOF9b EqnAcSt1u9Xe60YFdgWH4NNyjblVyiOdmv6if3vwR654H78wxSkw5VK+cAXbswuxTqUg I6VI1NPAu2ou1OmkgrfTHjK+Aa3AoaybwgOoxqZFrQHzVBnjUiHtLWwRqwQENgkfLmMf DBHMRy3C6Sg29rtuiYVL0Jjx4rJXmjPBm3blsNOCtYtrdP8HxxoqlFosd5Itb4Db/DF5 9zDxwjEATS5b15rnvU9yiVi7oIUC67yQYhcFwPsIPc3EwNU0pvdWAWDhG75IIIhYpNfO a6+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=UfYdYOxF++3RDIuQquSFhX5dcCLTtys7zyrjuhnLbJI=; b=sF/zgWft3shB0n8dMpZ35kNIGv6VzcCnX1muAaJXvj4QQwryo/6TqzoZehFstcRDlD lOt2dpgdo6meF0YPWNu2Er6Fyy2LDXagszbou1Oaiv/fRspMJxO4Hrgu1g1KXaSGD3FW yTyf2HGnRLyxdtv+2+CMvKtFSTGW2ur2nNyRWThlZRwVi38j/n6P3S1HS24ptGJlhWs/ BuTJEu3vq6nGRO0PQTmSIwfiGIwlDiG6G3nM4Ay2N3WZRNTV+1vTAavdy8zqCkGURaJy 3xB8bzoCb1Lop6QEjn7NsA4WkM4t3VejboRGI1kzm/PGhzuQXn/Vx31oLz2Pv8sMzPvI iPsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 38si13178070edr.200.2021.03.22.18.48.12; Mon, 22 Mar 2021 18:48:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbhCWBrR (ORCPT + 99 others); Mon, 22 Mar 2021 21:47:17 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:54483 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231437AbhCWBq5 (ORCPT ); Mon, 22 Mar 2021 21:46:57 -0400 Received: from fsav104.sakura.ne.jp (fsav104.sakura.ne.jp [27.133.134.231]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 12N1kuPx046795; Tue, 23 Mar 2021 10:46:56 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav104.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav104.sakura.ne.jp); Tue, 23 Mar 2021 10:46:56 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav104.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 12N1kt3L046787 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Tue, 23 Mar 2021 10:46:55 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized To: Dmitry Vyukov , Mimi Zohar Cc: linux-integrity@vger.kernel.org, James Morris , "Serge E . Hallyn" , linux-security-module , LKML , Eric Biggers References: <20210319200358.22816-1-zohar@linux.ibm.com> <20210319200358.22816-2-zohar@linux.ibm.com> <8450c80a-104a-3f36-0963-0ae8fa69e0f2@i-love.sakura.ne.jp> From: Tetsuo Handa Message-ID: <1a2245c6-3cab-7085-83d3-55b083619303@i-love.sakura.ne.jp> Date: Tue, 23 Mar 2021 10:46:52 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/03/20 5:03, Mimi Zohar wrote: > The integrity's "iint_cache" is initialized at security_init(). Only > after an IMA policy is loaded, which is initialized at late_initcall, > is a file's integrity status stored in the "iint_cache". > > All integrity_inode_get() callers first verify that the IMA policy has > been loaded, before calling it. Yet for some reason, it is still being > called, causing a NULL pointer dereference. > > qemu-system-x86_64 (...snipped...) lsm=smack (...snipped...) Hmm, why are you using lsm=smack instead of security=smack ? Since use of lsm= overrides CONFIG_LSM="lockdown,yama,safesetid,integrity,tomoyo,smack,bpf" settings, only smack is activated, which means that integrity_iintcache_init() will not be called by DEFINE_LSM(integrity) = { .name = "integrity", .init = integrity_iintcache_init, }; declaration. That's the reason iint_cache == NULL when integrity_inode_get() is called.