Received: by 10.213.65.68 with SMTP id h4csp77882imn; Thu, 15 Mar 2018 10:03:22 -0700 (PDT) X-Google-Smtp-Source: AG47ELuJ3QXitvrfHAqCPn8A4iZ/Ndb/Ti7i1n9dm4aP7PKyc3aJgPV0qS6PK8Nuxz2F3TIJOgZQ X-Received: by 2002:a17:902:9009:: with SMTP id a9-v6mr8684331plp.272.1521133402338; Thu, 15 Mar 2018 10:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521133402; cv=none; d=google.com; s=arc-20160816; b=uMW3yj4UIUsscLkZuqbsVetrOlYgE4x0CorxS57S9N6c/0wUXlREUhWN2N3SQHlA2E AWgWIycZ7spZZXw12qGYUA9Fm5I9jygg6UxeJPQWfWEPKHVPOYJ58Qyhut6zJCftA8Ls Sa0hKlXhwFC4U+PQPJ6Ss3srTbxfWhY0UP132hp/q/yIPO2sxsfzp8f+uATpjj8+B7qO axDWvK6pam7AHEqVaTffOcS/3VkxpwAQux/cgW2gTwihHTTUCt7lprWf1DB5HyGJdffX LlX6bF5gjVjUOg86FXM4eQenJ2LQ/i1gRgQhSm4TeGO4AVPVYlz7oYK0jqRJ3r2eieg5 ZA0A== 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=U/m3HSrIreBtecTprw9IENAuV3Eg7M5zNb5KR5674rQ=; b=Nb014URBHecDdr+qwK5vu/NopWLqUewqW43ry4YBXtQBNEEs7CPMEI3MKtc2gkLeWx wQaLNrJAFCSpzOoyCEr++nQXLRoZPmlmcG/Y/au6xPHqruaMR2+yGfy7DzwebTyb2Dpf azCJt9kT8bPhzgm5k9ep/I/CxHz2Yv6QOPQ5aVnjbyLm2IfL5bgViphdLRrrEpUZWO1p oDfYDxmbXlYVOlIX+l+IJ23/Ofayk2l77/y2OhTVw5Qet1xXDcF0F+G+5GmjK7Lz7UBW U8RGxQbGxCx45Nj0rZ8ME7YPifZ073pY1maBxX4EnKwyUpaRxbCHpszk895ruqTGt+SS 2PRg== 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 bc5-v6si4287501plb.506.2018.03.15.10.03.05; Thu, 15 Mar 2018 10:03:22 -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 S1751980AbeCORBW (ORCPT + 99 others); Thu, 15 Mar 2018 13:01:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:43700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595AbeCORBV (ORCPT ); Thu, 15 Mar 2018 13:01:21 -0400 Received: from vmware.local.home (ip-64-134-136-2.public.wayport.net [64.134.136.2]) (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 EAD5D21742; Thu, 15 Mar 2018 17:01:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAD5D21742 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: Thu, 15 Mar 2018 13:01:17 -0400 From: Steven Rostedt To: Sergey Senozhatsky Cc: Petr Mladek , 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: <20180315130117.7c2fb761@vmware.local.home> In-Reply-To: <20180315080309.GF3628@jagdpanzerIV> References: <1520330185.10722.401.camel@linux.intel.com> <20180307155244.b45c3fb5vcxb4q2l@pathway.suse.cz> <20180308141824.bfk2pr6wmjh4ytdi@pathway.suse.cz> <20180309150153.3sxbbpd6jdn2d5yy@pathway.suse.cz> <20180314140947.rs3b6i5gguzzu5wi@pathway.suse.cz> <20180315075842.GD3628@jagdpanzerIV> <20180315080309.GF3628@jagdpanzerIV> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; 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 Thu, 15 Mar 2018 17:03:09 +0900 Sergey Senozhatsky wrote: > On (03/15/18 16:58), Sergey Senozhatsky wrote: > > On (03/14/18 15:09), Petr Mladek wrote: > > [..] > > > +static const char *check_pointer_access(const void *ptr) > > > +{ > > > + unsigned char byte; > > > + > > > + if (!ptr) > > > + return "(null)"; > > > + > > > + if (probe_kernel_read(&byte, ptr, 1)) > > ^^^^^ > > Why one byte? sizeof(ptr)? > > I think there is a shorter version - probe_kernel_address(), > which, seems, was designed for this particular kind of stuff. > > void *p; > > if (probe_kernel_address(ptr, p)) > .... > Agreed. -- Steve