|
|
0c1cd1 |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
0c1cd1 |
From: Keith Seitz <keiths@redhat.com>
|
|
|
0c1cd1 |
Date: Tue, 28 Jul 2020 09:26:44 -0400
|
|
|
0c1cd1 |
Subject: gdb-rhbz1842691-corefile-mem-access-11of15.patch
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
;; Adjust coredump-filter.exp to account for NT_FILE note handling
|
|
|
0c1cd1 |
;; Kevin Buettner, RH BZ 1842961
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
Author: Kevin Buettner <kevinb@redhat.com>
|
|
|
0c1cd1 |
Date: Fri Jul 3 20:10:22 2020 -0700
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
Adjust coredump-filter.exp to account for NT_FILE note handling
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
This commit makes adjustments to coredump-filter.exp to account
|
|
|
0c1cd1 |
for the fact that NT_FILE file-backed mappings are now available
|
|
|
0c1cd1 |
when a core file is loaded. Thus, a test which was expected
|
|
|
0c1cd1 |
to PASS when a memory region was determined to be unavailable
|
|
|
0c1cd1 |
(due to no file-backed mappings being available) will now FAIL
|
|
|
0c1cd1 |
due to those mappings being available from having loaded the
|
|
|
0c1cd1 |
NT_FILE note.
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
I had originally marked the test as XFAIL, but Mihails Strasuns
|
|
|
0c1cd1 |
suggested a much better approach:
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
1) First test that it still works if file is accessible in the
|
|
|
0c1cd1 |
filesystem.
|
|
|
0c1cd1 |
2) Temporarily move / rename the file and test that disassembly
|
|
|
0c1cd1 |
doesn't work anymore.
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
That's what this commit implements.
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
gdb/testsuite/ChangeLog:
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
* gdb.base/coredump-filter.exp: Add second
|
|
|
0c1cd1 |
non-Private-Shared-Anon-File test.
|
|
|
0c1cd1 |
(test_disasm): Rename binfile for test which is expected
|
|
|
0c1cd1 |
to fail.
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp
|
|
|
0c1cd1 |
--- a/gdb/testsuite/gdb.base/coredump-filter.exp
|
|
|
0c1cd1 |
+++ b/gdb/testsuite/gdb.base/coredump-filter.exp
|
|
|
0c1cd1 |
@@ -80,15 +80,26 @@ proc do_load_and_test_core { core var working_var working_value dump_excluded }
|
|
|
0c1cd1 |
# disassemble of a function (i.e., the binary's .text section). GDB
|
|
|
0c1cd1 |
# should fail in this case. However, it must succeed if the binary is
|
|
|
0c1cd1 |
# provided along with the corefile. This is what we test here.
|
|
|
0c1cd1 |
+#
|
|
|
0c1cd1 |
+# A further complication is that Linux NT_FILE notes are now read from
|
|
|
0c1cd1 |
+# the corefile. This note allows GDB to find the binary for file
|
|
|
0c1cd1 |
+# backed mappings even though the binary wasn't loaded by GDB in the
|
|
|
0c1cd1 |
+# conventional manner. In order to see the expected failure for this
|
|
|
0c1cd1 |
+# case, we rename the binary in order to perform this test.
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
proc test_disasm { core address should_fail } {
|
|
|
0c1cd1 |
- global testfile hex
|
|
|
0c1cd1 |
+ global testfile hex binfile
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
# Restart GDB without loading the binary.
|
|
|
0c1cd1 |
with_test_prefix "no binary" {
|
|
|
0c1cd1 |
gdb_exit
|
|
|
0c1cd1 |
gdb_start
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
+ set hide_binfile [standard_output_file "${testfile}.hide"]
|
|
|
0c1cd1 |
+ if { $should_fail == 1 } {
|
|
|
0c1cd1 |
+ remote_exec host "mv -f $binfile $hide_binfile"
|
|
|
0c1cd1 |
+ }
|
|
|
0c1cd1 |
+
|
|
|
0c1cd1 |
set core_loaded [gdb_core_cmd "$core" "load core"]
|
|
|
0c1cd1 |
if { $core_loaded == -1 } {
|
|
|
0c1cd1 |
fail "loading $core"
|
|
|
0c1cd1 |
@@ -96,6 +107,7 @@ proc test_disasm { core address should_fail } {
|
|
|
0c1cd1 |
}
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
if { $should_fail == 1 } {
|
|
|
0c1cd1 |
+ remote_exec host "mv -f $hide_binfile $binfile"
|
|
|
0c1cd1 |
gdb_test "x/i \$pc" "=> $hex:\tCannot access memory at address $hex" \
|
|
|
0c1cd1 |
"disassemble function with corefile and without a binary"
|
|
|
0c1cd1 |
} else {
|
|
|
0c1cd1 |
@@ -225,5 +237,9 @@ foreach item $all_anon_corefiles {
|
|
|
0c1cd1 |
}
|
|
|
0c1cd1 |
|
|
|
0c1cd1 |
with_test_prefix "loading and testing corefile for non-Private-Shared-Anon-File" {
|
|
|
0c1cd1 |
+ test_disasm $non_private_shared_anon_file_core $main_addr 0
|
|
|
0c1cd1 |
+}
|
|
|
0c1cd1 |
+
|
|
|
0c1cd1 |
+with_test_prefix "loading and testing corefile for non-Private-Shared-Anon-File with renamed binary" {
|
|
|
0c1cd1 |
test_disasm $non_private_shared_anon_file_core $main_addr 1
|
|
|
0c1cd1 |
}
|