From patchwork Mon Oct 24 18:19:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp632160wru; Mon, 24 Oct 2022 13:10:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zBszhq2CnaFEu3K9v7NeE0uVS3qN8rn/M42R3LA8MmZuKngoF4K4mAUbr5gE4MjqjESo4 X-Received: by 2002:a17:906:8a47:b0:7a3:86dd:d33b with SMTP id gx7-20020a1709068a4700b007a386ddd33bmr9955864ejc.67.1666642252194; Mon, 24 Oct 2022 13:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642252; cv=none; d=google.com; s=arc-20160816; b=0V5KfKdbpuhRS3+X1kWeYFWF6gtwZMbvd16IdiTglW1HckZdOHBHLOtI3Jy6lvSevo gUUndUZZNTL2al6VbUWgoJDiJIdL0okI70qBWs4Dk9V2m0kUWOwTNf85RC6CpSZM2tyu p+zvZNNlQ04N87L6eojIc1v3TE63Mu/yV4oe80UVZDYYCAYqNDuzLN+qru7RaVr9Qb8h KQMOOcKc1/RaAHQXmDZ7Fxu08HTwfQ1RCzRvP1dwbUnB7uh59ZiLwuQeihb2CDT06TKW nb3cW1HmtHMFqBSv9tnSqG7tTRjx0mzpWcaPQ0sVrlNSJTvE6V4NqxDzrtDFC9KgHOGy li8w== 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:mime-version:message-id:date :dkim-signature; bh=OdPpZnwd5jRn69z8VmyRRXOs+WnLWZPFgd+7/iBzwHk=; b=qxCNSWJ3hU6DZGiLyBEbRcYpF3g4UZxX++q9IwjVlqgWCDT3Ah8wWqxFxyHuzzP/RU eR1gksDJPIdcx/flUYnOUK7IcNkZDJ16oUgpQQeuBIuzdrUE5ZVhoV2oz638Llo67oSs CQ0K3fJCOs6sLxy7ItPoHJ6XBB9a04Y6IViU3+ZhfjnX25xft/2fRKVl4KKqljhVy9dz urQERhXCiW09eG0twWUnYnXLKHN/RgFf/Uil6uZXwZ47eOiLYX8rECWRvc7XIKITqW65 f7eDu0yHUzNLN536Zq3W/F/2VDiBtXEE8fmmU3DMSQM6VF1PzUPP2JnNFtA9+F+gnk3P zwlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=NfrgsUTi; 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 sg13-20020a170907a40d00b0074168953071si650335ejc.866.2022.10.24.13.10.27; Mon, 24 Oct 2022 13:10:52 -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=NfrgsUTi; 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 S233903AbiJXT5p (ORCPT + 99 others); Mon, 24 Oct 2022 15:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233896AbiJXT5S (ORCPT ); Mon, 24 Oct 2022 15:57:18 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78ACBED9BA for ; Mon, 24 Oct 2022 11:20:24 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id c91-20020a17090a496400b00212eb50e75cso1903552pjh.6 for ; Mon, 24 Oct 2022 11:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=OdPpZnwd5jRn69z8VmyRRXOs+WnLWZPFgd+7/iBzwHk=; b=NfrgsUTi4AApD9BZxfhAegOIzfnADBYbmqWCGsTBOOc7z6DCGVA6S5DGI56c3/0HTK 3BuxuXx7aAY92LOmjN8o6+cd2dWG2ItvAJs2cNSk/KXbYeoUybsaEXziRA1t0YN6Io53 Vg1GCS1dJ4xCUUxB6HolGFsWwaXlY9IllaWJonUcug574p7flVeJc9EgvgLtCaV/DXb5 rNPH89aOcXb8wQjOZuw7PvPeSOKL3r61V8Em7fupmdz6/IberQWfB3vrQgONNxqTBR5a XVYq31YpR56iR0tRAxHK9QXbEYG+HLkoRNnoCIcdT4wTqMABZL528o45hcEMERtSsoqC iF4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OdPpZnwd5jRn69z8VmyRRXOs+WnLWZPFgd+7/iBzwHk=; b=xFmFdAB4H+NTzU2BlZHwHhpLriupQqaJG+Cc8v2/hNTXR2XsxyAkoRb7SyK8CBag5M 7M8/DdgxbKgxLXspV+D2ci1+6bfk/+KTSVxk+WeBXG3vG5TUMLUuwCwYZku36W7ImWin PjWL55KuQ3zRThXxZ2xQRgJ1PdlF3fR1yOS+U9nANuwBHNNtNEMhMvl9flse1BrTNWtQ dyArx4Qz88Bt0yBCK6DbcSWmwQbufifwJ3gnMoz5cQHbS63O1a+V9RYCxGNkB/MEv1HB 2OyJ19tW5wSsrNTpDfQJikV3HRfuvxwSCBBzvRGzclzjH4PVmKBDnzy4pIxeuh6QkGK5 kZ0A== X-Gm-Message-State: ACrzQf0jitgSqXLeDUwUwZuikBcCfugfrKRcwQIoD2/AFajhkVfJ5B28 +ew0JVgeeZCXW04Mu+xQfjqDUHS0crwz X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:b8bc:a57d:a2a2:efdc]) (user=irogers job=sendgmr) by 2002:a17:90b:e90:b0:213:2708:8dc3 with SMTP id fv16-20020a17090b0e9000b0021327088dc3mr247684pjb.2.1666635575295; Mon, 24 Oct 2022 11:19:35 -0700 (PDT) Date: Mon, 24 Oct 2022 11:19:05 -0700 Message-Id: <20221024181913.630986-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog Subject: [PATCH v2 0/8] Update to C11, fix signal undefined behavior 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 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=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747597294903479391?= X-GMAIL-MSGID: =?utf-8?q?1747601066089965266?= The use of C11 is mainstream in the kernel [1]. There was some confusion on volatile and signal handlers in [2] for which atomics (present in C11) make things clearer. Switch to using volatile sig_atomic_t as per [3]. Thanks to Leo Yan for the suggestions. [1] https://lore.kernel.org/lkml/CAHk-=whWbENRz-vLY6vpESDLj6kGUTKO3khGtVfipHqwewh2HQ@mail.gmail.com/ [2] https://lore.kernel.org/lkml/20221024011024.462518-1-irogers@google.com/ [3] https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers v2. Remove unneeded stdatomic.h includes for sig_atomic_t as it is declared in signal.h. Ian Rogers (8): perf build: Update to C standard to gnu11 perf record: Use sig_atomic_t for signal handlers perf daemon: Use sig_atomic_t to avoid UB perf ftrace: Use sig_atomic_t to avoid UB perf session: Change type to avoid UB perf stat: Use sig_atomic_t to avoid UB perf top: Use sig_atomic_t to avoid UB perf trace: Use sig_atomic_t to avoid UB tools/perf/Makefile.config | 2 +- tools/perf/builtin-daemon.c | 2 +- tools/perf/builtin-ftrace.c | 4 ++-- tools/perf/builtin-record.c | 8 ++++---- tools/perf/builtin-stat.c | 8 ++++---- tools/perf/builtin-top.c | 4 ++-- tools/perf/builtin-trace.c | 4 ++-- tools/perf/util/session.c | 3 ++- 8 files changed, 18 insertions(+), 17 deletions(-)