linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: + fs-epoll-add-procfs-fdinfo-helper.patch added to -mm tree
@ 2012-11-13 14:50 Oleg Nesterov
  2012-11-13 15:53 ` Cyrill Gorcunov
  0 siblings, 1 reply; 9+ messages in thread
From: Oleg Nesterov @ 2012-11-13 14:50 UTC (permalink / raw)
  To: Pavel Emelyanov, Cyrill Gorcunov, Al Viro, Alexey Dobriyan,
	James Bottomley, Aneesh Kumar K.V, Matthew Helsley,
	J. Bruce Fields, Andrew Morton
  Cc: linux-kernel

>  struct signalfd_ctx {
> +	seqcount_t cnt;
>  	sigset_t sigmask;
>  };
> ...
> @@ -278,7 +302,9 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sig
>  			return -EINVAL;
>  		}
>  		spin_lock_irq(&current->sighand->siglock);
> +		write_seqcount_begin(&ctx->cnt);
>  		ctx->sigmask = sigmask;
> +		write_seqcount_end(&ctx->cnt);
>  		spin_unlock_irq(&current->sighand->siglock);

This doesn't look right.

The problem is, the current locking is broken, ->siglock can not serialize
->sigmask changes. Just suppose the the child inherits sigfd from parent
and they both do sys_signalfd4() at the same time.

Nothing really bad can happen, that is why nobody bothers to fix this.
But this patch makes the thing worse, write_seqcount_begin() must be
serialized correctly.

Oleg.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-11-13 17:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-13 14:50 + fs-epoll-add-procfs-fdinfo-helper.patch added to -mm tree Oleg Nesterov
2012-11-13 15:53 ` Cyrill Gorcunov
2012-11-13 16:20   ` Cyrill Gorcunov
2012-11-13 16:49     ` Oleg Nesterov
2012-11-13 17:01       ` Cyrill Gorcunov
2012-11-13 17:14         ` Cyrill Gorcunov
2012-11-13 17:47           ` Oleg Nesterov
2012-11-13 17:53             ` Cyrill Gorcunov
2012-11-13 17:55             ` Oleg Nesterov

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).