]> git.baikalelectronics.ru Git - kernel.git/commit
sparc64: Perf should save/restore fault info
authorRob Gardner <rob.gardner@oracle.com>
Wed, 23 Dec 2015 04:16:07 +0000 (21:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Dec 2015 17:12:46 +0000 (12:12 -0500)
commit6bebc016317b94d703df621943771787ad62d4a4
tree58bafcc903afdaffb84c2b89c7868a2aa49a9e33
parent03f714cfc10aac3ef53207b2c9eaccc784610734
sparc64: Perf should save/restore fault info

There have been several reports of random processes being killed with
a bus error or segfault during userspace stack walking in perf.  One
of the root causes of this problem is an asynchronous modification to
thread_info fault_address and fault_code, which stems from a perf
counter interrupt arriving during kernel processing of a "benign"
fault, such as a TSB miss. Since perf_callchain_user() invokes
copy_from_user() to read user stacks, a fault is not only possible,
but probable. Validity checks on the stack address merely cover up the
problem and reduce its frequency.

The solution here is to save and restore fault_address and fault_code
in perf_callchain_user() so that the benign fault handler is not
disturbed by a perf interrupt.

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/perf_event.c