linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
To: Joseph Salisbury <joseph.salisbury@canonical.com>
Cc: Rainer Weikusat <rweikusat@mobileactivedefense.com>,
	hannes@stressinduktion.org,
	"davem\@davemloft.net" <davem@davemloft.net>,
	edumazet@google.com, dhowells@redhat.com, ying.xue@windriver.com,
	"netdev\@vger.kernel.org" <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"stable\@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [V4.4-rc6 Regression] af_unix: Revert 'lock_interruptible' in stream receive code
Date: Fri, 05 Feb 2016 21:18:04 +0000	[thread overview]
Message-ID: <87egcqsvoz.fsf@doppelsaurus.mobileactivedefense.com> (raw)
In-Reply-To: <56B500B5.9090700@canonical.com> (Joseph Salisbury's message of "Fri, 5 Feb 2016 15:06:13 -0500")

Joseph Salisbury <joseph.salisbury@canonical.com> writes:
> On 02/05/2016 02:59 PM, Rainer Weikusat wrote:

[recvmsg w/o iovecs returning ENOTSUP for CMSG requests]

>> Funny little problem :-). The code using the interruptible lock cleared
>> err as side effect hence the
>>
>> out:
>> 	return copied ? : err;
>>
>> at the end of unix_stream_read_generic didn't return the -ENOTSUP put
>> into err at the start of the function if copied was zero after the loop
>> because the size of the passed data buffer was zero.

There are more problems wrt handling control-message only reads in this
code. In particular, changing the test program as follows:

    if (fork() == 0) {
	sleep(1);
	send(socket_fd[client], msg, sizeof msg, MSG_DONTWAIT | MSG_NOSIGNAL);

	_exit(0);
    }

makes the recvmsg fail with EAGAIN and judging from the code (I didn't
test this yet), it will return without an error but also without
credentials if the

err = -EAGAIN
if (!timeo)
	break;

is changed to

if (!timeo) {
	err = -EAGAIN;
        break
}

because the following

mutex_lock(&u->readlock);
continue;

will cause the

do {
} while (size)

loop condition to be evaluated and since size is 0 (AIUI), the loop will
terminate immediately.

  reply	other threads:[~2016-02-05 21:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 18:50 [V4.4-rc6 Regression] af_unix: Revert 'lock_interruptible' in stream receive code Joseph Salisbury
2016-02-05 19:59 ` Rainer Weikusat
2016-02-05 20:06   ` Joseph Salisbury
2016-02-05 21:18     ` Rainer Weikusat [this message]
2016-02-05 22:04       ` Rainer Weikusat
2016-02-05 21:44 ` Rainer Weikusat
2016-02-05 23:03   ` Eric Dumazet
2016-02-07 18:43     ` Rainer Weikusat
2016-02-07 20:39       ` Rainer Weikusat
2016-02-07 22:24       ` Rainer Weikusat
2016-02-08  3:35         ` Eric Dumazet
2016-02-05 22:30 ` [PATCH] af_unix: Don't set err in unix_stream_read_generic unless there was an error Rainer Weikusat
2016-02-07 19:20   ` Rainer Weikusat
2016-02-08 15:33     ` Rainer Weikusat
2016-02-08 18:05       ` Rainer Weikusat
2016-02-08 18:47         ` Rainer Weikusat
2016-02-16 17:51           ` David Miller
2016-02-17  0:24             ` Ben Hutchings
2016-02-17  1:07               ` David Miller
2016-02-08 18:33       ` Sergei Shtylyov
2016-02-11 21:31   ` Joseph Salisbury
2016-02-12 13:31     ` Rainer Weikusat
2016-02-13  0:18   ` Ben Hutchings

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=87egcqsvoz.fsf@doppelsaurus.mobileactivedefense.com \
    --to=rweikusat@mobileactivedefense.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=hannes@stressinduktion.org \
    --cc=joseph.salisbury@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=ying.xue@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).