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]
Date:   Tue, 29 Nov 2016 16:45:18 +0300
From:   Alexander Kochetkov <al.kochet@...il.com>
To:     linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-rockchip@...ts.infradead.org
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Heiko Stuebner <heiko@...ech.de>,
        Mark Rutland <mark.rutland@....com>,
        Rob Herring <robh+dt@...nel.org>,
        Russell King <linux@...linux.org.uk>,
        Caesar Wang <wxt@...k-chips.com>,
        Huang Tao <huangtao@...k-chips.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Alexander Kochetkov <al.kochet@...il.com>
Subject: [PATCH v3 13/13] clocksource/drivers/rockchip_timer: Prevent ftrace recursion

Currently rockchip_timer can be used as a scheduler clock. We properly
marked rk_timer_sched_clock_read() as notrace but we then call another
function rk_timer_counter_read() that _wasn't_ notrace.

Having a traceable function in the sched_clock() path leads to a recursion
within ftrace and a kernel crash.

Fix this by adding an extra notrace function to keep other users of
rk_timer_counter_read() traceable.

Signed-off-by: Alexander Kochetkov <al.kochet@...il.com>
---
 drivers/clocksource/rockchip_timer.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index 1af80a0..a127822 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -87,7 +87,7 @@ static void rk_timer_update_counter(u64 cycles, struct rk_timer *timer)
 	writel_relaxed(upper, timer->base + TIMER_LOAD_COUNT1);
 }
 
-static u64 rk_timer_counter_read(struct rk_timer *timer)
+static u64 notrace _rk_timer_counter_read(struct rk_timer *timer)
 {
 	u64 counter;
 	u32 lower;
@@ -106,6 +106,11 @@ static u64 rk_timer_counter_read(struct rk_timer *timer)
 	return counter;
 }
 
+static u64 rk_timer_counter_read(struct rk_timer *timer)
+{
+	return _rk_timer_counter_read(timer);
+}
+
 static void rk_timer_interrupt_clear(struct rk_timer *timer)
 {
 	writel_relaxed(1, timer->base + TIMER_INT_STATUS);
@@ -168,7 +173,7 @@ static u64 notrace rk_timer_sched_clock_read(void)
 {
 	struct rk_clocksource *_cs = &cs_timer;
 
-	return ~rk_timer_counter_read(&_cs->timer);
+	return ~_rk_timer_counter_read(&_cs->timer);
 }
 
 static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
-- 
1.7.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ