]> git.ipfire.org Git - people/arne_f/kernel.git/commit
Correct the race condition in aarch64_insn_patch_text_sync()
authorWilliam Cohen <wcohen@redhat.com>
Tue, 11 Nov 2014 14:41:27 +0000 (09:41 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2014 17:23:02 +0000 (09:23 -0800)
commita1dd586647f122eec80dee85d3f6cb6685c8c7e8
tree7db25090a837f28a466dc93267a2cd7cb5a458a3
parent25e26c3e8b6c7921a8d44017b61d989dbe4e8649
Correct the race condition in aarch64_insn_patch_text_sync()

commit 899d5933b2dd2720f2b20b01eaa07871aa6ad096 upstream.

When experimenting with patches to provide kprobes support for aarch64
smp machines would hang when inserting breakpoints into kernel code.
The hangs were caused by a race condition in the code called by
aarch64_insn_patch_text_sync().  The first processor in the
aarch64_insn_patch_text_cb() function would patch the code while other
processors were still entering the function and incrementing the
cpu_count field.  This resulted in some processors never observing the
exit condition and exiting the function.  Thus, processors in the
system hung.

The first processor to enter the patching function performs the
patching and signals that the patching is complete with an increment
of the cpu_count field. When all the processors have incremented the
cpu_count field the cpu_count will be num_cpus_online()+1 and they
will return to normal execution.

Fixes: ae16480785de arm64: introduce interfaces to hotpatch kernel and module code
Signed-off-by: William Cohen <wcohen@redhat.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/insn.c