From nobody Wed Apr 8 09:41:54 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A824EFA373F for ; Mon, 24 Oct 2022 20:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232060AbiJXT77 (ORCPT ); Mon, 24 Oct 2022 15:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233818AbiJXT6o (ORCPT ); Mon, 24 Oct 2022 15:58:44 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7DC228511E for ; Mon, 24 Oct 2022 11:21:22 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id y143-20020a626495000000b0056bae530d80so2145463pfb.9 for ; Mon, 24 Oct 2022 11:21:22 -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=kzKQRTEXGqt08SGBdEhLKezf4NlN9FWNmZKirRw+wNE=; b=iiTJs0VEY07rTilwdAieFazat3VOy+LVzf466jKCU8DFFU3klelDhVQh411e4Fda+W LEuRBdu5LJXJRND4MI9Z5m59FiS19f6TSE25O5r/TPPn58S5GgDVU2YAsHHigzmAWW5K S2L4iZahsiLBOs9YUXiczWeQG9G/+qNfojh8Pd/yuqpT87M8udlLSpbpVUSicv0UHszq WUC47j2oZTq+UOoaGTGgbZVfAe28njxnsOhstYgGz7teIVnuNOE0Ee/PTTIqj/WNedF0 sO0lxWfViGHOR2aRo/LnNfYE+7oupjVOGaFuOzh2y2uR4Gco+sfFuu/ErLgbWtfKNyQm 8Vtg== 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=kzKQRTEXGqt08SGBdEhLKezf4NlN9FWNmZKirRw+wNE=; b=JMG0Pus4feu8g/HKEGa6hBeSUfh/8hHszP++0Pnhj3SKl/rKEIWjaN5/XansuqykPI VU0QBGOi+RQTYK5jlp41ygSr7iuPWD2JxusBexcyDrhfW+egUj8fSgq0Y/UA5ERae9Mw CQCk5OABp9avIG4d3ZMHnBsvj/0zjVByAw48vn74f6FPGxTQlKF6FoNiiB8EbfjbsfU7 xaieAjemOv1e1TRjW8SYycRSRxTkORIGeStDi06I4bvj56mBgO1W/iiy8+sqRI4ew4YE EK3XfHunJBXeycjwXKs95UVfG42vszNHHXuWQ2daPMEz8FuFbQ+/dBn40pgoLmO2Ze7J +K8Q== X-Gm-Message-State: ACrzQf3+/5JZPZn9w4IlH+LX9IjnnlAD9EHb7S03hC/RIGckw7ISNnUd qIMQkytJV4xuZmZAA0hdgVT5Mew0XR+L X-Google-Smtp-Source: AMsMyM4Ejr4u/zJQD1O1ntbW0fysOW1g8lIqixCh7xH5QCVGq9vEZLSvDzrM54rVza3CoTeOfEI7YSgyWHdA X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:b8bc:a57d:a2a2:efdc]) (user=irogers job=sendgmr) by 2002:a65:4943:0:b0:46e:f5e3:3e94 with SMTP id q3-20020a654943000000b0046ef5e33e94mr7928144pgs.75.1666635634101; Mon, 24 Oct 2022 11:20:34 -0700 (PDT) Date: Mon, 24 Oct 2022 11:19:12 -0700 In-Reply-To: <20221024181913.630986-1-irogers@google.com> Message-Id: <20221024181913.630986-8-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 7/8] perf top: Use sig_atomic_t to avoid UB From: Ian Rogers To: Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Alexey Bayduraev , German Gomez , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stephane Eranian , Ian Rogers Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use sig_atomic_t for variables written/accessed in signal handlers. 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 --- tools/perf/builtin-top.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 4b3ff7687236..bb5bd241246b 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -87,8 +87,8 @@ #include #include =20 -static volatile int done; -static volatile int resize; +static volatile sig_atomic_t done; +static volatile sig_atomic_t resize; =20 #define HEADER_LINE_NR 5 =20 --=20 2.38.0.135.g90850a2211-goog