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: <CA+FuTSfQ3xuTjJk-oSDvT0o67vY34Y68zVjuTByhNaGfaNPagg@mail.gmail.com>
Date:	Thu, 14 May 2015 11:53:20 -0400
From:	Willem de Bruijn <willemb@...gle.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Network Development <netdev@...r.kernel.org>,
	David Miller <davem@...emloft.net>
Subject: Re: [PATCH net-next] packet: fix warnings in rollover lock contention

>> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
>> index 31d5856..ac1a589 100644
>> --- a/net/packet/af_packet.c
>> +++ b/net/packet/af_packet.c
>> @@ -1310,8 +1310,7 @@ static int packet_rcv_has_room(struct packet_sock *po, struct sk_buff *skb)
>>       }
>>
>>       has_room = ret == ROOM_NORMAL;
>> -     if (po->pressure == has_room)
>> -             xchg(&po->pressure, !has_room);
>> +     if (atomic_cmpxchg(&po->pressure, has_room, !has_room)) {}
>>
>
> This makes no sense to me.
>
> I thought you wanted to avoid dirtying the cache line.
> No atomic op can help the race here.

I principally want to avoid the lock contention on sk_receive_queue.lock,
which is held for a lot longer while probing frames. But yes, I'd prefer to
avoid the cacheline contention as well.

The alternative is to keep the race and just replace the xchg with a
straight assignment.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ