From patchwork Fri Sep 12 21:22:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 37367 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7FEF020C7F for ; Fri, 12 Sep 2014 21:22:44 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id p9sf795017lbv.4 for ; Fri, 12 Sep 2014 14:22:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=TJYeAGOIINN5jAF/qsr44+PXfsOP/Jeoysr0lA4za2A=; b=CeORxTDPLTu/bmplfKDCJoNYvYakBnc2LsnAaXLb/dd8IFPsmjiPKtCvjX6v+02iDi FjPfchRGYnT8RCD5owcCIYK08ivKCYFBvP/STEEE4VTGLmwu98YE3LUzkxcWQO1C6Qao ABDI2gfQ8djkKvFRVlWQr7jile1NJx3JfRkHir9NCyKgWiibdmmGRwfRBt2pfnKMbhog OMY7ZrvP18R3l0JdXDDESQLxoFAJj98GRaZ+a5ihErP4sqUVMJTU76OMxp8ggricBSp8 iSY+YNkqj5OiPLzd/ZnX/3zx8SwuwK6tJR7w+VxiZFBh2/yEbfeB3DB7C4BxPSXk10/k 0k8w== X-Gm-Message-State: ALoCoQlWuPslslnh9KbQI4FO6AtkcnPUhP965hg8TcbLLgBWgW8R/YNgm9SvtPGt75ou7ccKmNFW X-Received: by 10.180.12.229 with SMTP id b5mr1409513wic.2.1410556963341; Fri, 12 Sep 2014 14:22:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.224.129 with SMTP id rc1ls199119lac.55.gmail; Fri, 12 Sep 2014 14:22:43 -0700 (PDT) X-Received: by 10.152.21.6 with SMTP id r6mr11888681lae.6.1410556963091; Fri, 12 Sep 2014 14:22:43 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx.google.com with ESMTPS id u1si8379110laz.81.2014.09.12.14.22.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Sep 2014 14:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id ge10so1700588lab.41 for ; Fri, 12 Sep 2014 14:22:42 -0700 (PDT) X-Received: by 10.112.33.74 with SMTP id p10mr11168099lbi.0.1410556962760; Fri, 12 Sep 2014 14:22:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.141.42 with SMTP id rl10csp809194lbb; Fri, 12 Sep 2014 14:22:41 -0700 (PDT) X-Received: by 10.70.36.138 with SMTP id q10mr12660382pdj.88.1410556960852; Fri, 12 Sep 2014 14:22:40 -0700 (PDT) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id x13si10236126pas.83.2014.09.12.14.22.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Sep 2014 14:22:40 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.46 as permitted sender) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id kq14so2099792pab.33 for ; Fri, 12 Sep 2014 14:22:40 -0700 (PDT) X-Received: by 10.66.174.17 with SMTP id bo17mr15624364pac.98.1410556960156; Fri, 12 Sep 2014 14:22:40 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id p6sm4225878pds.13.2014.09.12.14.22.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Sep 2014 14:22:39 -0700 (PDT) From: John Stultz To: lkml Cc: Richard Larocque , stable@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Richard Cochran , Prarit Bhargava , Sharvil Nanavati , John Stultz Subject: [PATCH 3/4] alarmtimer: Do not signal SIGEV_NONE timers Date: Fri, 12 Sep 2014 14:22:23 -0700 Message-Id: <1410556944-14944-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410556944-14944-1-git-send-email-john.stultz@linaro.org> References: <1410556944-14944-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Richard Larocque Avoids sending a signal to alarm timers created with sigev_notify set to SIGEV_NONE by checking for that special case in the timeout callback. The regular posix timers avoid sending signals to SIGEV_NONE timers by not scheduling any callbacks for them in the first place. Although it would be possible to do something similar for alarm timers, it's simpler to handle this as a special case in the timeout. Prior to this patch, the alarm timer would ignore the sigev_notify value and try to deliver signals to the process anyway. Even worse, the sanity check for the value of sigev_signo is skipped when SIGEV_NONE was specified, so the signal number could be bogus. If sigev_signo was an unitialized value (as it often would be if SIGEV_NONE is used), then it's hard to predict which signal will be sent. Cc: stable@vger.kernel.org Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Sharvil Nanavati Signed-off-by: Richard Larocque Signed-off-by: John Stultz --- kernel/time/alarmtimer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index b4bce62..41a9253 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -466,8 +466,10 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, { struct k_itimer *ptr = container_of(alarm, struct k_itimer, it.alarm.alarmtimer); - if (posix_timer_event(ptr, 0) != 0) - ptr->it_overrun++; + if ((ptr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) { + if (posix_timer_event(ptr, 0) != 0) + ptr->it_overrun++; + } /* Re-add periodic timers */ if (ptr->it.alarm.interval.tv64) {