diff --git a/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-1of5.patch b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-1of5.patch
new file mode 100644
index 0000000..f25e5cf
--- /dev/null
+++ b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-1of5.patch
@@ -0,0 +1,83 @@
+commit afa840dcc021eaeb975dcde3bedbf46ea0511717
+Author: Sergio Lopez <slp@redhat.com>
+Date:   Mon Dec 4 09:17:12 2017 +0100
+
+    Implement 'set dump-excluded-mappings' command
+    
+    Commit df8411da087dc05481926f4c4a82deabc5bc3859 implemented support for
+    checking /proc/PID/coredump_filter, and also changed gcore behavior to
+    unconditionally honor the VM_DONTDUMP flag, preventing sections marked
+    as such for being dumped into the core file.
+    
+    This patch implements the 'set dump-excluded-mappings' command for
+    instructing gdb to ignore the VM_DONTDUMP flag. Combined with 'set
+    use-coredump-filter', this allows the user to restore the old behavior,
+    dumping all sections (except the ones marked as IO) unconditionally.
+    
+    gdb/Changelog:
+    2017-11-29  Sergio Lopez  <slp@redhat.com>
+    
+            * linux-tdep.c (dump_excluded_mappings): New variable.
+            (dump_mapping_p): Use dump_excluded_mappings variable.
+            (_initialize_linux_tdep): New command 'set dump_excluded_mappings'.
+
+Index: gdb-7.6.1/gdb/linux-tdep.c
+===================================================================
+--- gdb-7.6.1.orig/gdb/linux-tdep.c	2017-12-06 20:38:51.182203906 +0100
++++ gdb-7.6.1/gdb/linux-tdep.c	2017-12-06 20:39:12.708343183 +0100
+@@ -88,6 +88,11 @@
+ 
+ static int use_coredump_filter = 1;
+ 
++/* Whether the value of smaps_vmflags->exclude_coredump should be
++   ignored, including mappings marked with the VM_DONTDUMP flag in
++   the dump.  */
++static int dump_excluded_mappings = 0;
++
+ static struct gdbarch_data *linux_gdbarch_data_handle;
+ 
+ struct linux_gdbarch_data
+@@ -512,7 +517,7 @@
+ 	return 0;
+ 
+       /* Check if we should exclude this mapping.  */
+-      if (v->exclude_coredump)
++      if (!dump_excluded_mappings && v->exclude_coredump)
+ 	return 0;
+ 
+       /* Update our notion of whether this mapping is shared or
+@@ -1886,6 +1891,17 @@
+ 			    " corefiles is %s.\n"), value);
+ }
+ 
++/* Display whether the gcore command is dumping mappings marked with
++   the VM_DONTDUMP flag.  */
++
++static void
++show_dump_excluded_mappings (struct ui_file *file, int from_tty,
++			     struct cmd_list_element *c, const char *value)
++{
++  fprintf_filtered (file, _("Dumping of mappings marked with the VM_DONTDUMP"
++			    " flag is %s.\n"), value);
++}
++
+ /* To be called from the various GDB_OSABI_LINUX handlers for the
+    various GNU/Linux architectures and machine types.  */
+ 
+@@ -1921,4 +1937,16 @@
+ about this file, refer to the manpage of core(5)."),
+ 			   NULL, show_use_coredump_filter,
+ 			   &setlist, &showlist);
++
++  add_setshow_boolean_cmd ("dump-excluded-mappings", class_files,
++			   &dump_excluded_mappings, _("\
++Set whether gcore should dump mappings marked with the VM_DONTDUMP flag."),
++			   _("\
++Show whether gcore should dump mappings marked with the VM_DONTDUMP flag."),
++			   _("\
++Use this command to set whether gcore should dump mappings marked with the\n\
++VM_DONTDUMP flag (\"dd\" in /proc/PID/smaps) when generating the corefile.  For\n\
++more information about this file, refer to the manpage of proc(5) and core(5)."),
++			   NULL, show_dump_excluded_mappings,
++			   &setlist, &showlist);
+ }
diff --git a/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-2of5.patch b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-2of5.patch
new file mode 100644
index 0000000..f0bba13
--- /dev/null
+++ b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-2of5.patch
@@ -0,0 +1,67 @@
+commit 1e52e8495a074c9d1f7ef17f13b9060b76be6f41
+Author: Sergio Lopez <slp@redhat.com>
+Date:   Mon Dec 4 09:17:13 2017 +0100
+
+    Document new {set,show} dump-excluded-mappings commands.
+    
+    gdb/ChangeLog:
+    2017-11-29  Sergio Lopez  <slp@redhat.com>
+    
+            * NEWS (Changes since GDB 8.0): Announce {set,show}
+            dump_excluded_mappings commands.
+    
+    gdb/doc/ChangeLog:
+    2017-11-29  Sergio Lopez  <slp@redhat.com>
+    
+            * gdb.texinfo (gcore): Mention new {set,show}
+            dump-excluded-mappings commands.
+            (set dump-excluded-mappings): Document new command.
+
+Index: gdb-7.6.1/gdb/NEWS
+===================================================================
+--- gdb-7.6.1.orig/gdb/NEWS	2017-12-06 20:56:34.005080504 +0100
++++ gdb-7.6.1/gdb/NEWS	2017-12-06 20:56:52.510200234 +0100
+@@ -7,6 +7,11 @@
+   Add entries to the list of directories from which to load auto-loaded
+   scripts.
+ 
++set dump-excluded-mappings
++show dump-excluded-mappings
++  Control whether mappings marked with the VM_DONTDUMP flag should be
++  dumped when generating a core file.
++
+ * Newly installed $prefix/bin/gcore acts as a shell interface for the
+   GDB command gcore.
+ 
+Index: gdb-7.6.1/gdb/doc/gdb.texinfo
+===================================================================
+--- gdb-7.6.1.orig/gdb/doc/gdb.texinfo	2017-12-06 20:56:30.604058498 +0100
++++ gdb-7.6.1/gdb/doc/gdb.texinfo	2017-12-06 20:56:34.015080568 +0100
+@@ -10318,7 +10318,9 @@
+ 
+ On @sc{gnu}/Linux, this command can take into account the value of the
+ file @file{/proc/@var{pid}/coredump_filter} when generating the core
+-dump (@pxref{set use-coredump-filter}).
++dump (@pxref{set use-coredump-filter}), and by default honors the
++@code{VM_DONTDUMP} flag for mappings where it is present in the file
++@file{/proc/@var{pid}/smaps} (@pxref{set dump-excluded-mappings}).
+ 
+ @kindex set use-coredump-filter
+ @anchor{set use-coredump-filter}
+@@ -10348,6 +10350,16 @@
+ (anonymous private mappings), @code{1} (anonymous shared mappings),
+ @code{4} (ELF headers) and @code{5} (private huge pages) are active.
+ This will cause these memory mappings to be dumped automatically.
++
++@kindex set dump-excluded-mappings
++@anchor{set dump-excluded-mappings}
++@item set dump-excluded-mappings on
++@itemx set dump-excluded-mappings off
++If @code{on} is specified, @value{GDBN} will dump memory mappings
++marked with the @code{VM_DONTDUMP} flag.  This flag is represented in
++the file @file{/proc/@var{pid}/smaps} with the acronym @code{dd}.
++
++The default value is @code{off}.
+ @end table
+ 
+ @node Character Sets
diff --git a/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-3of5.patch b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-3of5.patch
new file mode 100644
index 0000000..64e1bcb
--- /dev/null
+++ b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-3of5.patch
@@ -0,0 +1,88 @@
+commit cd93789b89f55355d3eeda6c31ed7bd0ed318acd
+Author: Sergio Lopez <slp@redhat.com>
+Date:   Mon Dec 4 09:17:14 2017 +0100
+
+    Implement "-a" command line option for gcore
+    
+    With the new "-a" command line option, the user may request gcore to
+    actually dump all present memory mappings. The actual effect of this
+    argument is OS dependent.
+    
+    On GNU/Linux, it will disable use-coredump-filter and enable
+    dump-excluded-mappings.
+    
+    gdb/ChangeLog:
+    2017-11-29  Sergio Lopez  <slp@redhat.com>
+    
+            * gcore.in: Add "-a" command line option for instructing gdb to
+            dump all memory mappings (OS dependent).
+
+Index: gdb-7.6.1/gdb/gcore.in
+===================================================================
+--- gdb-7.6.1.orig/gdb/gcore.in	2017-12-06 20:57:13.444335680 +0100
++++ gdb-7.6.1/gdb/gcore.in	2017-12-06 20:57:20.437380926 +0100
+@@ -20,27 +20,39 @@
+ # It starts up gdb, attaches to the given PID and invokes the gcore command.
+ #
+ 
+-if [ "$#" -eq "0" ]
+-then
+-    echo "usage:  @GCORE_TRANSFORM_NAME@ [-o filename] pid"
+-    exit 2
+-fi
+-
+ # Need to check for -o option, but set default basename to "core".
+ name=core
+ 
+-if [ "$1" = "-o" ]
+-then
+-    if [ "$#" -lt "3" ]
+-    then
+-	# Not enough arguments.
+-	echo "usage:  @GCORE_TRANSFORM_NAME@ [-o filename] pid"
+-	exit 2
+-    fi
+-    name=$2
++# When the -a option is present, this may hold additional commands
++# to ensure gdb dumps all mappings (OS dependent).
++dump_all_cmds=()
++
++while getopts :ao: opt; do
++    case $opt in
++        a)
++            case $OSTYPE in
++                linux*)
++                    dump_all_cmds=("-ex" "set use-coredump-filter off")
++                    dump_all_cmds+=("-ex" "set dump-excluded-mappings on")
++                    ;;
++            esac
++            ;;
++        o)
++            name=$OPTARG
++            ;;
++        *)
++            echo "usage:  @GCORE_TRANSFORM_NAME@ [-a] [-o filename] pid"
++            exit 2
++            ;;
++    esac
++done
++
++shift $((OPTIND-1))
+ 
+-    # Shift over to start of pid list
+-    shift; shift
++if [ "$#" -eq "0" ]
++then
++    echo "usage:  @GCORE_TRANSFORM_NAME@ [-a] [-o filename] pid"
++    exit 2
+ fi
+ 
+ # Initialise return code.
+@@ -53,6 +65,7 @@
+ 	# available but not accessible as GDB would get stopped on SIGTTIN.
+ 	@GDB_TRANSFORM_NAME@ </dev/null --nx --batch \
+ 	    -ex "set pagination off" -ex "set height 0" -ex "set width 0" \
++	    "${dump_all_cmds[@]}" \
+ 	    -ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
+ 
+ 	if [ -r $name.$pid ] ; then 
diff --git a/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-4of5.patch b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-4of5.patch
new file mode 100644
index 0000000..d6ae97e
--- /dev/null
+++ b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-4of5.patch
@@ -0,0 +1,60 @@
+commit c179febe79bf2fe2f64852c827813fc46da819f5
+Author: Sergio Lopez <slp@redhat.com>
+Date:   Mon Dec 4 09:17:15 2017 +0100
+
+    Document the new "-a" command line option for gcore
+    
+    gdb/ChangeLog:
+    2017-11-29  Sergio Lopez  <slp@redhat.com>
+    
+            * NEWS (Changes since GDB 8.0): Announce new "-a"
+            command line option for gcore.
+    
+    gdb/doc/ChangeLog:
+    2017-11-29  Sergio Lopez  <slp@redhat.com>
+    
+            * gdb.texinfo (gcore man): Document new "-a" command line option.
+
+Index: gdb-7.6.1/gdb/NEWS
+===================================================================
+--- gdb-7.6.1.orig/gdb/NEWS	2017-12-06 20:58:33.885856147 +0100
++++ gdb-7.6.1/gdb/NEWS	2017-12-06 20:59:03.174045646 +0100
+@@ -12,6 +12,11 @@
+   Control whether mappings marked with the VM_DONTDUMP flag should be
+   dumped when generating a core file.
+ 
++* New command line options (gcore)
++
++-a
++  Dump all memory mappings.
++
+ * Newly installed $prefix/bin/gcore acts as a shell interface for the
+   GDB command gcore.
+ 
+Index: gdb-7.6.1/gdb/doc/gdb.texinfo
+===================================================================
+--- gdb-7.6.1.orig/gdb/doc/gdb.texinfo	2017-12-06 20:58:22.471782297 +0100
++++ gdb-7.6.1/gdb/doc/gdb.texinfo	2017-12-06 20:58:33.891856186 +0100
+@@ -43242,7 +43242,7 @@
+ 
+ @format
+ @c man begin SYNOPSIS gcore
+-gcore [-o @var{filename}] @var{pid}
++gcore [-a] [-o @var{filename}] @var{pid}
+ @c man end
+ @end format
+ 
+@@ -43256,6 +43256,13 @@
+ 
+ @c man begin OPTIONS gcore
+ @table @env
++@item -a
++Dump all memory mappings.  The actual effect of this option depends on
++the Operating System.  On @sc{gnu}/Linux, it will disable
++@code{use-coredump-filter} (@pxref{set use-coredump-filter}) and
++enable @code{dump-excluded-mappings} (@pxref{set
++dump-excluded-mappings}).
++
+ @item -o @var{filename}
+ The optional argument
+ @var{filename} specifies the file name where to put the core dump.
diff --git a/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-5of5.patch b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-5of5.patch
new file mode 100644
index 0000000..ff71ea4
--- /dev/null
+++ b/SOURCES/gdb-rhbz1518243-gcore-VM_DONTDUMP-5of5.patch
@@ -0,0 +1,127 @@
+commit 3e1a70a0189ae8d2dacfef93790e42e42e721762
+Author: Sergio Lopez <slp@redhat.com>
+Date:   Mon Dec 4 09:17:16 2017 +0100
+
+    Extend gdb.core/coredump-filter.exp to test dump-excluded-mappings.
+    
+    gdb/testsuite/ChangeLog:
+    2017-11-30  Sergio Lopez  <slp@redhat.com>
+    
+            * gdb.core/coredump-filter.exp: Extend test to verify
+            the functionality of the dump-excluded-mappings command.
+
+Index: gdb-7.6.1/gdb/testsuite/gdb.base/coredump-filter.exp
+===================================================================
+--- gdb-7.6.1.orig/gdb/testsuite/gdb.base/coredump-filter.exp	2017-12-06 20:59:21.016161086 +0100
++++ gdb-7.6.1/gdb/testsuite/gdb.base/coredump-filter.exp	2017-12-06 21:03:20.445710226 +0100
+@@ -95,16 +95,26 @@
+     return -1
+ }
+ 
+-proc do_save_core { filter_flag core ipid } {
++proc do_save_core { filter_flag core ipid dump_excluded } {
+     verbose -log "writing $filter_flag to /proc/$ipid/coredump_filter"
+ 
+     remote_exec target "sh -c \"echo $filter_flag > /proc/$ipid/coredump_filter\""
+ 
++    # Enable dumping of excluded mappings (i.e. VM_DONTDUMP).
++    if { $dump_excluded == 1 } {
++        gdb_test_no_output "set dump-excluded-mappings on"
++    }
++
+     # Generate a corefile.
+     gdb_gcore_cmd "$core" "save corefile"
++
++    # Restore original status.
++    if { $dump_excluded == 1 } {
++        gdb_test_no_output "set dump-excluded-mappings off"
++    }
+ }
+ 
+-proc do_load_and_test_core { core var working_var working_value } {
++proc do_load_and_test_core { core var working_var working_value dump_excluded } {
+     global hex decimal addr
+ 
+     set core_loaded [gdb_core_cmd "$core" "load core"]
+@@ -114,10 +124,16 @@
+     }
+ 
+     # Access the memory the addresses point to.
+-    gdb_test "print/x *(char *) $addr($var)" "\(\\\$$decimal = <error: \)?Cannot access memory at address $hex\(>\)?" \
+-	"printing $var when core is loaded (should not work)"
+-    gdb_test "print/x *(char *) $addr($working_var)" " = $working_value.*" \
+-	"print/x *$working_var ( = $working_value)"
++    if { $dump_excluded == 0 } {
++	gdb_test "print/x *(char *) $addr($var)" "\(\\\$$decimal = <error: \)?Cannot access memory at address $hex\(>\)?" \
++	    "printing $var when core is loaded (should not work)"
++	gdb_test "print/x *(char *) $addr($working_var)" " = $working_value.*" \
++	    "print/x *$working_var ( = $working_value)"
++    } else {
++        # Check if VM_DONTDUMP mappings are present in the core file.
++        gdb_test "print/x *(char *) $addr($var)" " = $working_value.*" \
++	    "print/x *$var ( = $working_value)"
++    }
+ }
+ 
+ # We do not do file-backed mappings in the test program, but it is
+@@ -169,6 +185,7 @@
+ # A corefile without {private,shared} {anonymous,file-backed} pages
+ set non_private_shared_anon_file_core [standard_output_file non-private-shared-anon-file.gcore]
+ set dont_dump_core [standard_output_file dont-dump.gcore]
++set dump_excluded_core [standard_output_file dump-excluded.gcore]
+ 
+ # We will generate a few corefiles.
+ #
+@@ -184,6 +201,8 @@
+ # - name of a variable in the C source code that points to a memory
+ #   mapping that WILL be present in the corefile
+ # - corresponding value expected for the above variable
++# - whether to include mappings marked as VM_DONTDUMP in the
++#   corefile (1) or not (0).
+ #
+ # This list refers to the corefiles generated by MAP_ANONYMOUS in the
+ # test program.
+@@ -191,13 +210,16 @@
+ set all_anon_corefiles { { "non-Private-Anonymous" "0x7e" \
+ 			       $non_private_anon_core \
+ 			       "private_anon" \
+-			       "shared_anon" "0x22" }
++			       "shared_anon" "0x22" "0" }
+     { "non-Shared-Anonymous" "0x7d" \
+ 	  $non_shared_anon_core "shared_anon" \
+-	  "private_anon" "0x11" }
++	  "private_anon" "0x11" "0" }
+     { "DoNotDump" "0x33" \
+ 	  $dont_dump_core "dont_dump" \
+-	  "shared_anon" "0x22" } }
++	  "shared_anon" "0x22" "0" }
++    { "DoNotDump-DumpExcluded" "0x33" \
++	  $dump_excluded_core "dont_dump" \
++	  "shared_anon" "0x55" "1" } }
+ 
+ # If corefile loading is not supported, we do not even try to run the
+ # tests.
+@@ -239,12 +261,12 @@
+ # Generate corefiles for the "anon" case.
+ foreach item $all_anon_corefiles {
+     with_test_prefix "saving corefile for [lindex $item 0]" {
+-	do_save_core [lindex $item 1] [subst [lindex $item 2]] $infpid
++	do_save_core [lindex $item 1] [subst [lindex $item 2]] $infpid [lindex $item 6]
+     }
+ }
+ 
+ with_test_prefix "saving corefile for non-Private-Shared-Anon-File" {
+-    do_save_core "0x60" $non_private_shared_anon_file_core $infpid
++    do_save_core "0x60" $non_private_shared_anon_file_core $infpid "0"
+ }
+ 
+ clean_restart $testfile
+@@ -252,7 +274,7 @@
+ foreach item $all_anon_corefiles {
+     with_test_prefix "loading and testing corefile for [lindex $item 0]" {
+ 	do_load_and_test_core [subst [lindex $item 2]] [lindex $item 3] \
+-	    [lindex $item 4] [lindex $item 5]
++	    [lindex $item 4] [lindex $item 5] [lindex $item 6]
+     }
+ 
+     with_test_prefix "disassembling function main for [lindex $item 0]" {
diff --git a/SPECS/gdb.spec b/SPECS/gdb.spec
index 9d4e98e..d4b3830 100644
--- a/SPECS/gdb.spec
+++ b/SPECS/gdb.spec
@@ -42,7 +42,7 @@ Version: 7.6.1
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 100%{?dist}
+Release: 100%{?dist}.1
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
 Group: Development/Debuggers
@@ -888,6 +888,13 @@ Patch1207: gdb-rhbz1320945-power9-36of38.patch
 Patch1208: gdb-rhbz1320945-power9-37of38.patch
 Patch1209: gdb-rhbz1320945-power9-38of38.patch
 
+# Fix gcore for memory regions with VM_DONTDUMP (RH BZ 1524312, Sergio Lopez).
+Patch1264: gdb-rhbz1518243-gcore-VM_DONTDUMP-1of5.patch
+Patch1265: gdb-rhbz1518243-gcore-VM_DONTDUMP-2of5.patch
+Patch1266: gdb-rhbz1518243-gcore-VM_DONTDUMP-3of5.patch
+Patch1267: gdb-rhbz1518243-gcore-VM_DONTDUMP-4of5.patch
+Patch1268: gdb-rhbz1518243-gcore-VM_DONTDUMP-5of5.patch
+
 %if 0%{!?rhel:1} || 0%{?rhel} > 6
 # RL_STATE_FEDORA_GDB would not be found for:
 # Patch642: gdb-readline62-ask-more-rh.patch
@@ -1414,6 +1421,11 @@ find -name "*.info*"|xargs rm -f
 %patch1207 -p1
 %patch1208 -p1
 %patch1209 -p1
+%patch1264 -p1
+%patch1265 -p1
+%patch1266 -p1
+%patch1267 -p1
+%patch1268 -p1
 
 %if 0%{?scl:1}
 %patch836 -p1 -R
@@ -1939,6 +1951,9 @@ fi
 %endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
 
 %changelog
+* Mon Dec 11 2017 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.6.1-100.el7_4.1
+- Fix gcore for memory regions with VM_DONTDUMP (RH BZ 1524312, Sergio Lopez).
+
 * Tue Jun 13 2017 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.6.1-100.el7
 - [ppc*] IBM Power9 backport extension (RH BZ 1320945).