Blame SOURCES/CVE-2024-1086.patch

8416e5
From 0b95e025ee195fd549a77916c14af38e9b25ac16 Mon Sep 17 00:00:00 2001
8416e5
From: Ryan Sullivan <rysulliv@redhat.com>
8416e5
Date: Tue, 16 Apr 2024 13:57:40 -0400
8416e5
Subject: [KPATCH CVE-2024-1086] kpatch fixes for CVE-2024-1086
8416e5
8416e5
Kernels:
8416e5
3.10.0-1160.102.1.el7
8416e5
3.10.0-1160.105.1.el7
8416e5
3.10.0-1160.108.1.el7
8416e5
8416e5
8416e5
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-7/-/merge_requests/70
8416e5
Approved-by: Joe Lawrence (@joe.lawrence)
8416e5
Changes since last build:
8416e5
[x86_64]:
8416e5
nf_tables_api.o: changed function: nft_data_init
8416e5
8416e5
[ppc64le]:
8416e5
nf_tables_api.o: changed function: nft_data_init
8416e5
nf_tables_api.o: changed function: nft_del_setelem
8416e5
8416e5
---------------------------
8416e5
8416e5
Modifications: none
8416e5
8416e5
commit 03d2627c7d53c06b8b28f5a57eb48ddbc1829c12
8416e5
Author: Florian Westphal <fwestpha@redhat.com>
8416e5
Date:   Fri Feb 2 15:28:35 2024 +0100
8416e5
8416e5
    netfilter: nf_tables: reject QUEUE/DROP verdict parameters
8416e5
8416e5
    JIRA: https://issues.redhat.com/browse/RHEL-23500
8416e5
    Upstream Status: commit f342de4e2f33
8416e5
    CVE: CVE-2024-1086
8416e5
8416e5
    commit f342de4e2f33e0e39165d8639387aa6c19dff660
8416e5
    Author: Florian Westphal <fw@strlen.de>
8416e5
    Date:   Sat Jan 20 22:50:04 2024 +0100
8416e5
8416e5
        netfilter: nf_tables: reject QUEUE/DROP verdict parameters
8416e5
8416e5
        This reverts commit e0abdadcc6e1.
8416e5
8416e5
        core.c:nf_hook_slow assumes that the upper 16 bits of NF_DROP
8416e5
        verdicts contain a valid errno, i.e. -EPERM, -EHOSTUNREACH or similar,
8416e5
        or 0.
8416e5
8416e5
        Due to the reverted commit, its possible to provide a positive
8416e5
        value, e.g. NF_ACCEPT (1), which results in use-after-free.
8416e5
8416e5
        Its not clear to me why this commit was made.
8416e5
8416e5
        NF_QUEUE is not used by nftables; "queue" rules in nftables
8416e5
        will result in use of "nft_queue" expression.
8416e5
8416e5
        If we later need to allow specifiying errno values from userspace
8416e5
        (do not know why), this has to call NF_DROP_GETERR and check that
8416e5
        "err <= 0" holds true.
8416e5
8416e5
        Fixes: e0abdadcc6e1 ("netfilter: nf_tables: accept QUEUE/DROP verdict parameters")
8416e5
        Cc: stable@vger.kernel.org
8416e5
        Reported-by: Notselwyn <notselwyn@pwning.tech>
8416e5
        Signed-off-by: Florian Westphal <fw@strlen.de>
8416e5
        Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
8416e5
8416e5
    Signed-off-by: Florian Westphal <fwestpha@redhat.com>
8416e5
8416e5
Signed-off-by: Ryan Sullivan <rysulliv@redhat.com>
8416e5
---
8416e5
 net/netfilter/nf_tables_api.c | 16 ++++++----------
8416e5
 1 file changed, 6 insertions(+), 10 deletions(-)
8416e5
8416e5
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
8416e5
index ed8a787ac400..940f947b5fe7 100644
8416e5
--- a/net/netfilter/nf_tables_api.c
8416e5
+++ b/net/netfilter/nf_tables_api.c
8416e5
@@ -4629,16 +4629,10 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
8416e5
 	data->verdict.code = ntohl(nla_get_be32(tb[NFTA_VERDICT_CODE]));
8416e5
 
8416e5
 	switch (data->verdict.code) {
8416e5
-	default:
8416e5
-		switch (data->verdict.code & NF_VERDICT_MASK) {
8416e5
-		case NF_ACCEPT:
8416e5
-		case NF_DROP:
8416e5
-		case NF_QUEUE:
8416e5
-			break;
8416e5
-		default:
8416e5
-			return -EINVAL;
8416e5
-		}
8416e5
-		/* fall through */
8416e5
+	case NF_ACCEPT:
8416e5
+	case NF_DROP:
8416e5
+	case NF_QUEUE:
8416e5
+		break;
8416e5
 	case NFT_CONTINUE:
8416e5
 	case NFT_BREAK:
8416e5
 	case NFT_RETURN:
8416e5
@@ -4657,6 +4651,8 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
8416e5
 		chain->use++;
8416e5
 		data->verdict.chain = chain;
8416e5
 		break;
8416e5
+	default:
8416e5
+		return -EINVAL;
8416e5
 	}
8416e5
 
8416e5
 	desc->len = sizeof(data->verdict);
8416e5
-- 
8416e5
2.45.1
8416e5
8416e5