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]
Date:   Wed,  1 Aug 2018 11:24:25 +0530
From:   Aashish Lakhwara <aashish.l@...sung.com>
To:     tglx@...utronix.de, linux-kernel@...r.kernel.org
Cc:     himanshu.sh@...ssung.com, a.sahrawat@...sung.com,
        pankaj.m@...sung.com, Aashish Lakhwara <aashish.l@...sung.com>,
        Himanshu Shukla <himanshu.sh@...sung.com>
Subject: [PATCH] posix-timers: Remove the stack variable clockid_t
 introduced as part of Protect posix clock array access against speculation

The "array_index_mask_nospec" code has been updated to allow index
argument to have const-qualified type.
Now the stack variable "idx" is no longer required and can be removed.
We should directly pass the const variable "id" to array_index_mask_nospec

Signed-off-by: Aashish Lakhwara <aashish.l@...sung.com>
Signed-off-by: Himanshu Shukla <himanshu.sh@...sung.com>
---
 kernel/time/posix-timers.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index e08ce3f..face369 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -1357,8 +1357,6 @@ static int common_nsleep(const clockid_t which_clock, int flags,
 
 static const struct k_clock *clockid_to_kclock(const clockid_t id)
 {
-	clockid_t idx = id;
-
 	if (id < 0) {
 		return (id & CLOCKFD_MASK) == CLOCKFD ?
 			&clock_posix_dynamic : &clock_posix_cpu;
@@ -1367,5 +1365,5 @@ static const struct k_clock *clockid_to_kclock(const clockid_t id)
 	if (id >= ARRAY_SIZE(posix_clocks))
 		return NULL;
 
-	return posix_clocks[array_index_nospec(idx, ARRAY_SIZE(posix_clocks))];
+	return posix_clocks[array_index_nospec(id, ARRAY_SIZE(posix_clocks))];
 }
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ