From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout11.his.huawei.com (frasgout11.his.huawei.com [14.137.139.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F4232E8B67; Fri, 29 May 2026 14:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=14.137.139.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066800; cv=none; b=TQfJ0QJr5gMToiRQYqee6FMdohzx2tIDI9QuwHbBOJiD/lMuBkLiLnuYUv6sS5TEtzhq3IJ089AdHC42rZh8QZ9lDJHhp67w1+05s1yFqychSnA+HV3yq5JrHrFozRWRySLdYT8X3fQGlS0t7JbomfPTtc0SpHbKF+TpXLnfrSE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780066800; c=relaxed/simple; bh=Yb5xZh+ixyrbfIrO8NYmZ70+SmcD6/eyVzBO631EP9Y=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=jyNrkMMPS8dtBFuhBXlymp9PxyxIJZPSMyK8l1O6lkeKL05w41H/TnqLR0QgFY9nmD23Dd1AEQv25IfvyWz7dqP7CyL7dUH18XOmEXieNrPnHvQQi96HjYVon2Kme9qQtrNswUX1nzDrU4AD+1X3Bv7cxfnvQ2inbwAcplg010c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=14.137.139.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.18.224.196]) by frasgout11.his.huawei.com (SkyGuard) with ESMTPS id 4gRmbf29SMz1HChr; Fri, 29 May 2026 22:54:38 +0800 (CST) Received: from mail02.huawei.com (unknown [7.182.16.27]) by mail.maildlp.com (Postfix) with ESMTP id DB0C84056C; Fri, 29 May 2026 22:59:47 +0800 (CST) Received: from [10.204.63.22] (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwBXTmrYqRlq4kwMAg--.36081S2; Fri, 29 May 2026 15:59:47 +0100 (CET) Message-ID: <8a0c965e1c2f3eee1006c4941206d70a71e7d0f0.camel@huaweicloud.com> Subject: Re: [PATCH v5 12/13] ima: Return error on deleting measurements already copied during kexec From: Roberto Sassu To: Mimi Zohar , corbet@lwn.net, skhan@linuxfoundation.org, dmitry.kasatkin@gmail.com, eric.snowberg@oracle.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, gregorylumen@linux.microsoft.com, chenste@linux.microsoft.com, nramas@linux.microsoft.com, Roberto Sassu Date: Fri, 29 May 2026 16:59:33 +0200 In-Reply-To: References: <20260429160319.4162918-1-roberto.sassu@huaweicloud.com> <20260429160319.4162918-13-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID:GxC2BwBXTmrYqRlq4kwMAg--.36081S2 X-Coremail-Antispam: 1UD129KBjvJXoW7uF4kJrW8Ar1UZw13ZFWkJFb_yoW8GF1fpa yfW3WFkr4kG34fCry0gw4DAr4Fv3yfta1DGa4kJw43A3Z5WFyvkr4Fkr1F9FWDKrZ3ta4Y yw4Utry5C3WqvaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvjb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWUJVW8JwA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1lc7CjxVAaw2AF wI0_Jw0_GFyl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWU JVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUFk u4UUUUU X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAgAIBGoZdzUCKgAAsX On Tue, 2026-05-26 at 10:02 -0400, Mimi Zohar wrote: > On Wed, 2026-04-29 at 18:03 +0200, Roberto Sassu wrote: > > From: Roberto Sassu > >=20 > > Refuse to delete staged or active list measurements, if a kexec racing = with > > the deletion already copied those measurements in the kexec buffer. In = this > > way, user space becomes aware that those measurements are going to appe= ar > > in the secondary kernel, and thus they don't have to be saved twice. >=20 > There are two reboot notifiers: one to prevent additional measurements ex= tending > the TPM, while the other copies the measurements for kexec. This patch p= revents > deleting the staged measurements after the latter notifier. >=20 > Instead of introducing a specific method for detecting whether the measur= ement > list has been copied, rely on one of the two existing reboot notifiers. T= he > simplest method would test "ima_measurements_suspended", which would prev= ent > deleting the staged measurements a bit earlier. Testing that the reboot notifier fired (with the ima_measurements_suspended variable) is not enough to know whether the measurements dump took place or not. We need a flag (one is enough) protected by ima_extend_list_mutex, so that we know reliably which event occurred first, or the dump or the staging/delete (which are also protected by ima_extend_list_mutex). Roberto