gdb: Upgrade from 8.2.1 to 8.3

Bump GDB and change the oeqa selftest expression to allow ptests to
pass.

(From OE-Core rev: f31986ed9f82c48834b2f25979c93697228acbf7)

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alistair Francis
2019-05-17 16:53:08 -07:00
committed by Richard Purdie
parent 1df11198ee
commit ebedc1511d
13 changed files with 24 additions and 234 deletions

View File

@@ -21,7 +21,7 @@ PREFERRED_PROVIDER_virtual/gettext ??= "gettext"
GCCVERSION ?= "8.%"
SDKGCCVERSION ?= "${GCCVERSION}"
BINUVERSION ?= "2.32%"
GDBVERSION ?= "8.2%"
GDBVERSION ?= "8.3%"
GLIBCVERSION ?= "2.29%"
LINUXLIBCVERSION ?= "5.0%"
QEMUVERSION ?= "4.0%"

View File

@@ -7,6 +7,7 @@ from oeqa.utils.commands import bitbake, get_bb_vars, get_bb_var, runqemu
import stat
import subprocess, os
import oe.path
import re
class VersionOrdering(OESelftestTestCase):
# version1, version2, sort order
@@ -134,7 +135,7 @@ class PackageTests(OESelftestTestCase):
return False
# Check debugging symbols works correctly
elif "Breakpoint 1, main () at hello.c:4" in l:
elif re.match("Breakpoint 1.*hello\.c.*4", l):
return True
self.logger.error("GDB result:\n%d: %s", status, output)

View File

@@ -5,6 +5,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
SRC_URI = "http://ftp.gnu.org/gnu/gdb/gdb-${PV}.tar.xz \
file://0001-gdbserver-ctrl-c-handling.patch \
file://0002-make-man-install-relative-to-DESTDIR.patch \
file://0003-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \
file://0004-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \
@@ -15,11 +16,6 @@ SRC_URI = "http://ftp.gnu.org/gnu/gdb/gdb-${PV}.tar.xz \
file://0009-Change-order-of-CFLAGS.patch \
file://0010-resolve-restrict-keyword-conflict.patch \
file://0011-Fix-invalid-sigprocmask-call.patch \
file://gdbserver-ctrl-c-handling.patch \
file://0001-Fix-build-with-latest-GCC-9.0-tree.patch \
file://CVE-2017-9778.patch \
file://0012-AArch64-Fix-the-gdb-build-with-musl-libc.patch \
"
SRC_URI[md5sum] = "f8b2562e830a4098dd5b5ea9e9296c70"
SRC_URI[sha256sum] = "0a6a432907a03c5c8eaad3c3cffd50c00a40c3a5e3c4039440624bae703f2202"
"
SRC_URI[md5sum] = "bbd95b2f9b34621ad7a19a3965476314"
SRC_URI[sha256sum] = "802f7ee309dcc547d65a68d61ebd6526762d26c3051f52caebe2189ac1ffd72e"

View File

@@ -40,4 +40,3 @@ do_install_append() {
rm -rf ${D}${exec_prefix}/lib
cross_canadian_bindirlinks
}

View File

@@ -1,50 +0,0 @@
From 7406a50077773e78282a495cb32ef5b8179f6a33 Mon Sep 17 00:00:00 2001
From: Dimitar Dimitrov <dimitar@dinux.eu>
Date: Mon, 17 Dec 2018 21:30:52 +0200
Subject: [PATCH] Fix build with latest GCC 9.0 tree
A recent patch [1] to fix a GCC PR [2] actually broke the GDB build.
To fix, remove the stack pointer clobber. GCC will ignore the clobber
marker, and will not save or restore the stack pointer.
I ran "make check-gdb" on x86_64 to ensure there are no regressions.
gdb/ChangeLog:
2018-12-17 Dimitar Dimitrov <dimitar@dinux.eu>
* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Remove sp clobbers.
[1] https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00532.html
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813
Upstream-Status: Backport
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
gdb/ChangeLog | 5 +++++
gdb/nat/linux-ptrace.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index d4c1b8f9fd..187cfeb9bc 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -161,14 +161,14 @@ linux_ptrace_test_ret_to_nx (void)
".globl linux_ptrace_test_ret_to_nx_instr;"
"linux_ptrace_test_ret_to_nx_instr:"
"ret"
- : : "r" (return_address) : "%esp", "memory");
+ : : "r" (return_address) : "memory");
#elif defined __x86_64__
asm volatile ("pushq %0;"
".globl linux_ptrace_test_ret_to_nx_instr;"
"linux_ptrace_test_ret_to_nx_instr:"
"ret"
: : "r" ((uint64_t) (uintptr_t) return_address)
- : "%rsp", "memory");
+ : "memory");
#else
# error "!__i386__ && !__x86_64__"
#endif
--
2.20.1

View File

@@ -1,24 +1,24 @@
From 1dd5c44474b01d84de60faded960fef4a0a87e41 Mon Sep 17 00:00:00 2001
From da30370c1e3ff7728a857e119e0529a9f097086e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 30 Apr 2016 18:32:14 -0700
Subject: [PATCH 04/11] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC
systems
Subject: [PATCH] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gdb/gdbserver/linux-ppc-low.c | 6 ++++++
gdb/nat/ppc-linux.h | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 47428c1529..841a5e02b9 100644
index 1b695e53..1978347c 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -21,7 +21,13 @@
#include "linux-low.h"
@@ -23,7 +23,13 @@
#include "elf/common.h"
#include <sys/uio.h>
#include <elf.h>
+#if !defined(__GLIBC__)
+# define pt_regs uapi_pt_regs
@@ -31,12 +31,12 @@ index 47428c1529..841a5e02b9 100644
#include "arch/ppc-linux-common.h"
#include "arch/ppc-linux-tdesc.h"
diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
index 3d4d4fdc56..5b93af8d3a 100644
index f1561b3b..40399361 100644
--- a/gdb/nat/ppc-linux.h
+++ b/gdb/nat/ppc-linux.h
@@ -18,7 +18,13 @@
#ifndef PPC_LINUX_H
#define PPC_LINUX_H 1
#ifndef NAT_PPC_LINUX_H
#define NAT_PPC_LINUX_H
+#if !defined(__GLIBC__)
+# define pt_regs uapi_pt_regs
@@ -48,6 +48,3 @@ index 3d4d4fdc56..5b93af8d3a 100644
#include <asm/cputable.h>
/* This sometimes isn't defined. */
--
2.18.0

View File

@@ -1,7 +1,7 @@
From d97878b272bd7c4993f4205983ae8b7ecddbcf82 Mon Sep 17 00:00:00 2001
From bab0b34672727c50313eb98b8522355cbe1bde36 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 30 Apr 2016 15:31:40 -0700
Subject: [PATCH 08/11] Use exorted definitions of SIGRTMIN
Subject: [PATCH] Use exorted definitions of SIGRTMIN
Define W_STOPCODE if not defined already
@@ -14,16 +14,17 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=13012
Upstream-Status: Submitted
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gdb/linux-nat.c | 4 ++--
gdb/nat/linux-nat.h | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 64015e7520..acf950c38b 100644
index 063afe26..fb1d2d5d 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4724,6 +4724,6 @@ lin_thread_get_thread_signals (sigset_t *set)
@@ -4713,6 +4713,6 @@ lin_thread_get_thread_signals (sigset_t *set)
/* NPTL reserves the first two RT signals, but does not provide any
way for the debugger to query the signal numbers - fortunately
they don't change. */
@@ -33,7 +34,7 @@ index 64015e7520..acf950c38b 100644
+ sigaddset (set, SIGRTMIN + 1);
}
diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
index a90a124d3a..4f3e681962 100644
index 1e32dd9e..b886305d 100644
--- a/gdb/nat/linux-nat.h
+++ b/gdb/nat/linux-nat.h
@@ -90,4 +90,8 @@ extern void linux_stop_lwp (struct lwp_info *lwp);
@@ -44,7 +45,4 @@ index a90a124d3a..4f3e681962 100644
+#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
+#endif
+
#endif /* LINUX_NAT_H */
--
2.18.0
#endif /* NAT_LINUX_NAT_H */

View File

@@ -1,52 +0,0 @@
From cbbf1a8ba7f037ba3b83f090829edcbab542c285 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Thu, 13 Dec 2018 17:47:17 +0000
Subject: [PATCH] AArch64: Fix the gdb build with musl libc
Including asm/sigcontext.h together with libc headers is not valid. In
general linux headers may not work with libc headers, so mixing them
should be avoided, especially when the linux header defines types that
are also exposed in libc headers.
In case of asm/sigcontext.h glibc happens to work because glibc signal.h
directly includes it, but e.g. in musl libc signal.h replicates the
sigcontext.h definitions in an abi compatible way which are in conflict
with the linux definitions when both headers are included.
Since old linux headers or old libc headers may not have the necessary
definitions, gdb has to replicate the definitions it relies on anyway.
Which is fine since all definitions must be ABI stable. For linux apis
that are not available via libc headers, replicating the definitions in
gdb is the most reliable way to use them.
Note: asm/ptrace.h includes asm/sigcontext.h in some versions of linux
headers, which is just as problematic and should be fixed in linux.
gdb/ChangeLog:
* nat/aarch64-sve-linux-ptrace.h: Include signal.h instead of
asm/sigcontext.h.
[ChangeLog entry stripped so that patch applies cleanly]
Upstream-Status: Backport
Signed-off-by: Paul Barker <paul@betafive.co.uk>
---
gdb/nat/aarch64-sve-linux-ptrace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/nat/aarch64-sve-linux-ptrace.h b/gdb/nat/aarch64-sve-linux-ptrace.h
index 029e753ffe..172ae39432 100644
--- a/gdb/nat/aarch64-sve-linux-ptrace.h
+++ b/gdb/nat/aarch64-sve-linux-ptrace.h
@@ -20,7 +20,7 @@
#ifndef AARCH64_SVE_LINUX_PTRACE_H
#define AARCH64_SVE_LINUX_PTRACE_H
-#include <asm/sigcontext.h>
+#include <signal.h>
#include <sys/utsname.h>
#include <sys/ptrace.h>
#include <asm/ptrace.h>
--
2.17.1

View File

@@ -1,99 +0,0 @@
From a608b79f30ab3f670095e14ba3d3b5b24a19fe68 Mon Sep 17 00:00:00 2001
From: Sandra Loosemore <sandra@codesourcery.com>
Date: Thu, 25 Apr 2019 07:27:02 -0700
Subject: [PATCH] Detect invalid length field in debug frame FDE header.
GDB was failing to catch cases where a corrupt ELF or core file
contained an invalid length value in a Dwarf debug frame FDE header.
It was checking for buffer overflow but not cases where the length was
negative or caused pointer wrap-around.
In addition to the additional validity check, this patch cleans up the
multiple signed/unsigned conversions on the length field so that an
unsigned representation is used consistently throughout.
This patch fixes CVE-2017-9778 and PR gdb/21600.
2019-04-25 Sandra Loosemore <sandra@codesourcery.com>
Kang Li <kanglictf@gmail.com>
PR gdb/21600
* dwarf2-frame.c (read_initial_length): Be consistent about using
unsigned representation of length.
(decode_frame_entry_1): Likewise. Check for wraparound of
end pointer as well as buffer overflow.
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=723adb650a31859d7cc45832cb8adca0206455ed]
CVE: CVE-2017-9778
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
gdb/ChangeLog | 11 +++++++++++
gdb/dwarf2-frame.c | 14 +++++++-------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3711dc7..0a9720b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2019-04-25 Sandra Loosemore <sandra@codesourcery.com>
+ Kang Li <kanglictf@gmail.com>
+
+ PR gdb/21600
+
+ * dwarf2-frame.c (read_initial_length): Be consistent about using
+ unsigned representation of length.
+ (decode_frame_entry_1): Likewise. Check for wraparound of
+ end pointer as well as buffer overflow.
+
+
2018-12-23 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 8.2.1.
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 91e16cf..a7b99fd 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1477,7 +1477,7 @@ static ULONGEST
read_initial_length (bfd *abfd, const gdb_byte *buf,
unsigned int *bytes_read_ptr)
{
- LONGEST result;
+ ULONGEST result;
result = bfd_get_32 (abfd, buf);
if (result == 0xffffffff)
@@ -1780,7 +1780,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
{
struct gdbarch *gdbarch = get_objfile_arch (unit->objfile);
const gdb_byte *buf, *end;
- LONGEST length;
+ ULONGEST length;
unsigned int bytes_read;
int dwarf64_p;
ULONGEST cie_id;
@@ -1791,15 +1791,15 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
buf = start;
length = read_initial_length (unit->abfd, buf, &bytes_read);
buf += bytes_read;
- end = buf + length;
-
- /* Are we still within the section? */
- if (end > unit->dwarf_frame_buffer + unit->dwarf_frame_size)
- return NULL;
+ end = buf + (size_t) length;
if (length == 0)
return end;
+ /* Are we still within the section? */
+ if (end <= buf || end > unit->dwarf_frame_buffer + unit->dwarf_frame_size)
+ return NULL;
+
/* Distinguish between 32 and 64-bit encoded frame info. */
dwarf64_p = (bytes_read == 12);
--
2.7.4