Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1354549ybi; Fri, 12 Jul 2019 14:26:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZVHVN7ejpQKO0bACz4crB5cYrQEMHMEYWLNJdgXlxdYpn1NAYT+P/9udgPvNRSCqzQpKL X-Received: by 2002:a17:90a:2488:: with SMTP id i8mr14217434pje.123.1562966795560; Fri, 12 Jul 2019 14:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562966795; cv=none; d=google.com; s=arc-20160816; b=VpDZRWokF7Tr3V0YcHmgPdwPq6iTLH/l/O8eOlGclo/4dphv2KOLLJrvitleHoWKMf g5gLuVHI1XL2DQe+K8se8MRX5K/bOKx2lK2cHgJ9h2uEiwwGwc1xyI7IgRnJXHqaqm90 fH3DGwh2kLr/MRSNv1aurHaa+EfL4KGqMf4rkIsQ2yIGQhTJWw+BLDnXFPqgOYjPahwU seGTvcZl7F3snEIQlteykus7Ge7DILt0naLKxXYMEJmW6S5vu0MYTBmpQY76pN0QJyea 6N8Xgb5YM71epNHQGKXKzvAMpqAX3SOu0apOL/Wc8JH8quJMhdd+i0sMlsrKyh4x7kCE v+pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=rKaruv3yEDqvC9z3g7JYYSX+pKbw7Py2uUqHQdkz0EU=; b=pM1kFgdYiyQFEVf55L0zobDR8/7jBCC1t9zIGfzH9R5MoW+mn9QDfBUdafBURRKuvJ S2/iPg+D+SuculHQ9tSTLuzV5EYeuCmQ940IF8KIfmB+Ns3gPfsizqLurX1b69QwJz7f J2YtT7FxtlVJ0vrE0Gj4fCBSL6Yijk6E92lXetXhb48+0GPZetySwaJps4aeTD2aGjr8 nDIlNJ14VTamR/GAwobyF7wm+D89EgBRKcXi6XsUDCeK2Xuwbr10vCv0wPLNCJ3rqO1p emv7PNWFIS9mq3QbMwdaTjgsu+9iCJRyqxnhodtzm9lSJv5ZOkeJ4ipy8ihMuAIB8r1L AiIA== 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 f2si1360360pgl.74.2019.07.12.14.26.19; Fri, 12 Jul 2019 14:26:35 -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 S1728065AbfGLVZ7 (ORCPT + 99 others); Fri, 12 Jul 2019 17:25:59 -0400 Received: from kich.slackware.pl ([193.218.152.244]:45170 "EHLO kich.slackware.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727994AbfGLVZ7 (ORCPT ); Fri, 12 Jul 2019 17:25:59 -0400 X-Greylist: delayed 534 seconds by postgrey-1.27 at vger.kernel.org; Fri, 12 Jul 2019 17:25:58 EDT Received: from kich.toxcorp.com (kich.toxcorp.com [193.218.152.244]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shasta@toxcorp.com) by kich.slackware.pl (Postfix) with ESMTPSA id A8A09C1; Fri, 12 Jul 2019 23:17:03 +0200 (CEST) Date: Fri, 12 Jul 2019 23:17:03 +0200 (CEST) From: Jakub Jankowski To: Alexey Izbyshev , Alexey Dobriyan , Oleg Nesterov cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, security@kernel.org Subject: Re: [PATCH] proc: Fix uninitialized byte read in get_mm_cmdline() In-Reply-To: <3de2d71b-37be-6238-7fd8-0a40c9b94a98@ispras.ru> Message-ID: References: <20190712160913.17727-1-izbyshev@ispras.ru> <20190712163625.GF21989@redhat.com> <20190712174632.GA3175@avx2> <3de2d71b-37be-6238-7fd8-0a40c9b94a98@ispras.ru> User-Agent: Alpine 2.21 (LNX 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-07-12, Alexey Izbyshev wrote: > On 7/12/19 8:46 PM, Alexey Dobriyan wrote: >> The proper fix to all /proc/*/cmdline problems is to revert >> >> f5b65348fd77839b50e79bc0a5e536832ea52d8d >> proc: fix missing final NUL in get_mm_cmdline() rewrite >> >> 5ab8271899658042fabc5ae7e6a99066a210bc0e >> fs/proc: simplify and clarify get_mm_cmdline() function >> > Should this be interpreted as an actual suggestion to revert the patches, > fix the conflicts, test and submit them, or is this more like thinking out > loud? In the former case, will it be OK for long term branches? > > get_mm_cmdline() does seem easier to read for me before 5ab8271899658042. > But it also has different semantics in corner cases, for example: > > - If there is no NUL at arg_end-1, it reads only the first string in > the combined arg/env block, and doesn't terminate it with NUL. > > - If there is any problem with access_remote_vm() or copy_to_user(), > it returns -EFAULT even if some data were copied to userspace. > > On the other hand, 5ab8271899658042 was merged not too long ago (about a year), > so it's possible that the current semantics isn't heavily relied upon. I posted this (corner?) case ~3 months ago, unfortunately it wasn't picked up by anyone: https://lkml.org/lkml/2019/4/5/825 You can treat it as another datapoint in this discussion. Regards, Jakub -- Jakub Jankowski|shasta@toxcorp.com|https://toxcorp.com/