[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210607095518.12694437@oasis.local.home>
Date: Mon, 7 Jun 2021 09:55:18 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Mark-PK Tsai <mark-pk.tsai@...iatek.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>, <yj.chiang@...iatek.com>
Subject: Re: [PATCH] arm64: ftrace: don't dereference a probably invalid
address
On Mon, 7 Jun 2021 11:23:30 +0800
Mark-PK Tsai <mark-pk.tsai@...iatek.com> wrote:
> Address in __mcount_loc may be invalid if somthing goes wrong.
> On our arm64 platform, the bug in recordmcount make kernel
> crash in ftrace_init().
How did it crash? The link below doesn't show any crash.
>
> https://lore.kernel.org/lkml/20210607023839.26387-1-mark-pk.tsai@mediatek.com/
>
> Return -EFAULT if we are dealing with out-of-range condition
> to prevent dereference the invalid address in ftrace_bug(),
> then the kernel can disable ftrace safely for problematic
> __mcount_loc.
!mod is not an out-of-range condition. It just happened that the other
bug caused this strange side-effect. A !mod does not mean a fault
happened. Just because it may have been caused by a fault in your use
case does not mean that it's a fault in all use cases. That's like
saying that your dog is a poodle, so all dogs are poodles.
A return of -EINVAL should not cause a crash. If it does, then that
needs to be fixed.
-- Steve
>
> Signed-off-by: Mark-PK Tsai <mark-pk.tsai@...iatek.com>
> ---
> arch/arm64/kernel/ftrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> index b5d3ddaf69d9..98bec8445a58 100644
> --- a/arch/arm64/kernel/ftrace.c
> +++ b/arch/arm64/kernel/ftrace.c
> @@ -201,7 +201,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
> preempt_enable();
>
> if (WARN_ON(!mod))
> - return -EINVAL;
> + return -EFAULT;
> }
>
> /*
Powered by blists - more mailing lists