Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1104555imm; Thu, 5 Jul 2018 14:59:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdcysqKXX18E1U6W3kzXKgO9Mi/Nm4wbGcjuZ1aragPlSqVpQdg8g6ntu29DqxqcnRVpBe5 X-Received: by 2002:a65:4545:: with SMTP id x5-v6mr7102947pgr.4.1530827950233; Thu, 05 Jul 2018 14:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530827950; cv=none; d=google.com; s=arc-20160816; b=h8I3mvX0buL4iNs2CY58iIjRZqqKhmaIDrpjJDcMqVwmeSiTQo5ApjroLpQMynisBA 8tria10L63k+DNY7FZU6g4OXsVXwVxxMmJMx290XI3N6LQ57joAu3mEpZB36USlUR3SY LtFtHjpINQ/2Z35fNbKDXtiDsCRJwzi6aQCMUSY1hJ3cfaJ0SX4L+iTRS46bsy2Pzg/t BxFXavBe75H/gL19CAnvuLSlvOTiVubwEcy5uk1UOnXKeUUxbUDj4M45zOcaAWFAee1/ hOs3QsKd6GHjFdoj1W3Q6zGKSaivbXY5AkdFaEH7y6oSmNfBM/pp1xENZ2wv7uxlNBJz DbKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=CgHnSxMFbTZICE58GLzNReqy4CR6XyRl5WohWqGpPKc=; b=BSFd3CVuEvGr9lki2U+sUyEq5i+R/OY/jQp20jijxz93vRaBxGw6c0DYH9CgAsBoYV PEoQ3o2mAYH5Iffw7JIcxd2J7HzUM8XChjOBhsWTKi12zP26ApEATuPkilJyaovCNxQE 5JQ+ZgZN1yI1EYSeunWyV7BF+Tx0AE6TeoqjzR6U/RaS6yzNQiqLyoYediYkmM8GJyEe SgG0xaAc3mIHf5kD2HUN5XHoOkgIuD3mQcAblZyWGfa6zd1dn7OcNgdbTa7H5gsejQQu lJTsz03nm4Bdc9LQ6RwQAYbjBD6TmGGybiiBnhlDDm/LYlbtLVanHwbEuIG5y+lVldPg 1uAA== ARC-Authentication-Results: i=1; mx.google.com; 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 x9-v6si6412253plo.368.2018.07.05.14.58.56; Thu, 05 Jul 2018 14:59:10 -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; 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 S1753579AbeGEV5r (ORCPT + 99 others); Thu, 5 Jul 2018 17:57:47 -0400 Received: from smtprelay0008.hostedemail.com ([216.40.44.8]:44877 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753432AbeGEV4X (ORCPT ); Thu, 5 Jul 2018 17:56:23 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 97B0E182CED34; Thu, 5 Jul 2018 21:56:22 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1539:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3870:3871:4321:4605:5007:10004:10400:10848:11232:11658:11914:12043:12740:12760:12895:13069:13311:13357:13439:14181:14659:14721:21060:21080:21221:21627:30012:30054:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: pet57_71b4e03be854d X-Filterd-Recvd-Size: 1637 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf12.hostedemail.com (Postfix) with ESMTPA; Thu, 5 Jul 2018 21:56:21 +0000 (UTC) Message-ID: <6ac2e3636968832b7bc9a49d6a3f4d4998f9aa20.camel@perches.com> Subject: Re: [PATCH] checkpatch: forbid filesystem accesses from within the kernel From: Joe Perches To: Prakruthi Deepak Heragu , apw@canonical.com Cc: linux-kernel@vger.kernel.org, ckadabi@codeaurora.org, tsoni@codeaurora.org, bryanh@codeaurora.org Date: Thu, 05 Jul 2018 14:56:19 -0700 In-Reply-To: <1530827270-19947-1-git-send-email-pheragu@codeaurora.org> References: <1530827270-19947-1-git-send-email-pheragu@codeaurora.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-07-05 at 14:47 -0700, Prakruthi Deepak Heragu wrote: > As use of sys_open/close/read/write system calls from within the kernel > code is inappropriate, an error is triggered if used. [] > diff --git 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); > + } > + Is this really useful? As far as I can tell, this would only give false positives on all existing kernel code.