lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Tue, 11 Dec 2018 01:54:45 +0000
From:   "Liu, Chuansheng" <chuansheng.liu@...el.com>
To:     "'akpm@...ux-foundation.org'" <akpm@...ux-foundation.org>,
        "'sergey.senozhatsky@...il.com'" <sergey.senozhatsky@...il.com>,
        "'dvyukov@...gle.com'" <dvyukov@...gle.com>,
        "'penguin-kernel@...ove.SAKURA.ne.jp'" 
        <penguin-kernel@...ove.SAKURA.ne.jp>
CC:     "'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
        "Liu, Chuansheng" <chuansheng.liu@...el.com>
Subject: [PATCH V1] kernel/hung_task.c: Force console verbose before panic

Based on patch commit 401c636a0eeb ("kernel/hung_task.c:
show all hung tasks before panic"), we could get the
call stack of hung task.

However, if the console loglevel is not high, we still
can not see the useful panic information in practice,
and in most cases users don't set console loglevel to
high level.

This patch is to force console verbose before system
panic, so that the real useful information can be seen
in the console, instead of being like the following,
which doesn't have hung task information.

[  246.916600] INFO: task init:1 blocked for more than 120 seconds.
[  246.922320]       Tainted: G     U  W         4.19.0-quilt-2e5dc0ac-g51b6c21d76cc #1
[  246.926790] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  246.932553] Kernel panic - not syncing: hung_task: blocked tasks
[  246.938503] CPU: 2 PID: 479 Comm: khungtaskd Tainted: G     U  W         4.19.0-quilt-2e5dc0ac-g51b6c21d76cc #1
[  246.990266] Call Trace:
[  246.991707]  dump_stack+0x4f/0x65
[  246.993710]  panic+0xde/0x231
[  246.995445]  watchdog+0x290/0x410
[  246.997390]  kthread+0x12c/0x150
[  246.999301]  ? reset_hung_task_detector+0x20/0x20
[  247.004825]  ? kthread_create_worker_on_cpu+0x70/0x70
[  247.007735]  ret_from_fork+0x35/0x40
[  247.010280] reboot: panic mode set: p,w
[  247.012619] Kernel Offset: 0x34000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)

V1: console_verbose() is used instead of ignore_loglevel,
    suggested by Sergey.
    Tweak the function check_hung_task() suggested by
    Tetsuo to make code more readable.

Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Signed-off-by: Chuansheng Liu <chuansheng.liu@...el.com>
---
 kernel/hung_task.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index cb8e3e8..8db421f 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -112,14 +112,16 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)

        trace_sched_process_hang(t);

-       if (!sysctl_hung_task_warnings && !sysctl_hung_task_panic)
-               return;
-
        /*
         * Ok, the task did not get scheduled for more than 2 minutes,
         * complain:
         */
-       if (sysctl_hung_task_warnings) {
+       if (sysctl_hung_task_panic || sysctl_hung_task_warnings) {
+               if (sysctl_hung_task_panic) {
+                       console_verbose();
+                       hung_task_call_panic = true;
+               }
+
                if (sysctl_hung_task_warnings > 0)
                        sysctl_hung_task_warnings--;
                pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
@@ -132,13 +134,8 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
                        " disables this message.\n");
                sched_show_task(t);
                hung_task_show_lock = true;
-       }
-
-       touch_nmi_watchdog();

-       if (sysctl_hung_task_panic) {
-               hung_task_show_lock = true;
-               hung_task_call_panic = true;
+               touch_nmi_watchdog();
        }
 }

--
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ