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]
Message-ID: <20171209231113.GK10595@n2100.armlinux.org.uk>
Date:   Sat, 9 Dec 2017 23:11:13 +0000
From:   Russell King - ARM Linux <linux@...linux.org.uk>
To:     Florian Fainelli <f.fainelli@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org
Subject: Re: [PATCH RFC 3/4] net: phy: add unlocked accessors

On Sat, Dec 09, 2017 at 10:22:14AM -0800, Florian Fainelli wrote:
> 
> 
> On 12/08/2017 07:48 AM, Russell King wrote:
> > Add unlocked versions of the bus accessors, which allows access to the
> > bus with all the tracing. These accessors validate that the bus mutex
> > is held, which is a basic requirement for all mii bus accesses.
> > 
> > Signed-off-by: Russell King <rmk+kernel@...linux.org.uk>
> 
> Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
> 
> > ---
> >  include/linux/phy.h | 26 ++++++++++++++++++++++++++
> >  1 file changed, 26 insertions(+)
> > 
> > diff --git a/include/linux/phy.h b/include/linux/phy.h
> > index 71d777fe6c3d..964803bd7324 100644
> > --- a/include/linux/phy.h
> > +++ b/include/linux/phy.h
> > @@ -716,6 +716,18 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum)
> >  }
> >  
> >  /**
> > + * __phy_read - convenience function for reading a given PHY register
> > + * @phydev: the phy_device struct
> > + * @regnum: register number to read
> > + *
> > + * The caller must have taken the MDIO bus lock.
> > + */
> > +static inline int __phy_read(struct phy_device *phydev, u32 regnum)
> 
> Do you know if we could have sparse validate that the caller of these
> functions holds the mutex? I remember reading somewhere that sparse does
> not do that yet, but can't get my hands on it.

Hi Florian,

I tried adding __acquires() and __releases() annotations, but sparse
complained about unbalanced lock counts when I did, because sparse has
no knowledge about mutexes being taken or released.

Unfortunately, it seems that these annotations are undocumented in the
kernel, but from what I can see, it turns out that they only apply to
spinlocks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ