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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 31 May 2023 21:20:48 +0000
From:   "Verma, Vishal L" <vishal.l.verma@...el.com>
To:     "Williams, Dan J" <dan.j.williams@...el.com>,
        "Schofield, Alison" <alison.schofield@...el.com>,
        "Jiang, Dave" <dave.jiang@...el.com>,
        "bwidawsk@...nel.org" <bwidawsk@...nel.org>,
        "Weiny, Ira" <ira.weiny@...el.com>
CC:     "linux-cxl@...r.kernel.org" <linux-cxl@...r.kernel.org>,
        "dave@...olabs.net" <dave@...olabs.net>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Weight, Russell H" <russell.h.weight@...el.com>
Subject: Re: [PATCH 3/4] cxl: add a firmware update mechanism using the sysfs
 firmware loader

On Mon, 2023-05-22 at 20:21 -0700, Dan Williams wrote:
> Vishal Verma wrote:

<snip>
Everything else not addressed here sounds good and I've made those
changes.

> > 
> > +       remaining = size - cur_size;
> > +       size_in = cur_size + sizeof(*transfer);
> > +
> > +       mutex_lock(&cxlds->fw.fw_mutex);
> 
> What is this lock protecting? I.e. will the fw_loader really try to send
> multiple overlapping firmware update attempts?

The lock is just to provide predictable points at which a cancel
request may be intercepted. The loader won't try overlapping firmware
transfer requests, but the ->cancel request comes from user space, and
could happen while there is a transfer in progress. With the lock, the
cancel will only be 'processed' after the current chunk's transfer is
done. 

> 
> > +       if (!cxlds->fw.clear_to_send) {
> 
> I tend to prefer atomic bitops for state flags, especially if that lets
> you get away without a lock.

I can look into that - and this was really just a sanity check, not for
any type of atomicity or locking, rather just to ensure the ->prepare
step has been run before we get to the ->write stage.

If it hadn't been run, it would be a bug in the firmware uploader core,
so I suspect we can just remove this and assume that the fw uploader
will always do the different steps in the right order.

> 
> > 

<snip>

> 
> > +
> > +       fw_name = dev_name(&cxlmd->dev);
> > +       truncate = strstr(fw_name, ".auto");
> > +       len = (truncate) ? truncate - fw_name : strlen(fw_name);
> 
> What is this doing? The device name of a cxl_memdev will never have the
> string ".auto", looks like unnecessary copy/pasta.
> 
> > +       cxlmd->fw_name = kmemdup_nul(fw_name, len, GFP_KERNEL);
> 
> Not sure this is needed either. AFAICS just pass dev_name(&cxlmd->dev)
> and skip a separate string.
> 
> 
Yep it was copy/pasta I'd meant to clean up but missed. Done now.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ