Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package gdb for openSUSE:Factory checked in 
at 2026-04-26 21:10:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/gdb (Old)
 and      /work/SRC/openSUSE:Factory/.gdb.new.11940 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "gdb"

Sun Apr 26 21:10:48 2026 rev:193 rq:1348954 version:16.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/gdb/gdb.changes  2026-03-19 17:33:07.027216834 
+0100
+++ /work/SRC/openSUSE:Factory/.gdb.new.11940/gdb.changes       2026-04-26 
21:11:39.846279810 +0200
@@ -1,0 +2,16 @@
+Tue Apr 21 08:49:04 UTC 2026 - Tom de Vries <[email protected]>
+
+- Reduce scope of debuginfo query workaround.  No longer require
+  "set debuginfod enabled off" in .gdbearlyinit or similar to be
+  able to use "gdb -tui" (osc#1261254).  Patches added:
+  * gdb-tui-v3-fix-crash-with-debuginfod-query.patch
+  * gdb-tui-reduce-scope-of-debuginfod-query-crash-worka.patch
+
+-------------------------------------------------------------------
+Fri Apr 17 03:52:35 UTC 2026 - Tom de Vries <[email protected]>
+
+- Report helpful error on ptrace permission denied due to
+  yama/selinux (jsc#PED-15928).  Patches added:
+  * gdb-linux-consider-ptrace_scope-when-building-attach.patch
+
+-------------------------------------------------------------------

New:
----
  gdb-linux-consider-ptrace_scope-when-building-attach.patch
  gdb-tui-reduce-scope-of-debuginfod-query-crash-worka.patch
  gdb-tui-v3-fix-crash-with-debuginfod-query.patch

----------(New B)----------
  New:  yama/selinux (jsc#PED-15928).  Patches added:
  * gdb-linux-consider-ptrace_scope-when-building-attach.patch
  New:  * gdb-tui-v3-fix-crash-with-debuginfod-query.patch
  * gdb-tui-reduce-scope-of-debuginfod-query-crash-worka.patch
  New:  able to use "gdb -tui" (osc#1261254).  Patches added:
  * gdb-tui-v3-fix-crash-with-debuginfod-query.patch
  * gdb-tui-reduce-scope-of-debuginfod-query-crash-worka.patch
----------(New E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ gdb.spec ++++++
--- /var/tmp/diff_new_pack.SVgfMO/_old  2026-04-26 21:11:42.922405580 +0200
+++ /var/tmp/diff_new_pack.SVgfMO/_new  2026-04-26 21:11:42.926405744 +0200
@@ -302,6 +302,7 @@
 Patch2527:      gcore-query-auxv-for-at_pagesz-in-gcore_copy_callbac.patch
 Patch2528:      gdb-testsuite-fix-printf-regexp-for-ppc64le-with-gli.patch
 Patch2529:      add-proc-subst_vars.patch
+Patch2530:      gdb-linux-consider-ptrace_scope-when-building-attach.patch
 
 # Backport from gdb-patches
 
@@ -349,6 +350,9 @@
 Patch3026:      gdb-minor-refactoring-of-is_dynamic_type_internal.patch
 Patch3027:      gdb-factor-out-is_dynamic_type_internal_1.patch
 Patch3028:      gdb-enable-ptype-o-for-some-dynamic-types.patch
+# https://sourceware.org/pipermail/gdb-patches/2026-April/226551.html
+Patch3029:      gdb-tui-v3-fix-crash-with-debuginfod-query.patch
+Patch3030:      gdb-tui-reduce-scope-of-debuginfod-query-crash-worka.patch
 
 # Debug patches.
 
@@ -777,6 +781,7 @@
 %patch -P 2527 -p1
 %patch -P 2528 -p1
 %patch -P 2529 -p1
+%patch -P 2530 -p1
 
 %patch -P 3000 -p1
 %patch -P 3001 -p1
@@ -800,6 +805,8 @@
 %patch -P 3026 -p1
 %patch -P 3027 -p1
 %patch -P 3028 -p1
+%patch -P 3029 -p1
+%patch -P 3030 -p1
 
 %patch -P 3500 -p1
 

++++++ _scmsync.obsinfo ++++++
--- /var/tmp/diff_new_pack.SVgfMO/_old  2026-04-26 21:11:43.050410814 +0200
+++ /var/tmp/diff_new_pack.SVgfMO/_new  2026-04-26 21:11:43.066411468 +0200
@@ -1,5 +1,5 @@
-mtime: 1773764094
-commit: 26c27d968dfee4bed785b62e9d15b787d7c1faa448861a7fdc4c38dcf5d3fd44
+mtime: 1776761634
+commit: fff81d881d3299c67bb5b55fe05ae5ed199b80bf1ddac5cd1487fda193aec740
 url: https://src.opensuse.org/gcc/gdb.git
 revision: main
 

++++++ build.specials.obscpio ++++++

++++++ build.specials.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore      1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore      2026-04-22 18:18:14.000000000 +0200
@@ -0,0 +1 @@
+.osc

++++++ gdb-linux-consider-ptrace_scope-when-building-attach.patch ++++++
>From 8ccd5d75d4241e795624dde7622be0d0aa0b4845 Mon Sep 17 00:00:00 2001
From: Andrew Burgess <[email protected]>
Date: Wed, 10 Sep 2025 14:54:21 +0100
Subject: [PATCH] gdb/linux: consider ptrace_scope when building attach error
 message

On GNU/Linux, if an attach fails, then we end up calling
linux_ptrace_attach_fail_reason, which returns a string describing why
the attach might have failed.

This commit extends linux_ptrace_attach_fail_reason to check the
current /proc/sys/kernel/yama/ptrace_scope setting.  When this is set
to a value greater than 0 attaching can be restricted in some cases.

If I first set ptrace_scope to 1, like this:

  $ echo 1 | sudo tee /proc/sys/kernel/yama/ptrace_scope

Then use current master GDB to attach to a process, I see this:

  (gdb) attach 2476518
  Attaching to process 2476518
  ptrace: Operation not permitted.
  (gdb)

With this patch applied the output becomes:

  (gdb) attach 2476518
  Attaching to process 2476518
  warning: the /proc/sys/kernel/yama/ptrace_scope setting of 1 might prevent 
attaching, see 'man 2 ptrace'
  ptrace: Operation not permitted.
  (gdb)

In my (limited) experience, not every user is familiar with the
ptrace_scope setting.  Finding that attach just doesn't work often
leads users to believe that the only way to have GDB attach to another
process is to run GDB as root.

Though that is a solution to the problem, my hope is that, by giving
the users more information, they can make a more informed choice about
which solution is right for them (e.g. run as root, change the
setting, start the inferior directly under GDB, etc).

This change also works for gdbserver.  For example:

  (gdb) target extended-remote :54321
  Remote debugging using :54321
  (gdb) attach 2475389
  Attaching to process 2475389
  Attaching to process 2475389 failed: Cannot attach to process 2475389: \
     Operation not permitted (1), the /proc/sys/kernel/yama/ptrace_scope \
     setting of 1 might prevent attaching, see 'man 2 ptrace'
  (gdb)

There's no test for this as testing would require adjusting a system
wide setting.

I've linked to a semi-related bug.  It is discussing the same issue at
least.  This patch doesn't try to "fix" anything that the bug is
talking about, it just makes it (I think) slightly clearer when the
issue does arise.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31520

Approved-By: Pedro Alves <[email protected]>
Reviewed-By: Guinevere Larsen <[email protected]>
---
 gdb/nat/linux-ptrace.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index f90183b63ec..1f72936992e 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -23,12 +23,46 @@
 #include <sys/procfs.h>
 #endif
 #include "gdbsupport/eintr.h"
+#include "gdbsupport/gdb_file.h"
 
 /* Stores the ptrace options supported by the running kernel.
    A value of -1 means we did not check for features yet.  A value
    of 0 means there are no supported features.  */
 static int supported_ptrace_options = -1;
 
+/* The file from which the kernel.yama.ptrace_scope setting is read.  */
+
+static constexpr char ptrace_scope_filename[]
+  = "/proc/sys/kernel/yama/ptrace_scope";
+
+/* Reads the yama ptrace_scope value from /proc.  Returns the integer value
+   of ptrace_scope (0, 1, 2, or 3) or -1 if the file cannot be read (e.g.,
+   yama is not enabled).  */
+
+static int
+get_ptrace_scope ()
+{
+  int ptrace_scope = -1;
+
+  /* The /proc file that contains the system-wide ptrace scope setting.  */
+  gdb_file_up fp (fopen (ptrace_scope_filename, "r"));
+  if (fp != nullptr)
+    {
+      if (fscanf (fp.get (), "%d", &ptrace_scope) != 1)
+       {
+         /* If fscanf fails then we couldn't parse the number.  But just
+            to be safe, set the scope back to -1 to indicate no value is
+            available.  */
+         ptrace_scope = -1;
+       }
+    }
+
+  /* If fp is NULL, it's likely because the yama security module is not
+     active.  In this case, we return -1 to indicate that the scope is
+     unknown or not applicable.  */
+  return ptrace_scope;
+}
+
 /* Find all possible reasons we could fail to attach PID and return these
    as a string.  An empty string is returned if we didn't find any reason.  */
 
@@ -43,6 +77,13 @@ linux_ptrace_attach_fail_reason (pid_t pid)
                    _("process %d is already traced by process %d"),
                    (int) pid, (int) tracerpid);
 
+  int ptrace_scope = get_ptrace_scope ();
+  if (ptrace_scope > 0)
+    string_appendf (result,
+                   _("the %s setting of %d might prevent attaching, "
+                     "see 'man 2 ptrace'"),
+                   ptrace_scope_filename, ptrace_scope);
+
   if (linux_proc_pid_is_zombie_nowarn (pid))
     string_appendf (result,
                    _("process %d is a zombie - the process has already "

base-commit: 56eebf7c018ddbb104cb59c53f1fa0aa34861981
-- 
2.51.0


++++++ gdb-tui-reduce-scope-of-debuginfod-query-crash-worka.patch ++++++
>From 56eebf7c018ddbb104cb59c53f1fa0aa34861981 Mon Sep 17 00:00:00 2001
From: Tom de Vries <[email protected]>
Date: Wed, 1 Apr 2026 15:48:48 +0200
Subject: [PATCH 2/2] [gdb/tui] Reduce scope of debuginfod query crash
 workaround

---
 gdb/testsuite/gdb.tui/query.exp | 12 +++++++++---
 gdb/tui/tui.c                   |  7 ++++---
 gdb/tui/tui.h                   |  2 +-
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.tui/query.exp b/gdb/testsuite/gdb.tui/query.exp
index bc1a55a1b96..eb0bee49aec 100644
--- a/gdb/testsuite/gdb.tui/query.exp
+++ b/gdb/testsuite/gdb.tui/query.exp
@@ -65,12 +65,18 @@ foreach_with_prefix how $l {
 
     if { $how == "command" } {
        send_gdb "tui enable\n"
+       set re \
+           [string_to_regexp \
+                {(y or [n]) }]
+       gdb_assert { [Term::wait_for_region_contents 0 0 80 24 $re] }
+       send_gdb "n\n"
+       Term::wait_for ""
     } else {
        send_gdb "\030\001"
+       set re \
+           "Please set debuginfod enabled to on or off before enabling TUI"
+       gdb_assert { [Term::wait_for_region_contents 0 0 80 24 $re] }
     }
-    set re \
-       "Please set debuginfod enabled to on or off before enabling TUI"
-    gdb_assert { [Term::wait_for_region_contents 0 0 80 24 $re] }
 
     # Check that prompt is responsive.
     gdb_assert { [Term::command "print 1"] } "responsive prompt"
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 5dabb9967ae..ff1610225ec 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -128,7 +128,7 @@ tui_rl_switch_mode (int notused1, int notused2)
        {
          /* If tui_enable throws, we'll re-prep below.  */
          rl_deprep_terminal ();
-         tui_enable ();
+         tui_enable (false);
        }
     }
   catch (const gdb_exception_forced_quit &ex)
@@ -386,14 +386,15 @@ gdb_getenv_term (void)
    the gdb output, configures the readline to work in tui mode.
    When in curses mode, it does nothing.  */
 void
-tui_enable (void)
+tui_enable (bool queries_allowed)
 {
   TUI_SCOPED_DEBUG_ENTER_EXIT;
 
   if (tui_active)
     return;
 
-  if (debuginfod_enabled_ask_p ()
+  if (!queries_allowed
+      && debuginfod_enabled_ask_p ()
       && defaulted_query_auto_answers_p () != TRIBOOL_TRUE)
     error (_("Please set debuginfod enabled to on or off before enabling 
TUI"));
 
diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h
index 319bd2e5b4d..a6f8b0ae2aa 100644
--- a/gdb/tui/tui.h
+++ b/gdb/tui/tui.h
@@ -70,7 +70,7 @@ extern bool tui_get_command_dimension (unsigned int *width,
 extern void tui_ensure_readline_initialized ();
 
 /* Enter in the tui mode (curses).  */
-extern void tui_enable (void);
+extern void tui_enable (bool queries_allowed = true);
 
 /* Leave the tui mode.  */
 extern void tui_disable (void);
-- 
2.51.0


++++++ gdb-tui-v3-fix-crash-with-debuginfod-query.patch ++++++
>From 99ec40248a5ffc3a27b1a552ac2fba23ec05c53f Mon Sep 17 00:00:00 2001
From: Tom de Vries <[email protected]>
Date: Wed, 1 Apr 2026 15:47:50 +0200
Subject: [PATCH 1/2] [gdb/tui, v3] Fix crash with debuginfod query

https://sourceware.org/pipermail/gdb-patches/2026-February/225210.html
---
 gdb/tui/tui-io.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index e64f0ddce78..9abedf1a32f 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -1034,6 +1034,9 @@ void
 tui_inject_newline_into_command_window ()
 {
   gdb_assert (tui_active);
+  if (tui_cmd_win () == nullptr || tui_cmd_win ()->width == 0
+      || tui_cmd_win ()->height == 0)
+    return;
 
   WINDOW *w = tui_cmd_win ()->handle.get ();
 

base-commit: 7cf30f7f6a6358bc16d04b40524106dd6a7480e6
-- 
2.51.0

Reply via email to