Received: by 10.223.185.116 with SMTP id b49csp5377170wrg; Wed, 7 Mar 2018 10:41:36 -0800 (PST) X-Google-Smtp-Source: AG47ELvYC7v8PchVv+6K6Mc5nNnb/s7Iqf2hVh3fYBkb8dJp0Fi3+PE+fgQPjkDQ09vN4Oh16JBk X-Received: by 10.98.227.10 with SMTP id g10mr23560098pfh.200.1520448096440; Wed, 07 Mar 2018 10:41:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520448096; cv=none; d=google.com; s=arc-20160816; b=jkLiZrTrEvAVZB9cB3IbwcwHUtNeAPJWi/KzQQ4G+wKuSa3mTxZ5ICI6VSNSW3+H7G ryrq05yAdLUTrhboBv40sr+FBRWy1E3wLJJafeOGrMm17nuSN3mQwI4+1gYruigF8xzU 8G0lHGrBNxJ46IGvJPMQFzWmLoQw+baGnp3zZkLQtMmk5whC1RyrHxVhVnGAOzT81Xye ZZpwZbQxl0szue12wY0wIIrSacf3nHp6H9LefOOlj48WUhQAw0UwJej8X/Scl+0u4LZn 334xQHLyOpl0LOgqmWJ9c5FcCiFHe7CJMdrCgNOVkY1PUgiRHYWZL08Mnehxh+1L3nU7 E5RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=DxRxwY7k3ohKq8OqzQ+IzlhwTCdUTuBroH7slwqqaxY=; b=OtrQvfJ+BRtTe3y7fM7RWPW4D0ERFzgfOEHrGkSt9bMmNxwVHfNWJ7HMuSStL2Fi8+ nvxYjQTn1GhHNuprTbJG00tyi9f/Ah2zCiQei9fm3aABt3oNZz8fIRpTKR9qBG6ko0BK A2IuC8FaSmNvGprC4R6bkFzo7mzxumQ1XtUtuBKYbb/ZOhUq56aFe6wGlk8+wdfhwOI5 vkIBcMQYx8L7AsZUNCL7Xb3+aUoq3NysdG0m9Vj8Gaegfr02Y+dBoke5It2xAUI0e29T 2hMMMmASKTtCJ+cuwDxCBSc4Bs4YW+/LENxD5EjE5fSINtOClyjMYqsos5gxGbuUDtl7 vRZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=B4Ezuu//; dkim=fail header.i=@linux-foundation.org header.s=google header.b=ClSmHnDD; 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 r22si11851088pgn.104.2018.03.07.10.41.21; Wed, 07 Mar 2018 10:41:36 -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=@gmail.com header.s=20161025 header.b=B4Ezuu//; dkim=fail header.i=@linux-foundation.org header.s=google header.b=ClSmHnDD; 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 S1754651AbeCGSk3 (ORCPT + 99 others); Wed, 7 Mar 2018 13:40:29 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:35904 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754333AbeCGSk1 (ORCPT ); Wed, 7 Mar 2018 13:40:27 -0500 Received: by mail-io0-f194.google.com with SMTP id e30so4155601ioc.3 for ; Wed, 07 Mar 2018 10:40:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=DxRxwY7k3ohKq8OqzQ+IzlhwTCdUTuBroH7slwqqaxY=; b=B4Ezuu//zj2WXihhC9HDE0QUuVLgCOgwsOsxv+x2lrueLHEZ5MQN+4WETF1/fj7n2i m3bu230ucauRedMV+hzqiD5T7hjV0gSNh2tzgLpxJYalrte7oWEwu/gQ4Q4sD9csNI33 xETk1z5vlimk46DlGqScZ3uVNltsjmaHbUHlV3dD6hs0o/fhw96hwJXUCIZQK7by3Mc7 o0UUrn6+QaHrG4kYHRSYM8ighkitlFWPAmofyVBfj1VqtqfzwhtN0LWsqSTmQ1FG8D9+ hMSG0PC+LO6ko2s8GFbAZ0aPJgmsFK4F9ETax8edQhlBqTjehaPUjtLSAfr+YO/qVTT3 z4Hw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=DxRxwY7k3ohKq8OqzQ+IzlhwTCdUTuBroH7slwqqaxY=; b=ClSmHnDDFygzeSvQZOA7sWEgD7Oe2TVMaHe/BfDmyInjB8JiLw3R3e/1o5GGvuFSl3 FsxymVggSXFE9Uf9s4c1CC+B2cNOt8eY37MsZiQPK4Shh6QEEUKORSSj9CW+V3FD/GyQ Y+dc9LkIYJvlifq8dQK7+8zk26pX7wS9oThRc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=DxRxwY7k3ohKq8OqzQ+IzlhwTCdUTuBroH7slwqqaxY=; b=OalLaj2OqKMoAhCmjVF9yKxrWdEv0YPIZ5NKFbSovORzSp6VV4TWomMv8IFLJaJBiK /rGK9SF9LtaX5dAvyMWfIYiOvzJ1GsGvHlqSDG/o3/tM+aeEMi+Bb/bpa3REB6D3vJdR OCcOJTTVNmz8qOPm3BadnceSPvMwUXIEEiniSR2UMZg/goPO/AkRCMLFphM1eL0YWd1y G4PGQTcRBW4TaP4Cmxa8fEUydLLG0bzxeVl+qMvafqeNOyLYRMuqoYPtk0HvMqqY8OTy njBIJw/HqGOMZRZldR8RidpWGaJzVDbeUfckGx7y7ttea97cByw5PQonZrDRIgQQLe6H jsOg== X-Gm-Message-State: APf1xPCATmLzp/ODJ0i1Q+5FfSY9lXEyJJEuICz/tkvocTGC1kQTX8i1 9TFG1pyyEg/kBs05Wu4/caO3fN2tWgpKbUr1Ivo= X-Received: by 10.107.22.1 with SMTP id 1mr28234863iow.238.1520447658293; Wed, 07 Mar 2018 10:34:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.135.221 with HTTP; Wed, 7 Mar 2018 10:34:17 -0800 (PST) In-Reply-To: <20180307155244.b45c3fb5vcxb4q2l@pathway.suse.cz> References: <20180216210711.79901-8-andriy.shevchenko@linux.intel.com> <20180227155047.o74ohmoyj56up6pa@pathway.suse.cz> <1519752950.10722.231.camel@linux.intel.com> <20180228100437.o4juwxbzomkqjvjx@pathway.suse.cz> <1519814544.10722.266.camel@linux.intel.com> <20180302125118.bjd3tbuu72vgfczo@pathway.suse.cz> <20180302125359.szbin2kznxvoq7sc@pathway.suse.cz> <20180306092513.ibodfsnv4xrxdlub@pathway.suse.cz> <1520330185.10722.401.camel@linux.intel.com> <20180307155244.b45c3fb5vcxb4q2l@pathway.suse.cz> From: Linus Torvalds Date: Wed, 7 Mar 2018 10:34:17 -0800 X-Google-Sender-Auth: zBluRUj-uwHuQ3PaSeymCzD0ZyQ Message-ID: Subject: Re: [PATCH] vsprintf: Make "null" pointer dereference more robust To: Petr Mladek Cc: Andy Shevchenko , Rasmus Villemoes , "Tobin C . Harding" , Joe Perches , Linux Kernel Mailing List , Andrew Morton , Michal Hocko Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 7, 2018 at 7:52 AM, Petr Mladek wrote: > If we are changing things, let's do it properly. The range > (-PAGE_SIZE,+PAGE_SIZE) is just a small subset of invalid pointers. > Let's try to catch more of them by reading one byte using > probe_kernel_read(). It would return -FAULT if we are not able > to read the address but it would not crash. > > Then we clearly need a new message when dereferencing invalid > poitners that are not pure NULL. I propose (efault). NO! Absolutely f*cking NOT! "probe_kernel_read()" is really complicated. It takes a *fault* for chrissake! Guess what happens now to any crash report if it uses %p and there is anything wrong with the VM? Yes, yes, it disables page faults, but that only means that we won't go all the way into the generic VM. We'll still take the fauly, still do vmalloc fault filling, still do a *lot* of potentially really complicated things. Guys, stop this idiocy. printk() needs to be *simple* and *reliable*, not fancy. Plus, you just made %p be an excellent leak of some very sensitive information, like "where is the kernel mapped" etc. So not only did you make it fundamentally more complex and fragile, you actually made it more of a potential security issue too. > Below is my RFC patch. NAK NAK NAK. Seriously. Stop this crap. Get over yourself guys. This whole NULL discussion has been one huge pile of unbelievable *SHIT*. The first few bytes in the address space are special, because NULL pointers are often offset by structure offsets. They are special because NULL is special. THEY ARE NOT SPECIAL BECAUSE IT CAUSES FAULTS. The top "small negative numbers" are special, because the kernel extensively uses the ERR_PTR model, and that is how we encode it. THEY ARE NOT SPECIAL BECAUSE THEY CAUSE FAULTS. Thinking that "this address causes faults is special" is moronic. Actually testing - in something as crore and critical as printk - whether a fault happens is beyond the pale. Linus