Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1495139

Re: [PATCH] af_unix: fix garbage collect vs. MSG_PEEK

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] af_unix: fix garbage collect vs. MSG_PEEK
Date 2016-10-04 04:00 +0200
Message-ID <sonbr-4an-15@gated-at.bofh.it> (permalink)
References <smIk2-3Wx-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Miklos Szeredi <mszeredi@redhat.com>
Date: Thu, 29 Sep 2016 14:09:14 +0200

> @@ -1550,6 +1550,17 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
>  	return max_level;
>  }
>  
> +static void unix_peek_fds(struct scm_cookie *scm, struct sk_buff *skb)
> +{
> +	scm->fp = scm_fp_dup(UNIXCB(skb).fp);
> +	/*
> +	 * During garbage collection it is assumed that in-flight sockets don't
> +	 * get a new external reference.  So we need to wait until current run
> +	 * finishes.
> +	 */
> +	unix_gc_barrier();
> +}
 ...
> @@ -266,6 +266,11 @@ void wait_for_unix_gc(void)
>  	wait_event(unix_gc_wait, gc_in_progress == false);
>  }
>  
> +void unix_gc_barrier(void)
> +{
> +	spin_unlock_wait(&unix_gc_lock);
> +}

Can you explain why wait_for_unix_gc() isn't appropriate?  I'm a little
bit uncomfortable with a spinlock wait like this, and would rather see
something like the existing helper used.

Thanks.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] af_unix: fix garbage collect vs. MSG_PEEK Miklos Szeredi <mszeredi@redhat.com> - 2016-09-29 14:10 +0200
  Re: [PATCH] af_unix: fix garbage collect vs. MSG_PEEK David Miller <davem@davemloft.net> - 2016-10-04 04:00 +0200

csiph-web