Re: [PATCH 4.4 02/96] s390/runtime instrumention: fix possible memory corruption

From: Ben Hutchings
Date: Tue Dec 05 2017 - 12:02:42 EST


On Tue, 2017-11-28 at 11:22 +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.ÂÂIf anyone has any objections, please let me know.
>
> ------------------
>
> From: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
>
> commit d6e646ad7cfa7034d280459b2b2546288f247144 upstream.
[...]
> --- a/arch/s390/kernel/runtime_instr.c
> +++ b/arch/s390/kernel/runtime_instr.c
> @@ -47,11 +47,13 @@ void exit_thread_runtime_instr(void)
> Â{
> Â struct task_struct *task = current;
> Â
> + preempt_disable();
> Â if (!task->thread.ri_cb)
> Â return;

This return path now leaves preemption disabled. This seems to have
been fixed upstream by commit 8d9047f8b967 "s390/runtime
instrumentation: simplify task exit handling".

Ben.

> Â disable_runtime_instr();
> Â kfree(task->thread.ri_cb);
> Â task->thread.ri_cb = NULL;
> + preempt_enable();
> Â}
> Â
> ÂSYSCALL_DEFINE1(s390_runtime_instr, int, command)
[...]

--
Ben Hutchings
Software Developer, Codethink Ltd.