2023-12-01 16:22:08

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] tty: max310x: work around regmap->regcache data corruption

On Fri, Dec 01, 2023 at 03:51:51PM +0100, Jan Kundr?t wrote:

> The TL;DR summary is that the regmap_noinc_write spills over the data
> that are correctly written to the HW also to the following registers in
> the regcache. As a result, regcache then contains user-controlled
> garbage which will be used later for bit updates on unrelated registers.

> I was investigating a regression that happened somewhere between 5.12.4
> (plus 14 of our patches) and v6.5.9 (plus 7 of our patches). Our

Can you reproduce this with current kernels? That's not even an up to
date v6.5 - we're up to v6.5.13 now from the looks of things including
one upstream fix that looks potentially relevant. The most direct thing
would be to write a kunit test demonstrating the issue with current
mainline.

If things are already fine with mainline then you'd need to talk to the
stable maintainers about what they've chosen to backport.


Attachments:
(No filename) (938.00 B)
signature.asc (499.00 B)
Download all attachments

2023-12-01 17:03:38

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] tty: max310x: work around regmap->regcache data corruption

On Fri, Dec 1, 2023 at 6:21 PM Mark Brown <[email protected]> wrote:
> On Fri, Dec 01, 2023 at 03:51:51PM +0100, Jan Kundrát wrote:
>
> > The TL;DR summary is that the regmap_noinc_write spills over the data
> > that are correctly written to the HW also to the following registers in
> > the regcache. As a result, regcache then contains user-controlled
> > garbage which will be used later for bit updates on unrelated registers.
>
> > I was investigating a regression that happened somewhere between 5.12.4
> > (plus 14 of our patches) and v6.5.9 (plus 7 of our patches). Our
>
> Can you reproduce this with current kernels? That's not even an up to
> date v6.5 - we're up to v6.5.13 now from the looks of things including
> one upstream fix that looks potentially relevant.

Indeed, the 984a4afdc87a ("regmap: prevent noinc writes from
clobbering cache") seems quite relevant.

--
With Best Regards,
Andy Shevchenko

2023-12-02 10:35:29

by Jan Kundrát

[permalink] [raw]
Subject: Re: [PATCH] tty: max310x: work around regmap->regcache data corruption

On pátek 1. prosince 2023 18:02:32 CET, Andy Shevchenko wrote:
> On Fri, Dec 1, 2023 at 6:21 PM Mark Brown <[email protected]> wrote:
>> On Fri, Dec 01, 2023 at 03:51:51PM +0100, Jan Kundrát wrote:
>>
>>> The TL;DR summary is that the regmap_noinc_write spills over the data
>>> that are correctly written to the HW also to the following registers in
>>> the regcache. As a result, regcache then contains user-controlled
>>> garbage which will be used later for bit updates on unrelated registers.
>>
>>> I was investigating a regression that happened somewhere between 5.12.4
>>> (plus 14 of our patches) and v6.5.9 (plus 7 of our patches). Our
>>
>> Can you reproduce this with current kernels? That's not even an up to
>> date v6.5 - we're up to v6.5.13 now from the looks of things including
>> one upstream fix that looks potentially relevant.
>
> Indeed, the 984a4afdc87a ("regmap: prevent noinc writes from
> clobbering cache") seems quite relevant.

Thank you, Andy, this is indeed the real fix.

Sorry that I missed it, Mark. I spent many days on this one over a longer
period of time, so I haven't noticed that a fix was merged in the
meanwhile. I was just very happy that I debugged something which looked
like a real puzzle at the beginning :).

Cheers,
Jan