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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1473066782-19372-2-git-send-email-sgruszka@redhat.com>
Date:   Mon,  5 Sep 2016 11:13:01 +0200
From:   Stanislaw Gruszka <sgruszka@...hat.com>
To:     linux-kernel@...r.kernel.org
Cc:     Giovanni Gherdovich <ggherdovich@...e.cz>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Mike Galbraith <mgalbraith@...e.de>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Rik van Riel <riel@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Wanpeng Li <wanpeng.li@...mail.com>,
        Ingo Molnar <mingo@...nel.org>,
        Stanislaw Gruszka <sgruszka@...hat.com>
Subject: [PATCH v2 1/2] sched/cputime: Use only pi_lock to protect sum_exec_runtime read

Currently we protect 64bit sum_exec_runtime read on 32bit cpus using
task_rq_lock() which internally takes t->pi_lock and rq->lock. Taking
rq->lock is not needed in this case.

Signed-off-by: Stanislaw Gruszka <sgruszka@...hat.com>
---
 kernel/sched/cputime.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index b93c72d..5535774 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -315,12 +315,11 @@ static inline u64 read_sum_exec_runtime(struct task_struct *t)
 static u64 read_sum_exec_runtime(struct task_struct *t)
 {
 	u64 ns;
-	struct rq_flags rf;
-	struct rq *rq;
+	unsigned long flags;
 
-	rq = task_rq_lock(t, &rf);
+	raw_spin_lock_irqsave(&t->pi_lock, flags);
 	ns = t->se.sum_exec_runtime;
-	task_rq_unlock(rq, t, &rf);
+	raw_spin_unlock_irqrestore(&t->pi_lock, flags);
 
 	return ns;
 }
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ