Message ID | 20221024181913.630986-4-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp632256wru; Mon, 24 Oct 2022 13:11:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hCUKmG+aqvHWA57CGuaP052W11KIcIvHNebKYuJJM8erjwlukve8NiphfF6bKFiqvhqIf X-Received: by 2002:a17:907:3e06:b0:733:693:600e with SMTP id hp6-20020a1709073e0600b007330693600emr28202294ejc.410.1666642267777; Mon, 24 Oct 2022 13:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642267; cv=none; d=google.com; s=arc-20160816; b=ng9BDdccPFbYouBTfub0gK8GoEtqLIr1V/NaIzKu/BydhxKqaLbLnBr2etbgpuwWJs LhHjEBaTVe6SQuprJZUK3cLSQaJatMcJ5uX6751n+v1fAvq1TcTJt9tupELtIpzilBLG 3Xx3L306p87Rr6crpDU1yekPXTyLTt9BjnWuIRJDsoNq0U9wWWcpG9K5mfVst93odsI6 qpVYmDskqiRoQVDfIX1W9aTdKorcJCIslT8lKl9rvA48Bcz9VqOoHUQcNTw4vePnhsmZ 45jWnf64pIvgC9vSiB8eQCHprKSUpC5dUrpbc72RJwgbIkfDCXiiA1S4kehqy2XleF6x nhOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=JoX+rXrU6K8JU7iZ2f6KugPkmXCVMdf9ZXNzq+WXZng=; b=qDuNjxwcwmyaF9LRhXVHmfDim/s7gK4Deowdnluzl2pngWU5y5caX20bMEPSRtEl0I nrcMrTf0A+rUHqtOHJCu7VygYv3Yi4K30BcMMAFaTg0e/14+briM8+iq+aT2pg/rTD1v AGl1O1Oqe0xqIv5ExWIfmtxYxXcn9c+NJ0vBJTuRADxaXvk7WrRY5IOKPkxVZ/BqCmfL Z/aJWFcxes2tdzsub78gLaqXsxOtIdgy79oOr5bgpUMnAZXKLj0vwV/Pt02UF+UcmYr/ 921WsrjYv/ij33d5kEUWHYn9KSxn68jBfcRqj/QUO8Gt5UPfVxwKTt3XV2S5xiEUkZBQ /AiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PfDJLEVQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb6-20020a1709071c8600b0078dcee0cf13si636662ejc.561.2022.10.24.13.10.42; Mon, 24 Oct 2022 13:11:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PfDJLEVQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233940AbiJXT6s (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Mon, 24 Oct 2022 15:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbiJXT6V (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 24 Oct 2022 15:58:21 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA7F1D2B64 for <linux-kernel@vger.kernel.org>; Mon, 24 Oct 2022 11:20:49 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id j12-20020a63594c000000b004468ff8fc78so5038411pgm.10 for <linux-kernel@vger.kernel.org>; Mon, 24 Oct 2022 11:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=JoX+rXrU6K8JU7iZ2f6KugPkmXCVMdf9ZXNzq+WXZng=; b=PfDJLEVQTdoSZljLCftkKuXa4vHopLYHW+Zs+nAdnw9TlLOLf0h8zJ4UAoR/va/HTR sHI5mvAdv8WI9Esx2Hjez50/j5mBeOzp1EIRDJljrTzVizQiItYexTMX21rnSWlM11lQ z0ASHmhiCbvWXv+tdJ/n8B/rCosqMKyI+ttlXWe54G0sQsvhwzvMffRPFfuukJXfiSEW EF64a1r4+3KyRVosZ80wWMwumtN1UytVZRSLR8sB9lzHxQaMtG5msBH27OC97WnwY6vl jmojGGz0FWrjFDgGqxYlqab+Iigjjw1wJkiKE31bCXFqLRU3r7rx59vEFgTvD/vxguQ9 qzLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JoX+rXrU6K8JU7iZ2f6KugPkmXCVMdf9ZXNzq+WXZng=; b=I5djfFlTWO5/PgVepa6gUfNaA8qz9eH1cT1mGjO2DmFuDear4LXeuo31VFpQkkxq2f u+hsNYh0BgO+QxGKwgAxeIzZfJBSw8/V6Y3fPO5s/GAiD2HmVFlBs2dn/nzCNV7Oixc2 pIL5rNC7VoJvmVRAkcpoWKSjdSl2iF+ltJQ1+iCxq8diP3aNv88YnS5hbH996aXCQJKV lgOwTYEeb3rV5p6ZV6OZg9ysHThbFfaj+LFBDarvA1XnIS24ab+d+a5nrV0l7PFcXMAY qpblZWkLeDErvT6La+WoY6KcefGV+u1fbJcZgoJakqrw+0hG+4P6Is2oG9Y61HQ81X0+ Zp0g== X-Gm-Message-State: ACrzQf3Q83fADW5FImnqheAkUIKRJoC8eOiwJDscnDjlgBxSDZgRrHFm HBHxMzmqEPaBkZ0rd88o4p6sC0aTgybr X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:b8bc:a57d:a2a2:efdc]) (user=irogers job=sendgmr) by 2002:a17:90a:5892:b0:20a:9cf5:c13c with SMTP id j18-20020a17090a589200b0020a9cf5c13cmr75024424pji.63.1666635598568; Mon, 24 Oct 2022 11:19:58 -0700 (PDT) Date: Mon, 24 Oct 2022 11:19:08 -0700 In-Reply-To: <20221024181913.630986-1-irogers@google.com> Message-Id: <20221024181913.630986-4-irogers@google.com> Mime-Version: 1.0 References: <20221024181913.630986-1-irogers@google.com> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog Subject: [PATCH v2 3/8] perf daemon: Use sig_atomic_t to avoid UB From: Ian Rogers <irogers@google.com> To: Leo Yan <leo.yan@linaro.org>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Adrian Hunter <adrian.hunter@intel.com>, Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>, German Gomez <german.gomez@arm.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601082593910186?= X-GMAIL-MSGID: =?utf-8?q?1747601082593910186?= |
Series |
Update to C11, fix signal undefined behavior
|
|
Commit Message
Ian Rogers
Oct. 24, 2022, 6:19 p.m. UTC
Use sig_atomic_t for a variable written to in a signal handler and
read elsewhere. This is undefined behavior as per:
https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/builtin-daemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c index 6cb3f6cc36d0..aaa47d721ae7 100644 --- a/tools/perf/builtin-daemon.c +++ b/tools/perf/builtin-daemon.c @@ -105,7 +105,7 @@ static const char * const daemon_usage[] = { NULL }; -static bool done; +static volatile sig_atomic_t done; static void sig_handler(int sig __maybe_unused) {