Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1634880pxy; Thu, 6 May 2021 11:59:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQLIMxAyb35VKWOqo/c5w3kGqMtLyRyzgM4LRp/VIWed+ft0cv1Rc8waJbS8q+4lss4AyF X-Received: by 2002:a17:906:2da1:: with SMTP id g1mr6110431eji.47.1620327556016; Thu, 06 May 2021 11:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620327556; cv=none; d=google.com; s=arc-20160816; b=N7MryW4onWmR8QK4S515KFN8+ZLvzUyk8eYRROJFmWJK7F4S1RremOHNsuxcxAYrzV z2GLtKLoWOLxccU8eZl26UV6bPQBvpca6qeTl/blfvWu4jWDSai/YGHZYpb5sgYDoIS4 YhfMI4jr8FDfZVdwMXi21vvOWLRfvSrA8DAXfKCk7XrmKbqREFwQcxez6X5cnYOsGeQD uavntrkrmYTMfKyHVyvoys60D6t76nFECXH0YnMRiptmi8ay3w38cZfSrgrXv3qCuApK kZfNGqECDB/AYQy4FY4+hDxPV+M9eu9UKKHz+4JGIeUnQmzUP1Mxvx1C+Xz1zGMgkXmh SQZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2eT0MKbpTIaqZ/oJJXKFKrCsA1epQVqWlKwWBElbZrI=; b=wZjjLnzgtz+Di96lAs4+KDkgpQzShKGgkoI/DN5EIqEjs1UOtNfm/odDla+yLf3i4T kLaz8cn8DajpeXmNgfRrWC5IcuKGjrIOit6c6hdGHdpN9oS0YXNRPaXxA7WQsGH5tgKs /L2ZuFlvIFm74louJV1+AAR9KsTOUTRiqtSODthxA83yW10sIiZjczuc7/VaAwTj5EFO 9kjk2fDv/Ja05aPKtVDFL7nzXQUyA4wNDEP1msQTVmfsLJCStbCKcIhM+hKu3bXtNmlC mGl2AA/iD6ULk4ESDEE3Uu4iAfR2EW/RWuUVjrUUMfujz/sC0BnfNgxmvC9sWt1zbuTh BOog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a7ldHXxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fi16si3213174ejb.693.2021.05.06.11.58.51; Thu, 06 May 2021 11:59:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a7ldHXxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235030AbhEFPD5 (ORCPT + 99 others); Thu, 6 May 2021 11:03:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235027AbhEFPD4 (ORCPT ); Thu, 6 May 2021 11:03:56 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68771C061761 for ; Thu, 6 May 2021 08:02:57 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id z9so8208214lfu.8 for ; Thu, 06 May 2021 08:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2eT0MKbpTIaqZ/oJJXKFKrCsA1epQVqWlKwWBElbZrI=; b=a7ldHXxoGJnYNifiZFiaxOjvVn6lCQYNc72X7fa0fLXdEMl6UAuoTYpXrDwmE9jBT7 XKPbiZ/688M3/5xT/QfLV94WByJWGbYvysZ2LYMsn/X09wjxinSg1Rx0xbChxr2ZQFnO eiS4IjAHijBkkhUFl9IX6+9htSmuCaeTG9+dpkO51q2Kf3xj/UQc9RxzpENnqmtmVstH L6N5ldxYfeTXr76Xe+pNhBRdSae1aatUdJkIVx/LTHTApRT0m3BBY1X7PGlTKKTqKEpS jafv7TdJPCa2Mz0WqcPPbShcFei6f75ULekI9DJoiHzO7YMHsn2hwPWhLPnLQfiOnZpE y+XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2eT0MKbpTIaqZ/oJJXKFKrCsA1epQVqWlKwWBElbZrI=; b=psfLq532A5jrURw0bsewrP/EkQC8zIE+OvcRy12/6pHc0pfRXzcy91MvVVj5xePB6u uXVpmarDwTpwcxjAyBpCBBuKjrEQqQMEIhgP1i+PKicMk3nKGr51evzXxVivbMGdkTaF fcW6X3jn3+tVRL55YgLQ/BKc9h7B+tO5rtGcEl90q151ut2VWVeKQ+g5ZtyrY+i35fBE NFv8Qx+s0sRZ4T+C5izTpbtRzPaLAvwIDXPoVLftEZxGkaq0UnpraOeSZsx10RLCKjue FvL4nUis2qKUWUKvM4nnLuAK18TRS68bGO6X3pjRHbWM40DcOsM3GGbmQvt2F4+C68tB K7Xg== X-Gm-Message-State: AOAM531qB5uc+JgP5lIEf2rUs7DZWt7ZcQZkx5qcdnQuErxGMTt8dzta n/YjVMhoviaCkV5/UuBLHS78LmnDJpZ6Tkd4nUA= X-Received: by 2002:a05:6512:1190:: with SMTP id g16mr3486886lfr.342.1620313375599; Thu, 06 May 2021 08:02:55 -0700 (PDT) MIME-Version: 1.0 References: <20210506132827.3198497-1-elver@google.com> In-Reply-To: <20210506132827.3198497-1-elver@google.com> From: Dwaipayan Ray Date: Thu, 6 May 2021 20:32:43 +0530 Message-ID: Subject: Re: [PATCH] checkpatch: warn about direct use of send_sig_info and force_sig_info To: Marco Elver Cc: "Eric W . Biederman" , linux-kernel , Andy Whitcroft , Joe Perches , Lukas Bulwahn Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 6, 2021 at 6:59 PM Marco Elver wrote: > > Setting up siginfo and using send_sig_info() and force_sig_info() > directly is discouraged. Instead, new code wanting to generate signals > should use the appropriate helper specific to the signal. > > Eric mentioned that he'd like to make these static at some point, but > until that can happen, let's try to avoid introducing new users of them. > > Cc: Eric W. Biederman > Signed-off-by: Marco Elver > --- > Eric, > > While siginfo doesn't need changing often, when it does, it's quite the > adventure. We now have the various static asserts. The other thing is > usage of {send,force}_sig_info. > > I think the best option right now is to teach checkpatch.pl about it > until they become static. > > Fyi, I noticed one such new user here: > https://lkml.kernel.org/r/20210421024826.13529-1-wangjunqiang@iscas.ac.cn > > Thanks, > -- Marco > --- > scripts/checkpatch.pl | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index ccb412a74725..3a86aafc3bcd 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -7153,6 +7153,12 @@ sub process { > "Where possible, use lockdep_assert_held instead of assertions based on spin_is_locked\n" . $herecurr); > } > > +# check for direct use of send_sig_info(), force_sig_info() > + if ($line =~ /\b((force|send)_sig_info)\(/) { I think this might be a little better as: if ($line =~ /\b((?:force|send)_sig_info)\(/) { Otherwise it's good as it is. Tested-by: Dwaipayan Ray Thanks, Dwaipayan. > + WARN("USE_SIGINFO_HELPER", > + "Where possible, avoid using '$1' directly and use a signal-specific helper setting required siginfo fields (see include/linux/sched/signal.h).\n" . $herecurr); > + } > + > # check for deprecated apis > if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) { > my $deprecated_api = $1; > -- > 2.31.1.607.g51e8a6a459-goog >