[linux] 03/03: bug script: Optionally use sudo to read a restricted kernel log

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Fri Oct 7 02:13:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository linux.

commit 8645d4069f4b60ff5d1818428860a7e37b8a51b0
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Fri Oct 7 03:00:03 2016 +0100

    bug script: Optionally use sudo to read a restricted kernel log
    
    If kernel.dmesg_restrict is enabled (which it now will be by default)
    and sudo is installed, ask whether to use sudo.  If this is denied or
    fails then fall back to writing a placeholder in the bug report.
---
 debian/changelog                         |  2 ++
 debian/templates/image.bug/include-dmesg | 11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 8e70b47..3bb3b6a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,8 @@ linux (4.8-1~exp1) UNRELEASED; urgency=medium
   * Compile with gcc-6 on all architectures
   * security,printk: Enable SECURITY_DMESG_RESTRICT, preventing non-root users
     reading the kernel log by default (sysctl: kernel.dmesg_restrict)
+  * bug script: Optionally use sudo to read a restricted kernel log, and fall
+    back to writing a placeholder
 
  -- Ben Hutchings <ben at decadent.org.uk>  Sat, 01 Oct 2016 21:51:33 +0100
 
diff --git a/debian/templates/image.bug/include-dmesg b/debian/templates/image.bug/include-dmesg
index a7f4f41..634dc99 100644
--- a/debian/templates/image.bug/include-dmesg
+++ b/debian/templates/image.bug/include-dmesg
@@ -1,6 +1,15 @@
 add_dmesg() {
+  local got_log=
   echo '** Kernel log:' >&3
-  dmesg | tail -n 100 >&3
+  if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then
+    dmesg > >(tail -n 100 >&3) && got_log=y
+  elif command -v sudo >/dev/null; then
+    yesno "Use sudo to read the kernel log? " yep
+    if [ "$REPLY" = yep ]; then
+      sudo dmesg > >(tail -n 100 >&3) && got_log=y
+    fi
+  fi
+  test "$got_log" || echo 'Unable to read kernel log; any relevant messages should be attached' >&3
   echo >&3
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list