From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796209282; b=LtXe2skJFGOPtjQ6tyUvRMiBklnayJVBbgNjv6WIkxxMcJme3jH7tuNKGm6VekFRXYzR G6jfgNpPJjgymS9W4+AMfNKoXjuGNrd9yJngLoPIcw3/1nxKXMBmx1q+Nx9U7IXEhr+VE pp45edffkrU2J2s+JGwEMfhljhfSe9OdnkTKdutZ/cFhnZQAHFrTDxZzJUS46AUfsIn61 YJ3a7Zomq8yjXRKP0OfE4f0SOiqTw2FgW5vU8gQIaBSJW2+IMr18Q7rYlxH4IOYba53VG ij0EjTTa9/xOMUk2sVwPrhr4rpyxzgvF40f7gc42i7Z9GldxUuE9+85uHjgP3JwQ+fg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796209282; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=VLpNnRhOaU35DnjM6psttnJ6ikX1dXNlVXjcAIU/QmI=; b=eJsdjMDGtSBqEu33I/2oIYMEZ7GtuTm9JjbcQHACOXrsFllWUfX0cY2x+ITwiDzhz6hb qOS1GFO1xOvD7phWKlfCHVruGZmpH0schoLtr2smh4uPYtlt+pyvk8noiNA6Q+ZY7JF4i ww36OphROeYb1YRVBU1pbR97z3uprpq58bbwcR95uxJTxKGUPSpRfO6Thbm8swqFSkdea b9ZoiFhpws0NuYNshFsqTC5XXUJowumoucMBVP0IeLTVs8i6bE/jhCenHSHN5ymeVSCX4 Di9SU9NVsPapA3FMZNPAysMiD2/LlqyOfAV300V88bEAeOhnVCV/B+QAT8p43PSNWJg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IFgwCaPO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6910D606A31A for ; Wed, 2 Dec 2026 11:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IFgwCaPO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94F8A1F0092C for ; Wed, 2 Dec 2026 11:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796209281; bh=VLpNnRhOaU35DnjM6psttnJ6ikX1dXNlVXjcAIU/QmI=; h=From:Subject:Reply-To:Cc:In-Reply-To:References:Date; b=IFgwCaPOlUqxiHbkOB6BwbbD7UNP9bsO/i3Qu9eNkxxkg4WK7GdUj1mZ2k2pmITYH usQpK1OZGiJgp713X2Tm0zTLChpNpF+8z0jy9t1c4nxo8+97y86nDw9GwZ07j+/HDg c72I5Do99yqQhBAa0YNyJyQ6V8g9J7Gn0uA4GK4T+ap1+xgRXVk0VAKugBwERxvRgw 1X6hVfzV7WSA9cIoR5Foz4n/OlaiO9e6R80eRtKKOpQUMPsZ2cytq13oobfNY1YsgQ PbEcGsRh/nhFrQ+9v2bgygBkY5dGX8zMMUo1Jv/73q0VsuVXR/3N86aKrMbXL+uYLN JByy9ZVaOO8XQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] ima: Fix out-of-bounds read in ima_read_policy() Reply-To: sashiko-reviews@lists.linux.dev Cc: linux-security-module@vger.kernel.org In-Reply-To: <20261202105724.3056284-1-roberto.sassu@huaweicloud.com> References: <20261202105724.3056284-1-roberto.sassu@huaweicloud.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 11:01:21 +0000 X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > From: Roberto Sassu >=20 > ima_read_policy() reads the policy file with kernel_read_file_from_path() > and splits it into rules with strsep(). However, the buffer allocated by > kernel_read_file_from_path() is exactly the size of the file and is not > NUL-terminated. If the policy file does not end with a newline, strsep() > scans past the end of the buffer while looking for the next separator. If > the file size is a multiple of PAGE_SIZE, the scan reaches the vmalloc > guard page and the kernel oopses. >=20 > To avoid the problem, reject the read policy if does not end with a newli= ne > or the NUL terminator. >=20 > Fixes: 7429b092811f ("ima: load policy using path") > Reported-by: Fabrice Derepas > Closes: https://lore.kernel.org/linux-integrity/20260814085443.1211989-1-= fabrice.derepas@canonical.com/ > Suggested-by: Mimi Zohar > Signed-off-by: Roberto Sassu Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202105724.3056= 284-1-roberto.sassu@huaweicloud.com?part=3D1