Received: by 10.213.65.68 with SMTP id h4csp1499812imn; Thu, 15 Mar 2018 01:04:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELveEJpz1cPb9Rm8/Gd/nt6P3IlPAhR/4/ES45eop9Lzyod+ebbwcuQkwmOYdvPHHRmJkiJL X-Received: by 10.99.112.92 with SMTP id a28mr5978241pgn.17.1521101075441; Thu, 15 Mar 2018 01:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521101075; cv=none; d=google.com; s=arc-20160816; b=Nhk3Wsd0OetlZ+F1C8SVrVs1TzEU3W44WmbYBzVlLYlaJhu7luo3TV4r0h9vFq/3pj qIKgjTxfuzzz94imM9RXNcpPbVu0pIwhV1CU6UEpD0vsdAJRe8NV3+SpeRrGyWe0CZ3D krrsqa+XuZC3tuX5KSFWhP4DIYoLEjeUk95o4LnFc/bv+5YxpBx3TZ4ewoiQTcO8oCAt eImwi+tJA0YEbwBd3XlljJ6R5iBYwl+mOJFf9VtciLm32YtdVgzqmqiGNiD/at7AANLz wFhFrdLXtnFlFpwKIxEaCesfEQYIcA/diQpQTFVK9dUVnS8iVe2vOya0mEretdxsd6ty n0hw== 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:arc-authentication-results; bh=GR7bz6RAAGlYEK5aD7iiNeXaVsRR182DFrk8qgZcTsk=; b=JQv63oBEdsPFgkF8Obzm/mHY1KZm+7/5jQ40DkCaegtbnH2HsGM4QjhwJTYSDq7zx1 HGfo2tWqnaqnw6ASwqFZ+zRTjTKq3Fz9c6d9dfWJqB7thzbqqTZjxzg8el8ikDw/zIU2 CZmH7/39b31CDsd3oV3L/dfFac5mqkZ07pvOrQ90YBDLWsmyu8KXrS4VormMX5jJdltz tKw4U+7C+0+/qTzQpT0wGX77unrbQPBlASVJM1a1B3FAyVLXAMAH4n7eFclGZsuY6K30 FWEuQikTuYcRViEdi2fna4V1y8kdUT+04oPgjXJDlWc7orWnWyePmGiSy3TF5rFHytFe +vcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W5GQjYZZ; 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 1-v6si3256945plz.254.2018.03.15.01.04.20; Thu, 15 Mar 2018 01:04:35 -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=W5GQjYZZ; 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 S1751508AbeCOIDT (ORCPT + 99 others); Thu, 15 Mar 2018 04:03:19 -0400 Received: from mail-pl0-f45.google.com ([209.85.160.45]:42947 "EHLO mail-pl0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750740AbeCOIDO (ORCPT ); Thu, 15 Mar 2018 04:03:14 -0400 Received: by mail-pl0-f45.google.com with SMTP id w15-v6so3286514plq.9 for ; Thu, 15 Mar 2018 01:03:14 -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=GR7bz6RAAGlYEK5aD7iiNeXaVsRR182DFrk8qgZcTsk=; b=W5GQjYZZ/jINrlidggfpyKcKn0lF5XbmUIrlr5qeBSKFRE6P11ooGhbgntq707aYgZ UlrrFFRdyuha/Ov0Y/Gj1R0VHKqn5NGQI7/mtnpJMrxZD3bUTPLEZe6PfCQZereqPAjI O3VkWaM4eJOgxg4J75qEZV91HASK+7ye2pVkKc7pVbEa7qJx7Qc0QT8ujVUsS+geRPxR aiMih59fayh+d+WXBvgQTMp4rXuX+y2dlfInYTCDyHSd8eNcjVb+9a7Sh1G8h8RTfLP/ MwJsuFARJrdPnizvEKz4Ga9PToJ3UJK2tJsQql8y4fFNJSVAyws/zZisMjF8qnZQIZZj +k1Q== 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=GR7bz6RAAGlYEK5aD7iiNeXaVsRR182DFrk8qgZcTsk=; b=r+HCR4d/lJbna/8X8meisQ5AieHKUddvE/m9CiRvbu2/evInlvuBS7lwdHjtRd6ANm ge7X96q5AvbHhv8fEDbU+PQEkuT6uJ3SQOW0fxwQ/Sw0cp8/HxoUthfwITU0Tr2FvDC0 Wnfkhi8x2D4H3msgADf1SpIPxJj/OpuMvAC4qm79DUzfvA+j2276Jx45a7fpYDazsKSX a1CB4vAts+8gO9db+T+9zQjL79L5WkITU3rCqnr5ocIJf+8QN3nor8Y4/WmDhuxDX/fA OJiEtYX3QNfVAQgYM9Wugd388jlFzaJwDaMVwAQS8WMevsMKF0+ra78P2iiN71G2OVOK OPGg== X-Gm-Message-State: AElRT7GKCsnLzEEOPGAvh1TevfFjTUQyQhtyxEvQiAMX0gAYppFwTT39 Hia+kIP6YqkTvnhwOgpfvBadzlWe X-Received: by 2002:a17:902:9a45:: with SMTP id x5-v6mr6987537plv.18.1521100994300; Thu, 15 Mar 2018 01:03:14 -0700 (PDT) Received: from localhost ([175.223.21.185]) by smtp.gmail.com with ESMTPSA id 68sm8551868pfx.130.2018.03.15.01.03.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Mar 2018 01:03:13 -0700 (PDT) Date: Thu, 15 Mar 2018 17:03:09 +0900 From: Sergey Senozhatsky 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 , Steven Rostedt Subject: Re: [PATCH v3] vsprintf: Prevent crash when dereferencing invalid pointers Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180315075842.GD3628@jagdpanzerIV> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)) .... -ss