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: <20231011160243.4893729d@xps-13>
Date:   Wed, 11 Oct 2023 16:02:43 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Michael Walle <michael@...le.cc>,
        Rafał Miłecki <rafal@...ecki.pl>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Robert Marko <robert.marko@...tura.hr>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Luka Perkov <luka.perkov@...tura.hr>,
        Randy Dunlap <rdunlap@...radead.org>,
        Chen-Yu Tsai <wenst@...omium.org>,
        Daniel Golle <daniel@...rotopia.org>
Subject: Re: [PATCH v12 7/7] nvmem: core: Expose cells through sysfs

Hi Srinivas,

srinivas.kandagatla@...aro.org wrote on Wed, 11 Oct 2023 14:56:02 +0100:

> On 11/10/2023 12:09, Miquel Raynal wrote:
> > Hi Srinivas,
> > 
> > srinivas.kandagatla@...aro.org wrote on Wed, 11 Oct 2023 11:02:16 +0100:
> >   
> >> Hi Miquel,
> >>
> >> On 11/10/2023 10:44, Miquel Raynal wrote:  
> >>> Hi Srinivas,
> >>>
> >>> srinivas.kandagatla@...aro.org wrote on Wed, 11 Oct 2023 10:26:43 +0100:  
> >>>    >>>> On 11/10/2023 09:58, Miquel Raynal wrote:  
> >>>>> Hi Srinivas,
> >>>>>
> >>>>> srinivas.kandagatla@...aro.org wrote on Wed, 11 Oct 2023 09:45:11 +0100:  
> >>>>>     >>>> On 11/10/2023 09:33, Miquel Raynal wrote:  
> >>>>>>> Hi Srinivas,
> >>>>>>>
> >>>>>>> srinivas.kandagatla@...aro.org wrote on Wed, 11 Oct 2023 09:27:20 +0100:  
> >>>>>>>      >>>> On 11/10/2023 08:15, Miquel Raynal wrote:
> >>>>>>>>>>> +
> >>>>>>>>>>> +	nvmem_cells_group.bin_attrs = cells_attrs;
> >>>>>>>>>>> +
> >>>>>>>>>>> +	ret = devm_device_add_groups(&nvmem->dev, nvmem_cells_groups);
> >>>>>>>>>>> +	if (ret)
> >>>>>>>>>>> +		goto unlock_mutex;  
> >>>>>>>>>> This is going to create groups after the nvmem device is added, isn't this going to be problem with user space notifications?  
> >>>>>>>>> Greg said it was not. I hope I understood correctly 😄
> >>>>>>>>>
> >>>>>>>>> And anyway, cells have never been available to userspace, so there is
> >>>>>>>>> nothing userspace might expect yet?  
> >>>>>>>> I agree, but once we add sysfs uapi then this is going to change.  
> >>>>>>>
> >>>>>>> Can you elaborate? I'm not sure I follow you here. Is there still a
> >>>>>>> problem you fear or you think it's okay?  
> >>>>>>>      >> Now that we add cells to sysfs.  
> >>>>>> AFAIU, By the time the userspace sees the udev event from this device we might not have cells populated.  
> >>>>>
> >>>>> Yes, but why would this be a problem?  
> >>>>>     >> It will be problem if the userspace is using things like libudev to act on these events. There seems to be some caching of attributes in udev during event more info http://www.kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/  
> >>>
> >>> I am already using these attributes, right? The problem here is that we
> >>> always attach cells sysfs attributes to the nvmem device, but in some
> >>> cases (when using layout devices/drivers) the probe of these devices
> >>> will happen after the main nvmem device has been announced to userspace
> >>> and thus these attributes might not be populated yet (but Greg said it
> >>> was "supported" and I assumed it was fine).  
> >>>   > So what is your idea here to overcome this?  
> >>
> >> Ideally we should have all the cells definitions ready by the time nvmem is registered.  
> > 
> > I no longer think what you describe can happen because even though the
> > rootfs might be mounted, the daemons will only be 'started' once the
> > kernel is done starting and starts the init process, which means all
> > the devices have probed and all the cells have been registered as well.  
> I think you forgot about modules in the above flow.

We request module insertion when the layout gets populated. By the time
userspace starts the kernel is done initializing, meaning that any
available nvmem layout module has already been loaded and the devices
probed -> the cells are there already.

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ