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: <e45dec40-d068-be47-7cbb-1b897e48c306@huawei.com>
Date:   Wed, 8 May 2019 23:02:33 +0800
From:   "chengjian (D)" <cj.chengjian@...wei.com>
To:     Steven Rostedt <rostedt@...dmis.org>
CC:     <linux-kernel@...r.kernel.org>, <huawei.libin@...wei.com>,
        <xiexiuqi@...wei.com>, <mingo@...hat.com>,
        "chengjian (D)" <cj.chengjian@...wei.com>,
        <bobo.shaobowang@...wei.com>
Subject: Re: [PATCH] ftrace: enable trampoline when rec count decrement to one

Hi, Steven


On 2019/5/6 3:34, Steven Rostedt wrote:
>
> Thanks for the patch. There was some race condition that prevented me
> from doing this in the first place, but unfortunately, I don't remember
> what that was :-/
>
> I'll have to think about this before applying this patch.
>
> Maybe there isn't a race condition, and I was just playing it safe, as
> there was a race condition between switching from regs caller back to
> non regs caller.
>
> -- Steve
> .


function tracer uses ftrace_caller() and livepatch uses 
ftrace_regs_caller().

I can modify my testcase to trigger this race condition.


#enable livepatch
insmod klp_unshare_files.ko
cat /sys/kernel/debug/tracing/enabled_functions
         unshare_files (1) R I	tramp: 0xffffffffc0008000 (klp_ftrace_handler+0x0/0xa0) ->ftrace_ops_assist_func+0x0/0xf0
[NOW, the rec caller is ftracer_regs_caller TRAMPOLINE]

#function tracer
echo unshare_files > /sys/kernel/debug/tracing/set_ftrace_filter
echo function > /sys/kernel/debug/tracing/current_tracer
cat /sys/kernel/debug/tracing/enabled_functions
         unshare_files (2) R I ->ftrace_ops_list_func+0x0/0x170
[NOW, the rec caller is ftracer_regs_caller]


# disable livepatch
echo 0 > /sys/kernel/livepatch/klp_unshare_files/enabled
rmmod klp_unshare_files


cat /sys/kernel/debug/tracing/enabled_functions
         unshare_files (1)    	tramp: 0xffffffffc0005000 (function_trace_call+0x0/0x120) ->function_trace_call+0x0/0x120
[NOW, the rec caller is ftrace_caller TRAMPOLINE]

So, the caller switch from regs caller back to non regs caller
when disable the livepatch. Could this testcase cause the race
condition ? BUT, Nothing happened here.

What will happen when the race triggers ? What can I do.


Thanks.

Cheng Jian.




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ