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: <50E3FE4A-2C6E-4493-92E1-383C349FAE3A@oracle.com>
Date:   Mon, 23 Apr 2018 16:19:57 +0200
From:   Håkon Bugge <haakon.bugge@...cle.com>
To:     Jason Gunthorpe <jgg@...pe.ca>
Cc:     Doug Ledford <dledford@...hat.com>,
        Don Hiatt <don.hiatt@...el.com>,
        Dasaratharaman Chandramouli 
        <dasaratharaman.chandramouli@...el.com>,
        Ira Weiny <ira.weiny@...el.com>,
        Sean Hefty <sean.hefty@...el.com>,
        OFED mailing list <linux-rdma@...r.kernel.org>,
        linux-kernel@...r.kernel.org, jackm <jackm@....mellanox.co.il>
Subject: Re: [PATCH] IB/core: Make ib_mad_client_id atomic


+Jack

> On 20 Apr 2018, at 17:34, Jason Gunthorpe <jgg@...pe.ca> wrote:
> 
> On Thu, Apr 19, 2018 at 11:55:55PM -0400, Doug Ledford wrote:
>> On Wed, 2018-04-18 at 16:24 +0200, Håkon Bugge wrote:
>>> Two kernel threads may get the same value for agent.hi_tid, if the
>>> agents are registered for different ports. As of now, this works, as
>>> the agent list is per port.
>>> 
>>> It is however confusing and not future robust. Hence, making it
>>> atomic.
>>> 
>> 
>> People sometimes underestimate the performance penalty of atomic ops. 
>> Every atomic op is the equivalent of a spin_lock/spin_unlock pair.

Well, may be this holds true if the mutex and the variable is located in the same cacheline.

>>  This
>> is why two atomics are worse than taking a spin_lock, doing what you
>> have to do, and releasing the spin_lock.  Is this really what you want
>> for a "confusing, let's make it robust" issue?
> 
> But it is on the ib_register_mad_agent() path which is not a
> performance path..
> 
> This actually looks like a genuine bug, why is it described only as
> 'confusing'? ib_register_mad_agent is callable from userspace, so at
> least two userspace agents can race and get the same TID’s.

My understanding is that every lookup is using the {port, TID} tuple. As such, it is not a bug, but, very confusing.

> TIDs need to be globally unique on the entire machine.

If you are correct Jason, let me reword the commit message.


Thxs, Håkon

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ