[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1546997717.20937.3.camel@mtkswgap22>
Date: Wed, 9 Jan 2019 09:35:17 +0800
From: Miles Chen <miles.chen@...iatek.com>
To: Mark Rutland <mark.rutland@....com>
CC: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>, <wsd_upstream@...iatek.com>
Subject: Re: [PATCH] arm64: trap illegal translations in __virt_to_phys()
On Tue, 2019-01-08 at 12:14 +0000, Mark Rutland wrote:
> On Tue, Jan 08, 2019 at 11:24:43AM +0800, Miles Chen wrote:
> > On Mon, 2019-01-07 at 15:00 +0000, Mark Rutland wrote:
> > > On Mon, Jan 07, 2019 at 07:21:20PM +0800, Miles Chen wrote:
> > > > Current __virt_to_phys() only print warning messages for non-linear
> > > > addresses. It's hard to catch all warnings by those messages.
> > >
> > > Why? Are you seeing a large number of warnings somewhere?
> >
> > Official kernel works fine. I saw some cases in our internal branch and
> > we're fixing them.
> >
> > >
> > > > So add a VIRTUAL_BUG_ON() to trap all non-linear and non-symbol
> > > > addresses (e.g., stack addresses)
> > > >
> > > > Tested by pass stack addresses and symbol addresses to __pa(). Result:
> > > > stack addresses: kernel BUG()
> > >
> > > Either:
> > >
> > > * Stacks are vmap'd, and __is_lm_address(stack_addr) is false. We'll
> > > produce a WARNING() today (and return a junk physical address).
> > >
> > > * Stacks are linear mapped, and cannot be distinguished from other
> > > linear mapped addresses. The physical address will be valid.
> > >
> > > ... so I don't understand why you need to change this.
> >
> > For the first case: for vmap'd stack, __pa() returns a junk
> > physical address and it might be easier to debug this incorrect address
> > translation by a BUG() call instead of monitoring the warning log.
>
> I think that's an argument for upgrading the existing WARN() to a BUG(),
> rather than adding a separate VIRTUAL_BUG_ON().
>
> However, there are cases where the junk physical address is not used to
> perform an access, and the WARN() is more helpful.
got it.
>
> You can set panic_on_warn to get an immediate panic() when the WARN()
> fires. Is there some reason that approach doesn't work for you?
panic_on_warn works fine. thanks for your comment.
cheers,
Miles
>
> Thanks,
> Mark.
Powered by blists - more mailing lists