lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210723173556.2t3pgt27xb5lpk35@garbanzo>
Date:   Fri, 23 Jul 2021 10:35:56 -0700
From:   Luis Chamberlain <mcgrof@...nel.org>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     Tejun Heo <tj@...nel.org>, rafael@...nel.org, davem@...emloft.net,
        kuba@...nel.org, ast@...nel.org, andriin@...com,
        daniel@...earbox.net, atenart@...nel.org, alobakin@...me,
        weiwan@...gle.com, ap420073@...il.com, jeyu@...nel.org,
        ngupta@...are.org, sergey.senozhatsky.work@...il.com,
        minchan@...nel.org, axboe@...nel.dk, mbenes@...e.com,
        jpoimboe@...hat.com, tglx@...utronix.de, keescook@...omium.org,
        jikos@...nel.org, rostedt@...dmis.org, peterz@...radead.org,
        linux-block@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] sysfs: fix kobject refcount to address races with
 kobject removal

On Fri, Jul 23, 2021 at 01:14:10PM +0200, Greg KH wrote:
> On Thu, Jul 22, 2021 at 02:31:37PM -0700, Luis Chamberlain wrote:
> > On Wed, Jul 21, 2021 at 01:30:29PM +0200, Greg KH wrote:
> > > On Thu, Jul 01, 2021 at 03:48:16PM -0700, Luis Chamberlain wrote:
> > > > On Fri, Jun 25, 2021 at 02:56:03PM -0700, Luis Chamberlain wrote:
> > > > > On Thu, Jun 24, 2021 at 01:09:03PM +0200, Greg KH wrote:
> > > > > > thanks for making this change and sticking with it!
> > > > > > 
> > > > > > Oh, and with this change, does your modprobe/rmmod crazy test now work?
> > > > > 
> > > > > It does but I wrote a test_syfs driver and I believe I see an issue with
> > > > > this. I'll debug a bit more and see what it was, and I'll then also use
> > > > > the driver to demo the issue more clearly, and then verification can be
> > > > > an easy selftest test.
> > > > 
> > > > OK my conclusion based on a new selftest driver I wrote is we can drop
> > > > this patch safely. The selftest will cover this corner case well now.
> > > > 
> > > > In short: the kernfs active reference will ensure the store operation
> > > > still exists. The kernfs mutex is not enough, but if the driver removes
> > > > the operation prior to getting the active reference, the write will just
> > > > fail. The deferencing inside of the sysfs operation is abstract to
> > > > kernfs, and while kernfs can't do anything to prevent a driver from
> > > > doing something stupid, it at least can ensure an open file ensure the
> > > > op is not removed until the operation completes.
> > > 
> > > Ok, so all is good?
> > 
> > It would seem to be the case.
> > 
> > > Then why is your zram test code blowing up so badly?
> > 
> > I checked the logs for the backtrace where the crash did happen
> > and we did see clear evidence of the race we feared here. The *first*
> > bug that happened was the CPU hotplug race:
> > 
> > [132004.787099] Error: Removing state 61 which has instances left.
> > [132004.787124] WARNING: CPU: 17 PID: 9307 at ../kernel/cpu.c:1879 __cpuhp_remove_state_cpuslocked+0x1c4/0x1d0
> 
> I do not understand what this issue is, is it fixed?

My first patch for zram fixes the CPU multistate mis-use. And after that
patch is applied triggering the other race does not happen.  It is why I
decided to write a selftest driver, so that we can have a way to do all
sorts of crazy races in a self contained driver example.

> Why is a cpu being hot unplugged at the same time a zram?

That's not what is happening. The description of the issue with zram's
misuse of CPU multistate is described clearly in my commit log for the
fix for that driver. You can refer to that commit log description.

  Luis

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ