Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1100362imm; Thu, 5 Jul 2018 14:51:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdGNgZsamkgu+cV1cri86DMOhZuAcU5rrTigVmALlEahF3OAmPkklB6RgMf8uT7FR8HASc7 X-Received: by 2002:a17:902:758c:: with SMTP id j12-v6mr7757297pll.195.1530827513322; Thu, 05 Jul 2018 14:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530827513; cv=none; d=google.com; s=arc-20160816; b=E8lsYKXsuMHoMvwpTk25kdL+L1HR7374yCfYt5BNjjuzdV7au8bPkzhceY6lz9iNyz mo1JWz/i+ebC+jAMrfxMKr+LGGLUVLJ8aRz9wwB0tL2uulAQuCKEvr4ITsRvce1wmQzk vuDP+5STTlqe7tNXdD11VFxQu/Cg2rfHsPLtdOi6f54a1kErtBEcdNfy5omNuB7l+lE7 VsrbHvTFN8vm3On8tOHXrk7gKHOwqJ3IYe71D4+dtTsHMVe8CYrSX1tQBWis5Rx6DgjE Pl6Ir9/AyDks7xYcOODM1O1vZa8E2mHX7PpUz/5Z12QDJn03Qgo5LxKqS3aU11QUPjb7 6Xqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=F8zb7TvOs20RFknCCE0GmDlgDdCZ6yE6VnVyAHS+lFk=; b=WkYsqPhHOpKOjwI8eq9o5eI2O9or6gnKhMzJBGpxlxk1MYgncSjuADfQjgW7R01Ehh RIJLpI6r+apaVegouOaBvZoUQ5GwV6P9fb8jhpI+3VfLpn6hX3RmscCIkC8lYSrXwDXs NF0XQ08+J9o1/aDRW86orCzOUKniKjuJ5h0KkHzOPeqa11EnydbZ4N516JEriflA9ufj ljtz6Pmx7WMYQNbupn+Na4JDjlalT7Qceu1kTECwXn0XsLLtcFzwF5q31YkDwtRh3u72 aaU7Q5pLBzp22z4APThEusBA6/Rh0dWoKCeoOMzwMEawumK0JynwyCwyGUOV7CyQrTNa J7dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="IiNl/6ik"; dkim=pass header.i=@codeaurora.org header.s=default header.b="IiNl/6ik"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si6538433plj.411.2018.07.05.14.51.39; Thu, 05 Jul 2018 14:51:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="IiNl/6ik"; dkim=pass header.i=@codeaurora.org header.s=default header.b="IiNl/6ik"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753776AbeGEVtb (ORCPT + 99 others); Thu, 5 Jul 2018 17:49:31 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:34152 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753186AbeGEVta (ORCPT ); Thu, 5 Jul 2018 17:49:30 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CC93460251; Thu, 5 Jul 2018 21:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530827369; bh=3MiJ/T1V8cJdhyV/qedU4estdCBgqNeAiQ5rF4xTxkk=; h=From:To:Cc:Subject:Date:From; b=IiNl/6ik5UY8EUKZwvvI0kjxYry3atR9X17/PpLBNmAUaBYXR/Wlq4mo1xiq56igp 0hdJBeb/aq8uWL7ekT4cUzErKBl9IzyOgImuSAiSiYWEWdZRs3jpfi9hSDfjNCZ6+5 6wcx06PPIt/Zkj4z3qPd/L7D/YSBY6wv0mr3TkXw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from pheragu-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pheragu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E4AD960251; Thu, 5 Jul 2018 21:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530827369; bh=3MiJ/T1V8cJdhyV/qedU4estdCBgqNeAiQ5rF4xTxkk=; h=From:To:Cc:Subject:Date:From; b=IiNl/6ik5UY8EUKZwvvI0kjxYry3atR9X17/PpLBNmAUaBYXR/Wlq4mo1xiq56igp 0hdJBeb/aq8uWL7ekT4cUzErKBl9IzyOgImuSAiSiYWEWdZRs3jpfi9hSDfjNCZ6+5 6wcx06PPIt/Zkj4z3qPd/L7D/YSBY6wv0mr3TkXw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E4AD960251 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pheragu@codeaurora.org From: Prakruthi Deepak Heragu To: apw@canonical.com, joe@perches.com Cc: linux-kernel@vger.kernel.org, ckadabi@codeaurora.org, tsoni@codeaurora.org, bryanh@codeaurora.org, Prakruthi Deepak Heragu Subject: [PATCH] checkpatch: forbid filesystem accesses from within the kernel Date: Thu, 5 Jul 2018 14:47:50 -0700 Message-Id: <1530827270-19947-1-git-send-email-pheragu@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As use of sys_open/close/read/write system calls from within the kernel code is inappropriate, an error is triggered if used. Signed-off-by: Prakruthi Deepak Heragu --- scripts/checkpatch.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a9c0550..e6e7e09 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5372,6 +5372,13 @@ sub process { "Avoid line continuations in quoted strings\n" . $herecurr); } +# sys_open/read/write/close are not allowed in the kernel + if ($line =~ /\b(sys_(?:open|read|write|close))\b/) { + ERROR("FILE_OPS", + "$1 is inappropriate in kernel code.\n" . + $herecurr); + } + # warn about #if 0 if ($line =~ /^.\s*\#\s*if\s+0\b/) { CHK("REDUNDANT_CODE", -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project