From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757810AbYEQPP3 (ORCPT ); Sat, 17 May 2008 11:15:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758455AbYEQPOS (ORCPT ); Sat, 17 May 2008 11:14:18 -0400 Received: from x346.tv-sign.ru ([89.108.83.215]:47559 "EHLO mail.screens.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758028AbYEQPOQ (ORCPT ); Sat, 17 May 2008 11:14:16 -0400 Date: Sat, 17 May 2008 19:14:22 +0400 From: Oleg Nesterov To: Andrew Morton Cc: Austin Clements , Ingo Molnar , john stultz , Linus Torvalds , Michael Kerrisk , Roland McGrath , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] posix timers: use SIGQUEUE_CANCELLED when the timer is destroyed Message-ID: <20080517151422.GA9502@tv-sign.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change goes as a separate patch for documentation purposes. Suggested by Linus Torvalds. Fixes the problem pointed out by Austin Clements. Currently, when the task execs it could be killed by the fatal signal sent by the posix timer, because exec flushes the signal handlers. See http://bugzilla.kernel.org/show_bug.cgi?id=10460 This is a user visible change. With this patch sys_timer_delete() discards the pending signal which was generated by the timer. This change goes as a separate patch for documentation purposes. We have many options how to set SIGQUEUE_CANCELLED while detroying the timer. We could set this flag in release_posix_timer() before calling sigqueue_free(), or add the new "int cancel" argument to sigqueue_free(), but since sigqueue_free() plays with q->flags anyway and nobody else uses this function, this patch changes sigqueue_free() to set SIGQUEUE_CANCELLED unconditionally. Signed-off-by: Oleg Nesterov --- 25/kernel/signal.c~6_USE_CANCELLED 2008-05-17 17:40:09.000000000 +0400 +++ 25/kernel/signal.c 2008-05-17 18:07:10.000000000 +0400 @@ -1246,7 +1246,7 @@ void sigqueue_free(struct sigqueue *q) * __exit_signal()->flush_sigqueue(). */ spin_lock_irqsave(lock, flags); - q->flags &= ~SIGQUEUE_PREALLOC; + q->flags = SIGQUEUE_CANCELLED; /* clears SIGQUEUE_PREALLOC */ /* * If it is queued it will be freed when dequeued, * like the "regular" sigqueue.