Received: by 10.223.185.116 with SMTP id b49csp629155wrg; Wed, 21 Feb 2018 04:26:11 -0800 (PST) X-Google-Smtp-Source: AH8x225mivPfJ0v+5uUnGK6uT53jHprjD9KiKuBakqOYD3MeBDWVu5jceGIpC+bNAG2n8y49Z39z X-Received: by 2002:a17:902:20e5:: with SMTP id v34-v6mr3017200plg.82.1519215971405; Wed, 21 Feb 2018 04:26:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519215971; cv=none; d=google.com; s=arc-20160816; b=eUwuEWsqtLKXpCTBjNt2KoqlFf7wNYJQjbl7KDT+Uixf/9+HyeSfrMcx0OryzsU2nS Fm60hYZd/Fwus4K9OX5tVw4YGGRzqF2okRYq26ekwDicgVrXIhXs9Zn0pwsOzSvYwf5N WvfBXMu0iKgR3DI4fACyJ5vk1T92Mm5dK+sMjHFzTUKszc0hXAigWjoyNlqqIeZYjsp1 /Yisjwn9TiH37rbA1O1+VLg9H57JmyrjHqFUOPDHOCb248+913b4eSDbe7RemqL1YYsh eZtTYIcrMKNg714UoKjZqbe/gpNWdhiPc/g6wRhg+nIIecTMQjiinT/Ybs1vafXebStF vViA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=OkCm0FaDEDqJobeTxfId26udOyPtbfwQ6We91DyJ8wQ=; b=b3gIhVzeE19K8m3dcF1co34HNACAmK9JvzAjYgs6lGO3nJizXpgV2lEIQ9vOGuzwW3 LnZNBG/EkNWunvIUE90K/Dh6LnCBLPEoq0fx0IWzTb62Lvco65dELPnx6wdb0KgtL4Gk prPiMFkaPGhyBQ/bKe1qkEvkP2H/FpTl+2U3JjxDA9aOaxmRXwWRZ/Bu21Jq5mli+J/L kBB1pTx7zLK09tmEG3F1wYUDE6nZr5BY3BytEIiW8up5ZGcdHfSITwmbaZOlT83y2dRL 7IdqFh1jzNA7IKAxj03ZhEnwcJLGqUWWUMkCQhpwcocmcKrJLoNabKC2lGycFIDl7ses Jybg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@prevas.dk header.s=ironport1 header.b=FM5+NOs4; 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 g10si469614pgf.160.2018.02.21.04.25.57; Wed, 21 Feb 2018 04:26:11 -0800 (PST) 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=fail header.i=@prevas.dk header.s=ironport1 header.b=FM5+NOs4; 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 S1752758AbeBUI5x (ORCPT + 99 others); Wed, 21 Feb 2018 03:57:53 -0500 Received: from mail01.prevas.se ([62.95.78.3]:10906 "EHLO mail01.prevas.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbeBUI5v (ORCPT ); Wed, 21 Feb 2018 03:57:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=1376; q=dns/txt; s=ironport1; t=1519203471; x=1550739471; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=RsCBGbLoaFfVXO2ZbCf5H1uznQP5FVN9kKjgEpooujA=; b=FM5+NOs4YtWkHdfRraCe/ONkOJFUxHx0dvUtoLbOhFkrsRaWkVrhYFLJ 4RAZLi5QD9zeonatBdrdQLh1FIM3t3uisFnuQ7JCMaIZFkmrykRYFrIZv K4sqoxu3z8K0gWi607tSC7zoR+eyW5NHKqLIMCMveOLt4ZscF96Sa8FI1 4=; X-IronPort-AV: E=Sophos;i="5.46,543,1511823600"; d="scan'208";a="3278863" Received: from vmprevas4.prevas.se (HELO smtp.prevas.se) ([172.16.8.104]) by ironport1.prevas.se with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2018 09:57:50 +0100 Received: from [172.16.11.22] (172.16.8.31) by smtp.prevas.se (172.16.8.104) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 21 Feb 2018 09:57:49 +0100 Subject: Re: [PATCH 2/2] proc: use set_puts() at /proc/*/wchan To: Andrew Morton , Andy Shevchenko CC: Alexey Dobriyan , Linux Kernel Mailing List References: <20180217072011.GB16074@avx2> <20180220160212.8f3942d40e0b4014e2aa457c@linux-foundation.org> From: Rasmus Villemoes Message-ID: <317b6413-0a46-8f5c-ad24-c5e183bc9a7a@prevas.dk> Date: Wed, 21 Feb 2018 09:57:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180220160212.8f3942d40e0b4014e2aa457c@linux-foundation.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.16.8.31] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-02-21 01:02, Andrew Morton wrote: > On Sat, 17 Feb 2018 16:06:42 +0200 Andy Shevchenko wrote: > >> On Sat, Feb 17, 2018 at 9:20 AM, Alexey Dobriyan wrote: >>> Signed-off-by: Alexey Dobriyan >> >> >>> - seq_printf(m, "%s", symname); >>> + seq_puts(m, symname); >> >> While this might have no security concerns, the pattern might be >> brainlessly used by some janitors and there would have security >> implications. > > And I'd like to see a changelog, please. One which explains why > `symname' cannot have a %s (etc) in it, and never will. OK, since #youtoo: It doesn't _matter_ if symname is "%pHAHAHA %fooled you ", seq_puts does not interpret it at all. There are _never_ security implications with the above replacement. Sure, seq_printf(m, symname) would be bad, but that's not what is being done. AFAICT, this should always lead to slightly smaller code (one less parameter passed) and in all likelyhood also slightly faster (no format interpretation, no slow char-by-char handling by the string() function etc.). So the only case where I'd think this should not necessarily be done would be in a long sequence of seq_printf, where only one or two could be replaced by seq_puts/seq_putc. Rasmus