Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5841874yba; Mon, 13 May 2019 19:08:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwp0J4wde78R6fK+UjT/+TYUn7c5Ju2Lth0Yk3B9Zy6fVfq+xRn5qVMGqvxHudHloUfL84E X-Received: by 2002:a63:6b06:: with SMTP id g6mr24143836pgc.346.1557799721103; Mon, 13 May 2019 19:08:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557799721; cv=none; d=google.com; s=arc-20160816; b=pUQgM38lRDly2CHx65Zsf+BQNsE2Sn3/Za6nc/ifASGqWt3ucwoAPSnY13gYP+fUR5 OERAUHIB6taovdAeDrfR5pVTU3xCcvR8tjhGcntfh0UsY6in/LSgdQQ3/ls4GVQR8eGG ufmkC7JGf0qSUdgiYxXbDPXUNdFB3JpqBcU+6iQHwE1CrNI7G/vrX5kgBeXgGQ6Bywyo uqQFzTa10j4QSyNYBb+sFrE/mHdUqayZMhOVX/9nlzDsLqD4YQZS5GhoA7SjayN+EfDD U6Pt4N/GNMo+/Q6RjrkOGZmJcgE3LcJuQRHmlur7Ak9dxw5d5w7fCq8O7bq1KbYaftz2 amrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TUW58sFUl5sYOk3396X1MJdln3VeH0EXozxImmU59vw=; b=qm2g/LdaQXjK7XwJVpJVFkyq2YDkmWeYl2fGHvaYz/wDxvRV9KWz5ciUiajc8rRn03 bHc/ku3b2KOkaGGKtfZ6ayMFA0MHw3+7R5Kt9NQ5JMZbVbBNWHMC0KlUbAi/b0994BXH ZTJ31SQcCQ9b6hguiIvkACC+CGV6cdKeBaV76xEnVWNIgFq05V2mgMsUxrwZ5xG0N9wq ZLCmlcCwuH8m12ETh4Rl/XGQMBWxhF1ryafcqiwr74RUHzjHdbcWh1KN9yEFxQEsmzhL CEXgm/e2LXd5/H5mAiONIDm5bNb2SWoO9qFd160zYARN0lcjn1vHUadyx5gSRCceyRpF Wm1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gDzV41z7; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si18720948pgr.347.2019.05.13.19.08.25; Mon, 13 May 2019 19:08:41 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gDzV41z7; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726672AbfENCHf (ORCPT + 99 others); Mon, 13 May 2019 22:07:35 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:42941 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfENCHf (ORCPT ); Mon, 13 May 2019 22:07:35 -0400 Received: by mail-pl1-f195.google.com with SMTP id x15so7389940pln.9; Mon, 13 May 2019 19:07:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TUW58sFUl5sYOk3396X1MJdln3VeH0EXozxImmU59vw=; b=gDzV41z701QnCrQ26V0bq4z6xWTHENKXtePpErSx1cTFZAEnR170Cb3GIh6X6MaWvS P86mF/lBRPJUDD0wchUSehkIB5xvrpeuqlBa3x2Vho248Nn/RkVDrf1bXASF+h6UKMN4 RJw+91n48gNTDuIgc4nbPEe+W1cxRXTb+DWKeIovw8s8/EnknXE17L/40Sd6A2Ubbr5c mWCcTIy0CdYWj6taw53+CmqUKawbwZcEhJArjMmEt6X9vDDg49TOvQtWuiBMVFdi+mON IPNk5ELNC1d9yajDGEoP1a7uD/eSigryhXScvyM69k3K7CMtduUWmvSmvMIQ6zmk60J0 pPcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TUW58sFUl5sYOk3396X1MJdln3VeH0EXozxImmU59vw=; b=OQXl/Ci0QDUwGmKmNrDFYUJTh+xKTkbDdO/K8RHRF3J8ccuola8H9M8lORL5vCvmby AL6SP7t760ZYIajguGOoMoRZEAgGAAy2lgfEy5rRNHOAI9Cp9MGNdSKCzNtdIW95pbo1 hmKz/4DdnnSmXTtIOy47PCrbbV/aDMGYpTgJHsB+24fV62hpO7h/ayZ+hxyv3Th8A0oS qFxgmnWZQdqHhDTrfKCU5I1KuDmO6ADOcMWyx85fqT8bdhIW09gsKIoLugaFXxCEgXjJ m1UIizGv1sNmTpWwCOXiJyySqCQjh029Q5wWo9c4kKocvsuCK16dwRZ2+wGc9dUgNe8L Z7mw== X-Gm-Message-State: APjAAAXYuEx1TTifdK+TLYFbepgfkJ0cYCKzxslQC+6+Y4ixXft3i/xi 5kbk6GwLJPO/wmepgsizJhs= X-Received: by 2002:a17:902:108a:: with SMTP id c10mr35439629pla.48.1557799654316; Mon, 13 May 2019 19:07:34 -0700 (PDT) Received: from localhost ([39.7.55.172]) by smtp.gmail.com with ESMTPSA id v64sm19993908pfv.106.2019.05.13.19.07.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2019 19:07:33 -0700 (PDT) Date: Tue, 14 May 2019 11:07:30 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Andy Shevchenko , David Laight , 'christophe leroy' , Steven Rostedt , Linus Torvalds , Rasmus Villemoes , "Tobin C . Harding" , Michal Hocko , Sergey Senozhatsky , Sergey Senozhatsky , "linux-kernel@vger.kernel.org" , Michael Ellerman , "linuxppc-dev@lists.ozlabs.org" , Russell Currey , Stephen Rothwell , Heiko Carstens , "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , Martin Schwidefsky Subject: Re: [PATCH] vsprintf: Do not break early boot with probing addresses Message-ID: <20190514020730.GA651@jagdpanzerIV> References: <20190510081635.GA4533@jagdpanzerIV> <20190510084213.22149-1-pmladek@suse.com> <20190510122401.21a598f6@gandalf.local.home> <096d6c9c17b3484484d9d9d3f3aa3a7c@AcuMS.aculab.com> <20190513091320.GK9224@smile.fi.intel.com> <20190513124220.wty2qbnz4wo52h3x@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190513124220.wty2qbnz4wo52h3x@pathway.suse.cz> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (05/13/19 14:42), Petr Mladek wrote: > > The "(null)" is good enough by itself and already an established > > practice.. > > (efault) made more sense with the probe_kernel_read() that > checked wide range of addresses. Well, I still think that > it makes sense to distinguish a pure NULL. And it still > used also for IS_ERR_VALUE(). Wouldn't anything within first PAGE_SIZE bytes be reported as a NULL deref? char *p = (char *)(PAGE_SIZE - 2); *p = 'a'; gives kernel: BUG: kernel NULL pointer dereference, address = 0000000000000ffe kernel: #PF: supervisor-privileged write access from kernel code kernel: #PF: error_code(0x0002) - not-present page And I like Steven's "(fault)" idea. How about this: if ptr < PAGE_SIZE -> "(null)" if IS_ERR_VALUE(ptr) -> "(fault)" -ss