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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231023135736.17891-1-liliangliang@vivo.com>
Date:   Mon, 23 Oct 2023 21:57:35 +0800
From:   Liangliang Li <liliangliang@...o.com>
To:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        linux-kernel@...r.kernel.org
Cc:     opensource.kernel@...o.com, Liangliang Li <liliangliang@...o.com>
Subject: [PATCH] freezer,sched: Report TASK_FROZEN tasks as TASK_UNINTERRUPTIBLE

TASK_FROZEN is not in TASK_REPORT, thus a frozen task will appear as
state == 0, IOW TASK_RUNNING.

Fix this by make TASK_FROZEN appear as TASK_UNINTERRUPTIBLE, thus we
dont need to imply a new state to userspace tools.

Signed-off-by: Liangliang Li <liliangliang@...o.com>
---
 include/linux/sched.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 292c31697248..0cfe2ba4fc6f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1690,6 +1690,10 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
 	if (tsk_state & TASK_RTLOCK_WAIT)
 		state = TASK_UNINTERRUPTIBLE;
 
+	/* Frozen tasks should appear as "D (disk sleep)' in userspace. */
+	if (tsk_state & TASK_FROZEN)
+		state = TASK_UNINTERRUPTIBLE;
+
 	return fls(state);
 }
 
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ