From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D8BAC43387 for ; Mon, 14 Jan 2019 19:05:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E040206B7 for ; Mon, 14 Jan 2019 19:05:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="fqhjacpF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726706AbfANTF1 (ORCPT ); Mon, 14 Jan 2019 14:05:27 -0500 Received: from mail-vk1-f196.google.com ([209.85.221.196]:38612 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726643AbfANTF1 (ORCPT ); Mon, 14 Jan 2019 14:05:27 -0500 Received: by mail-vk1-f196.google.com with SMTP id w72so29183vkd.5 for ; Mon, 14 Jan 2019 11:05:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nt0ngD2ZxbccYpQcZn3VujxZauUKSGl3ARTPAFibniA=; b=fqhjacpFgFun53lfGMkeRiQBgf30hqYT1W4ZLmZyKyD/oB8ISMf0FAZ/9a//3E+C6c sV3MAPu34GnRi4/IOoES5qzTz5EUeQXj8qqBEEsR+SEWCYBx8UmZsqnfFpze8mntOP0G iiaE7AOXfqwaThjU4k0Za6qBPmxkuIvrC5mYY= 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=nt0ngD2ZxbccYpQcZn3VujxZauUKSGl3ARTPAFibniA=; b=H4QAJKktYYUKW47JRFG9npzzrkubwZsEidG0dT1X6M5h+g7q+pgtKDH3JBeWhboSgy oorFDlv1OpnsDWbA/JO6qyRqoFmPWgKfRbJVQSG3BRvtfV2AMCYagMrtn4T7GnkzVomb v9ozBcIk8enm2HVAzJH4heublYl0n3JK+6hPzmaPm0Y26EaKBQ9/goYgkAKZyAgkxvQA /awW0XvP3chT8L3DYen4HscYa/+Qz0CRNZgUpfbua9rosW/pxSn4mG07lb7nVCCweUGk IWKT5Pcu7dc7NfNddCe+tAk5LZ20YbryY+BSonVRRh6Y6xHCJ/rj2iZ/lVnhkoN331aq 1Qxw== X-Gm-Message-State: AJcUukfu7L6bJpbSaaiwsqDrnIMoDlcnq1weDqbtxrdg9avECcPF8IAY ZKVrs0D0BfYCd6hh2Dz/PrxaAdV9sOM= X-Google-Smtp-Source: ALg8bN69GDmHnA4f5u1JbKtXbRvW87VbZ/1kGDrF62rNFKKK50NPdCPcMImXtFEL5liC1AnxXujdyw== X-Received: by 2002:a1f:aa44:: with SMTP id t65mr10018930vke.66.1547492725571; Mon, 14 Jan 2019 11:05:25 -0800 (PST) Received: from mail-ua1-f42.google.com (mail-ua1-f42.google.com. [209.85.222.42]) by smtp.gmail.com with ESMTPSA id b88sm505612vsg.7.2019.01.14.11.05.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 11:05:24 -0800 (PST) Received: by mail-ua1-f42.google.com with SMTP id z24so36613ual.8 for ; Mon, 14 Jan 2019 11:05:24 -0800 (PST) X-Received: by 2002:ab0:6151:: with SMTP id w17mr10217701uan.114.1547492723381; Mon, 14 Jan 2019 11:05:23 -0800 (PST) MIME-Version: 1.0 References: <20190114181336.74501-1-gwendal@chromium.org> <20190114185040.GB13821@kroah.com> In-Reply-To: From: Kees Cook Date: Mon, 14 Jan 2019 11:05:08 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] proc: Remove empty line in /proc/self/status To: Guenter Roeck Cc: Greg Kroah-Hartman , Gwendal Grignou , "# v4 . 10+" , Guenter Roeck Content-Type: text/plain; charset="UTF-8" Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Jan 14, 2019 at 11:01 AM Guenter Roeck wrote: > > On Mon, Jan 14, 2019 at 10:50 AM Greg Kroah-Hartman > wrote: > > > > On Mon, Jan 14, 2019 at 10:21:45AM -0800, Guenter Roeck wrote: > > > On Mon, Jan 14, 2019 at 10:13 AM Gwendal Grignou wrote: > > > > > > > > Prevent an empty line in /proc/self/status, allow iotop to work. > > > > > > > > iotop does not like empty lines, fails with: > > > > File "/usr/local/lib64/python2.7/site-packages/iotop/data.py", line > > > > 196, in parse_proc_pid_status > > > > key, value = line.split(':\t', 1) > > > > ValueError: need more than 1 value to unpack > > > > > > > > [reading /proc/self/status] > > > > > > > > Fixes: 84964fa3e5a0 ("proc: Provide details on speculation flaw mitigations") > > > > > > > > Signed-off-by: Gwendal Grignou > > > > --- > > > > v2: Format commit message properly with proper subject and fixes > > > > keyword. > > > > > > > You might want to mention that this patch only applies to v4.4.y. > > > v4.9.y has a similar problem, but only if CONFIG_SECCOMP=n, and would > > > require a slightly different patch to fix. Other releases are, as far > > > as I can see, not affected. > > > > > > Guenter > > > > > > > fs/proc/array.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/fs/proc/array.c b/fs/proc/array.c > > > > index 0c142916a8c7d..f11df9ab4256e 100644 > > > > --- a/fs/proc/array.c > > > > +++ b/fs/proc/array.c > > > > @@ -334,7 +334,7 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p) > > > > #ifdef CONFIG_SECCOMP > > > > seq_printf(m, "Seccomp:\t%d\n", p->seccomp.mode); > > > > #endif > > > > - seq_printf(m, "\nSpeculation_Store_Bypass:\t"); > > > > + seq_printf(m, "Speculation_Store_Bypass:\t"); > > > > Why isn't this issue showing up in all kernel releases, as this line is > > still the same in 5.0-rc2? > > > > What makes the 4.4.y and 4.9.y trees so special here? > > > > v4.14 and later: > > { > seq_put_decimal_ull(m, "NoNewPrivs:\t", task_no_new_privs(p)); > #ifdef CONFIG_SECCOMP > seq_put_decimal_ull(m, "\nSeccomp:\t", p->seccomp.mode); > #endif > seq_printf(m, "\nSpeculation_Store_Bypass:\t"); > > --- > v4.9: > > { > #ifdef CONFIG_SECCOMP > seq_put_decimal_ull(m, "Seccomp:\t", p->seccomp.mode); > ^^^ > #endif > seq_printf(m, "\nSpeculation_Store_Bypass:\t"); > ^^^ > > -> extra newline if CONFIG_SECCOMP=n > > --- > v4.4: > > { > #ifdef CONFIG_SECCOMP > seq_printf(m, "Seccomp:\t%d\n", p->seccomp.mode); > ^^^ > #endif > seq_printf(m, "\nSpeculation_Store_Bypass:\t"); > ^^^ > > -> always extra newline > > Guenter Yeah, this grew out of odd placement of the trailing "\n". I agree it needs fixing universally. -- Kees Cook