From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751408AbdGRHsi (ORCPT ); Tue, 18 Jul 2017 03:48:38 -0400 Received: from mga11.intel.com ([192.55.52.93]:58939 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751334AbdGRHsh (ORCPT ); Tue, 18 Jul 2017 03:48:37 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,377,1496127600"; d="scan'208";a="288207018" From: Elena Reshetova To: julia.lawall@lip6.fr Cc: linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr, Gilles.Muller@lip6.fr, nicolas.palix@imag.fr, mmarek@suse.com, keescook@chromium.org, ishkamiel@gmail.com, Elena Reshetova Subject: [PATCH] Coccinelle report script for refcounters Date: Tue, 18 Jul 2017 10:48:30 +0300 Message-Id: <1500364111-2192-1-git-send-email-elena.reshetova@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The below script can be used to detect potential misusage of atomic_t type and API for reference counting purposes. Now when we have a dedicated refcount_t type and API with security protection implemented, people should be using it instead. Currently it still reports many occurences since we are nowhere near the end of our kernel-wide conversion execrise, but hopefully after couple of cycles more, the amount of output would be much more limited. Each script result must be analysed manually before any conversion, since refcount_t might not suit for certain purposes (for example if an object is not always destroyed upon refcounter reaching zero, if increments from zero are allowed in the code etc.) As we go further and get less results in output, we will improve the pattern to detect conversion cases more precisely. Elena Reshetova (1): Coccinelle: add atomic_as_refcounter script scripts/coccinelle/api/atomic_as_refcounter.cocci | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 scripts/coccinelle/api/atomic_as_refcounter.cocci -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: elena.reshetova@intel.com (Elena Reshetova) Date: Tue, 18 Jul 2017 10:48:30 +0300 Subject: [Cocci] [PATCH] Coccinelle report script for refcounters Message-ID: <1500364111-2192-1-git-send-email-elena.reshetova@intel.com> To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr The below script can be used to detect potential misusage of atomic_t type and API for reference counting purposes. Now when we have a dedicated refcount_t type and API with security protection implemented, people should be using it instead. Currently it still reports many occurences since we are nowhere near the end of our kernel-wide conversion execrise, but hopefully after couple of cycles more, the amount of output would be much more limited. Each script result must be analysed manually before any conversion, since refcount_t might not suit for certain purposes (for example if an object is not always destroyed upon refcounter reaching zero, if increments from zero are allowed in the code etc.) As we go further and get less results in output, we will improve the pattern to detect conversion cases more precisely. Elena Reshetova (1): Coccinelle: add atomic_as_refcounter script scripts/coccinelle/api/atomic_as_refcounter.cocci | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 scripts/coccinelle/api/atomic_as_refcounter.cocci -- 2.7.4