rpm: fix CVE-2021-3521
PATCH v3 1/1 rpm: fix CVE-2021-3521
From: Changqing Li <[email protected]>
--- .../rpm/files/0001-CVE-2021-3521.patch | 57 +++ .../rpm/files/0002-CVE-2021-3521.patch | 64 ++++ .../rpm/files/0003-CVE-2021-3521.patch | 329 ++++++++++++++++++ meta/recipes-devtools/rpm/rpm_4.17.0.bb | 3 + 4 files changed, 453 insertions(+) create mode 100644 meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch create mode 100644 meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch create mode 100644 meta/recipes-devtools/rpm/files/0003-CVE-2021-3521.patch
meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch new file +57 -0
@@ -0,0 +1,57 @@ +From 9a6871126f472feea057d5f803505ec8cc78f083 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen <[email protected]> +Date: Thu, 30 Sep 2021 09:56:20 +0300 +Subject: [PATCH 1/3] Refactor pgpDigParams construction to helper function + +No functional changes, just to reduce code duplication and needed by +the following commits. + +CVE: CVE-2021-3521 +Upstream-Status: Backport[https://github.com/rpm-software-management/rpm/commit/9f03f42e2] + +Signed-off-by: Changqing Li <[email protected]> +--- + rpmio/rpmpgp.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c +index d0688ebe9a..e472b5320f 100644 +--- a/rpmio/rpmpgp.c ++++ b/rpmio/rpmpgp.c +@@ -1041,6 +1041,13 @@ unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype) + return algo; + } + ++static pgpDigParams pgpDigParamsNew(uint8_t tag) ++{ ++ pgpDigParams digp = xcalloc(1, sizeof(*digp)); ++ digp->tag = tag; ++ return digp; ++} ++ + int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, + pgpDigParams * ret) + { +@@ -1058,8 +1065,7 @@ int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, + if (pkttype && pkt.tag != pkttype) { + break; + } else { +- digp = xcalloc(1, sizeof(*digp)); +- digp->tag = pkt.tag; ++ digp = pgpDigParamsNew(pkt.tag); + } + } + +@@ -1105,8 +1111,7 @@ int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen, + digps = xrealloc(digps, alloced * sizeof(*digps)); + } + +- digps[count] = xcalloc(1, sizeof(**digps)); +- digps[count]->tag = PGPTAG_PUBLIC_SUBKEY; ++ digps[count] = pgpDigParamsNew(PGPTAG_PUBLIC_SUBKEY); + /* Copy UID from main key to subkey */ + digps[count]->userid = xstrdup(mainkey->userid); + +-- +2.17.1 +
meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch new file +64 -0
64 lines not on this page · raw message
meta/recipes-devtools/rpm/files/0003-CVE-2021-3521.patch new file +329 -0
329 lines not on this page · raw message
meta/recipes-devtools/rpm/rpm_4.17.0.bb +3 -0
@@ -39,6 +39,9 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.17.x;protoc file://0001-tools-Add-error.h-for-non-glibc-case.patch \ file://0001-docs-do-not-build-manpages-requires-pandoc.patch \ file://0001-build-pack.c-do-not-insert-payloadflags-into-.rpm-me.patch \ + file://0001-CVE-2021-3521.patch \ + file://0002-CVE-2021-3521.patch \ + file://0003-CVE-2021-3521.patch \ " PE = "1"
Signature · 1 line
2.17.1
Quoted 82 lines · Changqing Li
From: Changqing Li <[email protected]>
Signed-off-by Changqing Li <[email protected]>--- .../rpm/files/0001-CVE-2021-3521.patch | 57 +++ .../rpm/files/0002-CVE-2021-3521.patch | 64 ++++ .../rpm/files/0003-CVE-2021-3521.patch | 329 ++++++++++++++++++ meta/recipes-devtools/rpm/rpm_4.17.0.bb | 3 + 4 files changed, 453 insertions(+) create mode 100644 meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch create mode 100644 meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch create mode 100644 meta/recipes-devtools/rpm/files/0003-CVE-2021-3521.patchmeta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch new file +57
-0@@ -0,0 +1,57 @@ +From 9a6871126f472feea057d5f803505ec8cc78f083 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen <[email protected]> +Date: Thu, 30 Sep 2021 09:56:20 +0300 +Subject: [PATCH 1/3] Refactor pgpDigParams construction to helper function + +No functional changes, just to reduce code duplication and needed by +the following commits. + +CVE: CVE-2021-3521 +Upstream-Status: Backport[https://github.com/rpm-software-management/rpm/commit/9f03f42e2] + +Signed-off-by: Changqing Li <[email protected]> +--- + rpmio/rpmpgp.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c +index d0688ebe9a..e472b5320f 100644 +--- a/rpmio/rpmpgp.c ++++ b/rpmio/rpmpgp.c +@@ -1041,6 +1041,13 @@ unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype) + return algo; + } + ++static pgpDigParams pgpDigParamsNew(uint8_t tag) ++{ ++ pgpDigParams digp = xcalloc(1, sizeof(*digp)); ++ digp->tag = tag; ++ return digp; ++} ++ + int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, + pgpDigParams * ret) + { +@@ -1058,8 +1065,7 @@ int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, + if (pkttype && pkt.tag != pkttype) { + break; + } else { +- digp = xcalloc(1, sizeof(*digp)); +- digp->tag = pkt.tag; ++ digp = pgpDigParamsNew(pkt.tag); + } + } + +@@ -1105,8 +1111,7 @@ int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen, + digps = xrealloc(digps, alloced * sizeof(*digps)); + } + +- digps[count] = xcalloc(1, sizeof(**digps)); +- digps[count]->tag = PGPTAG_PUBLIC_SUBKEY; ++ digps[count] = pgpDigParamsNew(PGPTAG_PUBLIC_SUBKEY); + /* Copy UID from main key to subkey */ + digps[count]->userid = xstrdup(mainkey->userid); + +-- +2.17.1 +meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch new file +0
-0
meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch line 10
Quoted 10 lines
meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch new file +10
-0@@ -0,0 +1,64 @@ +From c4b1bee51bbdd732b94b431a951481af99117703 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen <[email protected]> +Date: Thu, 30 Sep 2021 09:51:10 +0300 +Subject: [PATCH 2/3] Process MPI's from all kinds of signatures + +No immediate effect but needed by the following commits. + +CVE: CVE-2021-3521 +Upstream-Status: Backport[https://github.com/rpm-software-management/rpm/commit/b5e8bc74b] +
The new tests also trigger for the missing space above after Backport. It does make me wonder why you don't see those test failures. I've tweaked the patches in master-next to fix this.
Cheers,
Richard
Quoted 90 lines · Richard Purdie
[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 87 lines · Changqing Li
From: Changqing Li <[email protected]>
Signed-off-by Changqing Li <[email protected]>--- .../rpm/files/0001-CVE-2021-3521.patch | 57 +++ .../rpm/files/0002-CVE-2021-3521.patch | 64 ++++ .../rpm/files/0003-CVE-2021-3521.patch | 329 ++++++++++++++++++ meta/recipes-devtools/rpm/rpm_4.17.0.bb | 3 + 4 files changed, 453 insertions(+)create mode 100644
meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patchcreate mode 100644meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patchcreate mode 100644meta/recipes-devtools/rpm/files/0003-CVE-2021-3521.patchmeta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch new file +57
-0@@ -0,0 +1,57 @@ +From 9a6871126f472feea057d5f803505ec8cc78f083 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen <[email protected]> +Date: Thu, 30 Sep 2021 09:56:20 +0300 +Subject: [PATCH 1/3] Refactor pgpDigParams construction to helper function + +No functional changes, just to reduce code duplication and needed by +the following commits. + +CVE: CVE-2021-3521 +Upstream-Status: Backport[https://github.com/rpm-software-management/rpm/commit/9f03f42e2] + +Signed-off-by: Changqing Li <[email protected]> +--- + rpmio/rpmpgp.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c +index d0688ebe9a..e472b5320f 100644 +--- a/rpmio/rpmpgp.c ++++ b/rpmio/rpmpgp.c +@@ -1041,6 +1041,13 @@ unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype) + return algo; + } + ++static pgpDigParams pgpDigParamsNew(uint8_t tag) ++{ ++ pgpDigParams digp = xcalloc(1, sizeof(*digp)); ++ digp->tag = tag; ++ return digp; ++} ++ + int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, + pgpDigParams * ret) + { +@@ -1058,8 +1065,7 @@ int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, + if (pkttype && pkt.tag != pkttype) { + break; + } else { +- digp = xcalloc(1, sizeof(*digp)); +- digp->tag = pkt.tag; ++ digp = pgpDigParamsNew(pkt.tag); + } + } + +@@ -1105,8 +1111,7 @@ int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen, + digps = xrealloc(digps, alloced * sizeof(*digps)); + } + +- digps[count] = xcalloc(1, sizeof(**digps)); +- digps[count]->tag = PGPTAG_PUBLIC_SUBKEY; ++ digps[count] = pgpDigParamsNew(PGPTAG_PUBLIC_SUBKEY); + /* Copy UID from main key to subkey */ + digps[count]->userid = xstrdup(mainkey->userid); + +-- +2.17.1 +meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch new file +5
-0@@ -0,0 +1,64 @@ +From c4b1bee51bbdd732b94b431a951481af99117703 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen <[email protected]> +Date: Thu, 30 Sep 2021 09:51:10 +0300 +Subject: [PATCH 2/3] Process MPI's from all kinds of signatures +
Quoted 8 lines
meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch line 10
Quoted 5 lines
meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch new file +5
-0+No immediate effect but needed by the following commits. + +CVE: CVE-2021-3521 +Upstream-Status: Backport[https://github.com/rpm-software-management/rpm/commit/b5e8bc74b] +The new tests also trigger for the missing space above after Backport. It does make me wonder why you don't see those test failures. I've tweaked the patches in master-next to fix this.
Thanks.
I don't receive mail about the failure, seems the patchwork is not working.
Regards
Changqing
Quoted 4 lines
Cheers,
Richard
Quoted 99 lines · Changqing Li
Quoted 90 lines · Richard Purdie
[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 87 lines · Changqing Li
From: Changqing Li <[email protected]>
Signed-off-by Changqing Li <[email protected]>--- .../rpm/files/0001-CVE-2021-3521.patch | 57 +++ .../rpm/files/0002-CVE-2021-3521.patch | 64 ++++ .../rpm/files/0003-CVE-2021-3521.patch | 329 ++++++++++++++++++ meta/recipes-devtools/rpm/rpm_4.17.0.bb | 3 + 4 files changed, 453 insertions(+)create mode 100644
meta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patchcreate mode 100644meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patchcreate mode 100644meta/recipes-devtools/rpm/files/0003-CVE-2021-3521.patchmeta/recipes-devtools/rpm/files/0001-CVE-2021-3521.patch new file +57
-0@@ -0,0 +1,57 @@ +From 9a6871126f472feea057d5f803505ec8cc78f083 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen <[email protected]> +Date: Thu, 30 Sep 2021 09:56:20 +0300 +Subject: [PATCH 1/3] Refactor pgpDigParams construction to helper function + +No functional changes, just to reduce code duplication and needed by +the following commits. + +CVE: CVE-2021-3521 +Upstream-Status: Backport[https://github.com/rpm-software-management/rpm/commit/9f03f42e2] + +Signed-off-by: Changqing Li <[email protected]> +--- + rpmio/rpmpgp.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c +index d0688ebe9a..e472b5320f 100644 +--- a/rpmio/rpmpgp.c ++++ b/rpmio/rpmpgp.c +@@ -1041,6 +1041,13 @@ unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype) + return algo; + } + ++static pgpDigParams pgpDigParamsNew(uint8_t tag) ++{ ++ pgpDigParams digp = xcalloc(1, sizeof(*digp)); ++ digp->tag = tag; ++ return digp; ++} ++ + int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, + pgpDigParams * ret) + { +@@ -1058,8 +1065,7 @@ int pgpPrtParams(const uint8_t * pkts, size_t pktlen, unsigned int pkttype, + if (pkttype && pkt.tag != pkttype) { + break; + } else { +- digp = xcalloc(1, sizeof(*digp)); +- digp->tag = pkt.tag; ++ digp = pgpDigParamsNew(pkt.tag); + } + } + +@@ -1105,8 +1111,7 @@ int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen, + digps = xrealloc(digps, alloced * sizeof(*digps)); + } + +- digps[count] = xcalloc(1, sizeof(**digps)); +- digps[count]->tag = PGPTAG_PUBLIC_SUBKEY; ++ digps[count] = pgpDigParamsNew(PGPTAG_PUBLIC_SUBKEY); + /* Copy UID from main key to subkey */ + digps[count]->userid = xstrdup(mainkey->userid); + +-- +2.17.1 +meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch new file +5
-0@@ -0,0 +1,64 @@ +From c4b1bee51bbdd732b94b431a951481af99117703 Mon Sep 17 00:00:00 2001 +From: Panu Matilainen <[email protected]> +Date: Thu, 30 Sep 2021 09:51:10 +0300 +Subject: [PATCH 2/3] Process MPI's from all kinds of signatures +Quoted 8 lines
meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch line 10
Quoted 5 lines
meta/recipes-devtools/rpm/files/0002-CVE-2021-3521.patch new file +5
-0+No immediate effect but needed by the following commits. + +CVE: CVE-2021-3521 +Upstream-Status: Backport[https://github.com/rpm-software-management/rpm/commit/b5e8bc74b] +The new tests also trigger for the missing space above after Backport. It does make me wonder why you don't see those test failures. I've tweaked the patches in master-next to fix this.
Quoted 3 lines
Thanks.
I don't receive mail about the failure, seems the patchwork is not working.
You should have seen the error when you tried building/testing the patch locally...
Cheers,
Richard