From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796044075; b=d/fmqImh9sLx/yApE+qMW3uHyqCKRWHwW5NsRNp7oDtucLcI6hRqYJUw6uIZ6i42srZR wHNPRFI6tA0h7kA0S+hAjY8rnTfm9DLM1xb80eGY1VI3XskaHYCZkNFPZ4EaytSs2bfLd 0ZYwyI225xUZzvXNM+Y9eC4LW4IyAIYTSEZcaZAO08o7TPFzJAznBkLIBAlloBuAh3smQ Sw559v5OaRgoXyHvWeCoI1a0Iij6/EFJwj1GZHnZjogzBMzA79JmhLS6Xs1cfhz0nMUoe baKoelMSZNWXxW5ltok67FLERQTAEYQjbU7AsqEgQHxsVuZY52X8+16BpUfzu6JlOng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796044075; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:Message-ID:Subject:From:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date: MIME-Version:User-Agent:X-TM-AS-GCONF:X-Proofpoint-Reinject: X-Authority-Analysis:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=AWxXeFUPulNh7X/kiGNhPetONcLM37g61mTiP8qMVrg=; b=BxiHoND15XNDJtu4H1ezUs9UwvFmq5sA27GX4qQaAppe5TV32kIZGCFXi8u/oXwVDINM fp4KoHoklCZGuazR7Eltb2193aqBiegSWQCIKKcdEgjyOlsZPJ7shtjGJAEDpmm9+0TFn oEIsdH+7cS+7MuuyLPiAo7VC1qtq15Z77WJ1fNPQm/YYZgFtNYP4LVxn91dGdGnVWIrcr ihb3vDD1KSbKnQoloMw7KtU51jMytMb5AULfCVWucGQJpQIQKtkysrJqjOO4MXllg3Kom b9g2ubezEtqEg+wjD5Wbd4oDgaL0CSMOXcoJ29Ii1LbwGWy8eEuf2kpmydrS0/Qn/cg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=FDYUxuec; arc=none smtp.remote-ip=148.163.158.5 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BCE5606A31C; Mon, 30 Nov 2026 13:07:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8BCE5606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=FDYUxuec Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AU9Yafm2796779; Mon, 30 Nov 2026 13:07:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=AWxXeF UPulNh7X/kiGNhPetONcLM37g61mTiP8qMVrg=; b=FDYUxueclhmVPcgpITMhuG bTqrCwAyzC+SzAwqvc83ZgxCKjapRWO6bQXTsITFo5OXKPLMtQFZh43VeaEdqBuu LKIqZ73SOmqi1jtgzk487qzzkWIQ3mXlbsM9pFNiozVh2PDzF+DGUTN3UY9QsLgx 85Uy4USvSHrdlRAM0rJV7Fi7nIJLc0Av7Ruaor6OR//7HJGFAOGie/vu6P3U97zd weIrIqmqItL3gPE8YI7yNhHqOWba/ql85WXjHXeKybqHtKT+Xr9yq8cwDM8sPYIg CF/xLIjdgpX7bpzV2RvSKUiR37ziPce7oNgrKiZSp/QW4hnSXP78mBpEVewAXzQw == Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pktyfhw-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 30 Nov 2026 13:07:31 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AU9YGC93927071; Mon, 30 Nov 2026 13:07:31 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j899s54xs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Nov 2026 13:07:31 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6AUD7Up262063086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Nov 2026 13:07:30 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 473B75805F; Mon, 30 Nov 2026 13:07:30 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 18E0A58054; Mon, 30 Nov 2026 13:07:29 +0000 (GMT) Received: from li-43857255-d5e6-4659-90f1-fc5cee4750ad.ibm.com (unknown [9.61.1.114]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 30 Nov 2026 13:07:28 +0000 (GMT) Message-ID: Subject: Re: [PATCH RESEND v2] ima: initialize the real inode attributes of the iint cache From: Mimi Zohar To: Cai Xinchen , roberto.sassu@huawei.com, dmitry.kasatkin@gmail.com, eric.snowberg@oracle.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, amir73il@gmail.com Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, lujialin4@huawei.com In-Reply-To: <20261127072129.2162668-1-caixinchen1@huawei.com> References: <20261127072129.2162668-1-caixinchen1@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 08:07:28 -0500 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Evolution 3.58.3 (3.58.3-2.fc43) X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=KZZHIgYD c=1 sm=1 tr=0 ts=6b0d7514 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VwQbUJbxAAAA:8 a=i0EeH86SAAAA:8 a=IVVy8AlUIB0KSHSTvWEA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDA1MiBTYWx0ZWRfX4VH0d53R1ACV 8Ipi0aAuOJ9iB0+D09548dUB3nJznQWmT+5k3ZgXmi6J5bj1gSwUidOCX6vFYfScFY4fyn10WuL DiHMiAzNy4XtEBDSeqJafnV7lAQUlPFSZbM4pz2DEvkhLcU6FV+lumIA+qm81jhdEM9ymF1QIQf vN22jLbAN+wWXSQ0mRYdCLDYiof+n0w1bHqiba0vxI8jIq2w76sywNQZMwRSHzfG39rJmKEUpi/ ekZ1GwY/FFjbT7Fbv5m2NHiYl+tNCzpGhba2n24ak7d2b969tUUBO/NOa3j6DVZlF+b3t9EcxbN 5UyBGBEbYMHeT6h4yoNM1LBBlWGMKt4skS2/7p5M7diBB9wXP3hAZuPyiqb3hkDOUE8jhhQGTEI K7MUKPy4RD2GiCkUYvdcNRY7QVV2C6Jp7ZwhYpUhs0QGQCtisDFCmahU/DbecLDgYLWnDxON5xK ozAQGYXjWh8Zqy5elwA== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDA1MiBTYWx0ZWRfXwCQ3fAknIn4Z pBm1S8d1O9tm+CtW6bCP/jJMhOd8pEwR+26DwF3HFh8J67ihAQT1mReIDvM6h/RgxhGA33sqOKE mOfSgasbGXfbr5CZ38gDV0593SSdNfQ= X-Proofpoint-ORIG-GUID: oQPhUwNBVzxTdWbpwsttkXVLicIq7HGU X-Proofpoint-GUID: 6Yc6E58hPcPVWBMUELdEikLwQksxi5Mm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_03,2026-11-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300052 On Fri, 2026-11-27 at 15:21 +0800, Cai Xinchen wrote: > ima_iint_cache objects are allocated with kmem_cache_alloc() from a > dedicated slab whose constructor only runs once, when the slab is first > created; the constructor does not run again when a freed object is > reallocated. ima_iint_init_always() resets all iint fields except > real_inode.ino and real_inode.dev, which therefore keep the values of > the previously freed iint. >=20 > integrity_inode_attrs_changed() reads those fields in > process_measurement() to detect changes to the backing file on stacked > filesystems. The fields are normally written by > integrity_inode_attrs_store() from ima_collect_measurement(), but the > IMA_HASH path sets IMA_HASHED without calling it, so on the next file > open the stale, uninitialized ino and dev are read. Depending on the > residual values, IMA may skip re-evaluating a file whose backing data > or metadata changed, or needlessly re-evaluate it. >=20 > At allocation time there are no valid real-inode attributes yet, so > clear the entire real_inode structure. On stacked filesystems the > first comparison against the underlying real inode will then fail until > ima_collect_measurement() stores the real inode's attributes, which is > the safe, conservative direction. >=20 > Fixes: b836c4d29f27 ("ima: detect changes to the backing overlay file") > Signed-off-by: Cai Xinchen Thanks, Cai. The patch is already queued in the next-integrity branch of l= inux- integrity. https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git/l= og/?h=3Dnext-integrity Mimi