Received: by 10.213.65.68 with SMTP id h4csp431452imn; Fri, 16 Mar 2018 07:34:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELvpPWWmA54QiC1eOw+BbTTn8Q/XXhIUDEDqagouF7GtDqt1Gqrj7E9sDUMlGWVpLVf0xqTn X-Received: by 2002:a17:902:12e:: with SMTP id 43-v6mr2345979plb.77.1521210895269; Fri, 16 Mar 2018 07:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521210895; cv=none; d=google.com; s=arc-20160816; b=KQJlYuwl74RvvsWoxJFQ0MHTEBdjTE1O4a3qoTwY6NNcy9Mf8G8xmvQ0AAlxcvbcVl yVWn06JxIK1p8RQup/Z/25tRYNOwMtdf73wTYeYKz3b9yadnBUIyaFknVS3JtWhn9WKe S4f9V0mziFgwTPpUqqklx6rJY3o477yRr1hjP/ASuNNBlmux+ev/vCtYyAk4gUg++NDm K02n5H9GZRcD6ZBZtmbEKlgs5A5KSXVnSccUr/x9OOsyBAy6Cf6VEqQGiHzh9gp1arO4 2i5und50kqkz/K/wLUUK1FZ+Z5DNi3bKUQP0HBeajTI9Fdzc6lglWpHXwR5bMh4YGrGA tN+w== 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:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=6kOPjfH59fJh08f1OVo7uwB8xFglH7MVrHYBIGMqSds=; b=mtbVFaOnz9YhziF3zaga2YxcxrjSUwSlH6vGVVqoXwOB+wCBNpxqN2bEBqA6zVp46i Vq5gfAHJCSxxweBLABywCGfMOPVhyhpQ2EBeYt9GhSfzwA4ULyOnz7DBWMrsCsBguUBF iVL8kP9bbHkKNnE59ibF9r8lkVv0zy20zJhGMK6+Pd7VU39QUoU9ngYsyKuOmcYwwK5D U1i+Z1LkJgTZafTR3w3hY9veQMxviSwXGb7HCVaGPuxiFCN2OfkF5CRt2Bc8C90t+Yf1 wFRVkjNCiQpX6BpGoDSH39qQs13azPHPrT9wWlrifQLmH+dHlr2twNR5IVZjtS3g4tlf JUsg== 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 k4-v6si6394239pln.103.2018.03.16.07.34.41; Fri, 16 Mar 2018 07:34:55 -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 S1752052AbeCPOcM (ORCPT + 99 others); Fri, 16 Mar 2018 10:32:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:47504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbeCPOcK (ORCPT ); Fri, 16 Mar 2018 10:32:10 -0400 Received: from gandalf.local.home (cpe-172-100-180-131.stny.res.rr.com [172.100.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F1E72177B; Fri, 16 Mar 2018 14:32:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F1E72177B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Fri, 16 Mar 2018 10:32:07 -0400 From: Steven Rostedt To: Petr Mladek Cc: Sergey Senozhatsky , Linus Torvalds , Andy Shevchenko , Rasmus Villemoes , "Tobin C . Harding" , Joe Perches , Linux Kernel Mailing List , Andrew Morton , Michal Hocko , Sergey Senozhatsky Subject: Re: [PATCH v3] vsprintf: Prevent crash when dereferencing invalid pointers Message-ID: <20180316103207.47d3ece7@gandalf.local.home> In-Reply-To: <20180316085556.t3j65zyuyjzro3n3@pathway.suse.cz> References: <20180309150153.3sxbbpd6jdn2d5yy@pathway.suse.cz> <20180314140947.rs3b6i5gguzzu5wi@pathway.suse.cz> <20180315075842.GD3628@jagdpanzerIV> <20180315080309.GF3628@jagdpanzerIV> <20180315130117.7c2fb761@vmware.local.home> <20180316011852.GA5139@jagdpanzerIV> <20180316055346.GB5139@jagdpanzerIV> <20180316085556.t3j65zyuyjzro3n3@pathway.suse.cz> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 16 Mar 2018 09:55:56 +0100 Petr Mladek wrote: > I am not sure if it is worth it. I think that we would catch 99% of > problems by checking the first byte. Then it should be commented as such. Something like: /* * This is not a fool-proof test. 99.9% of the time that this will * fault is due to a bad pointer, not one that crosses into bad memory. * Just test the address to make sure it doesn't fault due to a poorly * added printk during debugging. */ > > This patch was motivated by a code clean up rather than bug reports. > The original patch removed two more strict checks and kept only > the check for pure NULL. I suggested that it was the wrong way to > go... > > I do not want to go suddenly to the other extreme. I suggest to start > with simple check for the first byte and see how often it helps > in the real life. We could always extend it later. Fair enough. If this is just code clean up, then sure, we don't need to cover all cases. But it should definitely be commented about why this is added, and if in the future we really do want this to be more robust, then we can extend it. -- Steve