From bippy-c9c4e1df01b2 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: <linux-cve-announce@vger.kernel.org>
Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org>
Subject: CVE-2024-36031: keys: Fix overwrite of key expiration on instantiation

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

keys: Fix overwrite of key expiration on instantiation

The expiry time of a key is unconditionally overwritten during
instantiation, defaulting to turn it permanent. This causes a problem
for DNS resolution as the expiration set by user-space is overwritten to
TIME64_MAX, disabling further DNS updates. Fix this by restoring the
condition that key_set_expiry is only called when the pre-parser sets a
specific expiry.

The Linux kernel CVE team has assigned CVE-2024-36031 to this issue.


Affected and fixed versions
===========================

	Issue introduced in 5.10.206 with commit 97be1e865e70 and fixed in 5.10.217 with commit ad2011ea7879
	Issue introduced in 5.15.146 with commit 2552b32b0b34 and fixed in 5.15.159 with commit ed79b93f725c
	Issue introduced in 6.1.70 with commit 791d5409cdb9 and fixed in 6.1.91 with commit e4519a016650
	Issue introduced in 6.6.9 with commit afc360e8a125 and fixed in 6.6.31 with commit 25777f3f4e1f
	Issue introduced in 6.7 with commit 39299bdd2546 and fixed in 6.8.10 with commit 939a08bcd433
	Issue introduced in 6.7 with commit 39299bdd2546 and fixed in 6.9.1 with commit cc219cb8afbc
	Issue introduced in 6.7 with commit 39299bdd2546 and fixed in 6.10 with commit 9da27fb65a14

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-36031
will be updated if fixes are backported, please check that for the most
up to date information about this issue.


Affected files
==============

The file(s) affected by this issue are:
	security/keys/key.c


Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/ad2011ea787928b2accb5134f1e423b11fe80a8a
	https://git.kernel.org/stable/c/ed79b93f725cd0da39a265dc23d77add1527b9be
	https://git.kernel.org/stable/c/e4519a016650e952ad9eb27937f8c447d5a4e06d
	https://git.kernel.org/stable/c/25777f3f4e1f371d16a594925f31e37ce07b6ec7
	https://git.kernel.org/stable/c/939a08bcd4334bad4b201e60bd0ae1f278d71d41
	https://git.kernel.org/stable/c/cc219cb8afbc40ec100c0de941047bb29373126a
	https://git.kernel.org/stable/c/9da27fb65a14c18efd4473e2e82b76b53ba60252
