From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755897AbcBHRMg (ORCPT ); Mon, 8 Feb 2016 12:12:36 -0500 Received: from mail-ob0-f172.google.com ([209.85.214.172]:35808 "EHLO mail-ob0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755400AbcBHRMf (ORCPT ); Mon, 8 Feb 2016 12:12:35 -0500 Subject: Re: [PATCH] arm64: disable kasan when accessing frame->fp in unwind_frame To: Andrey Ryabinin , Will.Deacon@arm.com, Catalin.Marinas@arm.com References: <1454713487-5239-1-git-send-email-yang.shi@linaro.org> <56B856F5.5080606@virtuozzo.com> Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org From: "Shi, Yang" Message-ID: <56B8CC75.1000508@linaro.org> Date: Mon, 8 Feb 2016 09:12:21 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56B856F5.5080606@virtuozzo.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/8/2016 12:51 AM, Andrey Ryabinin wrote: > > > On 02/06/2016 02:04 AM, Yang Shi wrote: >> >> #include >> #include >> @@ -64,7 +65,9 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) >> return -EINVAL; >> >> frame->sp = fp + 0x10; >> + kasan_disable_current(); >> frame->fp = *(unsigned long *)(fp); > > It would be better to use READ_ONCE_NOCHECK() here. > See f7d27c35ddff7 ("x86/mm, kasan: Silence KASAN warnings in get_wchan()") which solves the same problem for x86. Thanks for the suggestion, I'm going to try it soon. > >> + kasan_enable_current(); >> frame->pc = *(unsigned long *)(fp + 8); > > Why you left frame->pc out of scope? This line could trigger kasan as well. Actually, it was not reported as frequently as the first one. In my first a couple of boot test, it was not triggered before I came up with the patch. The first one is triggered every time. It will be fixed in v2 too. Thanks, Yang > >> >> #ifdef CONFIG_FUNCTION_GRAPH_TRACER >>