public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Rainer Weikusat <rweikusat@mobileactivedefense•com>
To: Ben Hutchings <ben@decadent•org.uk>
Cc: Rainer Weikusat <rweikusat@mobileactivedefense•com>,
	Philipp Hahn <pmhahn@pmhahn•de>,
	Hannes Frederic Sowa <hannes@stressinduktion•org>,
	Sasha Levin <sasha.levin@oracle•com>,
	"David S. Miller" <davem@davemloft•net>,
	linux-kernel@vger•kernel.org, Karolin Seeger <kseeger@samba•org>,
	Jason Baron <jbaron@akamai•com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
	Arvid Requate <requate@univention•de>,
	Stefan Gohmann <gohmann@univention•de>,
	netdev@vger•kernel.org
Subject: Re: [PATCH net] af_unix: Guard against other == sk in unix_dgram_sendmsg
Date: Fri, 12 Feb 2016 20:59:57 +0000	[thread overview]
Message-ID: <87a8n5able.fsf@doppelsaurus.mobileactivedefense.com> (raw)
In-Reply-To: <1455310037.2801.61.camel@decadent.org.uk> (Ben Hutchings's message of "Fri, 12 Feb 2016 20:47:17 +0000")

Ben Hutchings <ben@decadent•org.uk> writes:
> On Fri, 2016-02-12 at 20:17 +0000, Rainer Weikusat wrote:

[...]

>>>> I don't think this should apply when
>>>> receiving and sending sockets are identical. But that's just my
>>>> opinion. The other option would be to avoid the unix_state_double_lock
>>>> for sk == other.
>>> 
>>> Given that unix_state_double_lock() already handles sk == other, I'm
>>> not sure why you think it needs to be avoided.
>> 
>> Because the whole complication of restarting the operation after locking
>> both sk and other because other had to be unlocked before calling
>> unix_state_double_lock is useless for this case:

[...]

> Well of course it's useless, but it's also harmless.  

As is adding a

for (i = 0; i < 1000000; ++i);

between any two statements. And this isn't even entirely true as the
pointless double-lock will then require "did we pointlessly
doube-lock" checks elsewhere. I think it should be possible to do this
in a simpler way by not pointlessly double-locking (this may be
wrong but it's worth a try).

> If we really wanted to optimise this we could also skip unlocking if
> other < sk.

I wouldn't want to hardcode assumptions about the unix_state_double_lock
algorithm in functions using it. 

  reply	other threads:[~2016-02-12 20:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <56B4BF9D.9070609@pmhahn.de>
     [not found] ` <56BC90E7.7040007@pmhahn.de>
     [not found]   ` <87fuwzkzr5.fsf@doppelsaurus.mobileactivedefense.com>
     [not found]     ` <1455210224.2801.21.camel@decadent.org.uk>
     [not found]       ` <87r3gjjgbu.fsf@doppelsaurus.mobileactivedefense.com>
     [not found]         ` <87egcjcd5j.fsf@doppelsaurus.mobileactivedefense.com>
2016-02-11 19:37           ` [PATCH net] af_unix: Guard against other == sk in unix_dgram_sendmsg Rainer Weikusat
2016-02-12  9:19             ` Philipp Hahn
2016-02-12 13:25               ` Rainer Weikusat
2016-02-12 19:54                 ` Ben Hutchings
2016-02-12 20:17                   ` Rainer Weikusat
2016-02-12 20:47                     ` Ben Hutchings
2016-02-12 20:59                       ` Rainer Weikusat [this message]
2016-02-16 17:54             ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8n5able.fsf@doppelsaurus.mobileactivedefense.com \
    --to=rweikusat@mobileactivedefense$(echo .)com \
    --cc=ben@decadent$(echo .)org.uk \
    --cc=davem@davemloft$(echo .)net \
    --cc=gohmann@univention$(echo .)de \
    --cc=gregkh@linuxfoundation$(echo .)org \
    --cc=hannes@stressinduktion$(echo .)org \
    --cc=jbaron@akamai$(echo .)com \
    --cc=kseeger@samba$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pmhahn@pmhahn$(echo .)de \
    --cc=requate@univention$(echo .)de \
    --cc=sasha.levin@oracle$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox