Received: by 10.223.185.116 with SMTP id b49csp2668091wrg; Mon, 5 Mar 2018 06:54:53 -0800 (PST) X-Google-Smtp-Source: AG47ELsFhf4B1KE024ykLUNxHzSM25wp4imYMPNi8XEel2lkPfV/bEH1FdfCGyrjuFoWn2U1fP3I X-Received: by 10.98.186.2 with SMTP id k2mr14042383pff.225.1520261693353; Mon, 05 Mar 2018 06:54:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520261693; cv=none; d=google.com; s=arc-20160816; b=AhRPhOE4DwpdfRmpZL214IOs0ywwP55+Xjo6jLhtSZkqo6U/yymQzNdfChYksjhV7y hYqC1q+6ok4zSXAFb51AY/qhUwn5aKXFKnDr+HDunBgwPDdzlUG7RPrJGxc/CITRiJza 9YVZSxTEOIeUFH8T+l/Qi66BVniNT1f+LIfQCWDHRdmZCznIMshaU2WX0p243RCoOV1I rvLVhjaE30P5U8+PoYpfiIYu22xEghwPiPU4T1UV10yjXkKx5mo3Jc00lD2RrS3NZJNI vVKEu2PlPMo/slRiCTYdbxSZ9uARIpoHWL9+6jfVAfpEQPY7BPHBVCHda3gc4QxOtUTB GcPg== 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:arc-authentication-results; bh=tBurTh/uamVxqWZTbMoz4pYYHGfrB3ZVEYGU3zhN5Y8=; b=DJYbMSaDmf7Th5l8kcyQ5TDFoKiYr22FszNV44sd/FoqQ9ALokMxDdvNHpsLxovOGL BqAqYuTXRA8R4ORljhxIB3t+LJaHVSDcJ3rANEVWDeU9wj7Kl1AnHkfDJXwkLm+b/Mma l0jNWPg09YKVV2tvntV6zjijWDZTyWtGM/P2b6GevPOqA1S/kbMTNGamTA+0xl0Z/Ppw lJY79B+mq8OjrlXHuo7oGB/lbtt/CI2pGJh0R/7TciDY8CC8M0aj7OS9EK+sorTIxNX9 WRVDJssNxitHQFdt4uNE4dy7X/7PHogZ/GyckPj1jNb9n6FPXt1l8to9nmf/iIt57N9k Vj3g== 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 q16si10323268pfg.221.2018.03.05.06.54.39; Mon, 05 Mar 2018 06:54:53 -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; 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 S1752348AbeCEOxK (ORCPT + 99 others); Mon, 5 Mar 2018 09:53:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:58030 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751830AbeCEOxI (ORCPT ); Mon, 5 Mar 2018 09:53:08 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7A0D1AD0C; Mon, 5 Mar 2018 14:53:07 +0000 (UTC) Date: Mon, 5 Mar 2018 15:53:06 +0100 From: Petr Mladek To: Andy Shevchenko Cc: "Tobin C . Harding" , linux@rasmusvillemoes.dk, Joe Perches , linux-kernel@vger.kernel.org, Andrew Morton , Michal Hocko Subject: Re: [PATCH] vsprintf: Make "null" pointer dereference more robust Message-ID: <20180305145306.5i643d2oqupc4rba@pathway.suse.cz> References: <20180216210711.79901-1-andriy.shevchenko@linux.intel.com> <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> <1520000254.10722.389.camel@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520000254.10722.389.camel@linux.intel.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2018-03-02 16:17:34, Andy Shevchenko wrote: > On Fri, 2018-03-02 at 13:53 +0100, Petr Mladek wrote: > > %p has many modifiers where the pointer is dereferenced. An invalid > > pointer might cause kernel to crash silently. > > > > Note that printk() formats the string under logbuf_lock. Any recursive > > printks are redirected to the printk_safe implementation and the > > messages > > are stored into per-CPU buffers. These buffers might be eventually > > flushed > > in printk_safe_flush_on_panic() but it is not guaranteed. > > > > In general, we should do our best to get useful message from printk(). > > All pointers to the first memory page must be invalid. Let's prevent > > the dereference and print "(null)" in this case. This is already done > > in many other situations, including "%s" format handling and many > > page fault handlers. > > > > > With such explanation it makes at least clear for the reader why it's > done. > > Thanks! > > Would you be okay if I take this one as a first in my series and > resubmit the series based on it? Makes sense. Feel free to go on. Best Regards, Petr