Message ID | 20250717113529.1025378-1-Deepesh.Varatharajan@windriver.com |
---|---|
State | New |
Headers | show |
Series | binutils: Fix CVE-2025-7545 | expand |
LGTM On Thu, Jul 17, 2025 at 4:35 AM Varatharajan, Deepesh via lists.openembedded.org <deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote: > > From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > > objcopy: Don't extend the output section size > Since the output section contents are copied from the input, don't > extend the output section size beyond the input section size. > > Backport a patch from upstream to fix CVE-2025-7545 > Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944] > > Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > --- > .../binutils/binutils-2.44.inc | 1 + > .../binutils/0020-CVE-2025-7545.patch | 39 +++++++++++++++++++ > 2 files changed, 40 insertions(+) > create mode 100644 meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch > > diff --git a/meta/recipes-devtools/binutils/binutils-2.44.inc b/meta/recipes-devtools/binutils/binutils-2.44.inc > index 2219ada4ac..c8d655c990 100644 > --- a/meta/recipes-devtools/binutils/binutils-2.44.inc > +++ b/meta/recipes-devtools/binutils/binutils-2.44.inc > @@ -43,4 +43,5 @@ SRC_URI = "\ > file://0018-CVE-2025-5245.patch \ > file://0019-CVE-2025-5244.patch \ > file://0019-CVE-2025-3198.patch \ > + file://0020-CVE-2025-7545.patch \ > " > diff --git a/meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch b/meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch > new file mode 100644 > index 0000000000..062d6721b6 > --- /dev/null > +++ b/meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch > @@ -0,0 +1,39 @@ > +From: "H.J. Lu" <hjl.tools@gmail.com> > +Date: Sat, 21 Jun 2025 06:36:56 +0800 > + > +Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944] > +CVE: CVE-2025-7545 > + > +Since the output section contents are copied from the input, don't > +extend the output section size beyond the input section size. > + > + PR binutils/33049 > + * objcopy.c (copy_section): Don't extend the output section > + size beyond the input section size. > + > +Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > + > +diff --git a/binutils/objcopy.c b/binutils/objcopy.c > +index e2e6bd7e..3cbb3977 100644 > +--- a/binutils/objcopy.c > ++++ b/binutils/objcopy.c > +@@ -4634,6 +4634,7 @@ copy_section (bfd *ibfd, sec_ptr isection, bfd *obfd) > + char *to = (char *) memhunk; > + char *end = (char *) memhunk + size; > + int i; > ++ bfd_size_type memhunk_size = size; > + > + /* If the section address is not exactly divisible by the interleave, > + then we must bias the from address. If the copy_byte is less than > +@@ -4653,6 +4654,11 @@ copy_section (bfd *ibfd, sec_ptr isection, bfd *obfd) > + } > + > + size = (size + interleave - 1 - copy_byte) / interleave * copy_width; > ++ > ++ /* Don't extend the output section size. */ > ++ if (size > memhunk_size) > ++ size = memhunk_size; > ++ > + osection->lma /= interleave; > + if (copy_byte < extra) > + osection->lma++; > -- > 2.49.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#220532): https://lists.openembedded.org/g/openembedded-core/message/220532 > Mute This Topic: https://lists.openembedded.org/mt/114201310/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-devtools/binutils/binutils-2.44.inc b/meta/recipes-devtools/binutils/binutils-2.44.inc index 2219ada4ac..c8d655c990 100644 --- a/meta/recipes-devtools/binutils/binutils-2.44.inc +++ b/meta/recipes-devtools/binutils/binutils-2.44.inc @@ -43,4 +43,5 @@ SRC_URI = "\ file://0018-CVE-2025-5245.patch \ file://0019-CVE-2025-5244.patch \ file://0019-CVE-2025-3198.patch \ + file://0020-CVE-2025-7545.patch \ " diff --git a/meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch b/meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch new file mode 100644 index 0000000000..062d6721b6 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch @@ -0,0 +1,39 @@ +From: "H.J. Lu" <hjl.tools@gmail.com> +Date: Sat, 21 Jun 2025 06:36:56 +0800 + +Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944] +CVE: CVE-2025-7545 + +Since the output section contents are copied from the input, don't +extend the output section size beyond the input section size. + + PR binutils/33049 + * objcopy.c (copy_section): Don't extend the output section + size beyond the input section size. + +Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> + +diff --git a/binutils/objcopy.c b/binutils/objcopy.c +index e2e6bd7e..3cbb3977 100644 +--- a/binutils/objcopy.c ++++ b/binutils/objcopy.c +@@ -4634,6 +4634,7 @@ copy_section (bfd *ibfd, sec_ptr isection, bfd *obfd) + char *to = (char *) memhunk; + char *end = (char *) memhunk + size; + int i; ++ bfd_size_type memhunk_size = size; + + /* If the section address is not exactly divisible by the interleave, + then we must bias the from address. If the copy_byte is less than +@@ -4653,6 +4654,11 @@ copy_section (bfd *ibfd, sec_ptr isection, bfd *obfd) + } + + size = (size + interleave - 1 - copy_byte) / interleave * copy_width; ++ ++ /* Don't extend the output section size. */ ++ if (size > memhunk_size) ++ size = memhunk_size; ++ + osection->lma /= interleave; + if (copy_byte < extra) + osection->lma++;