Received: by 10.223.185.111 with SMTP id b44csp655830wrg; Fri, 9 Mar 2018 11:06:29 -0800 (PST) X-Google-Smtp-Source: AG47ELt+TLuwkwGFJZvZ5Qkn3s2vLxIlwAAqjxG+lfe4EDIovFRFLbOOywUaXZ8RaCU4gmB2Zb3i X-Received: by 10.101.78.139 with SMTP id b11mr18094917pgs.229.1520622389148; Fri, 09 Mar 2018 11:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520622389; cv=none; d=google.com; s=arc-20160816; b=Ah+Il7IHg1mLT45PKzDXGaMg6m8ifLYW/TTHyDoPPyp48mZ3ebgfE/u+UOYKhhZsH9 c95/T5OhrNsw7p49+zB5jdqEPDep9HNddtNlEQbn4VZl4/b9PC2PnlOlIus5OnCpsptn JdZKak7GxGSCnd2ml2ySK29BX4YGI127AvheHVxd/6PdYDHIT9h7CNjQu3f0unSqm7pk 95FIX2oPmHDbQSeZ01D8HeB0F7/Q3+uKSizYMJGX4Vm3vIUQhGa5n9gcz3f8ahClJi18 sEibZW8y2taKl/sv0GmaPDAeHyI86a3wH+jIUcsUK4syEbl4SbKKY32NJ/gvjjJUrz0I nxCA== 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=sCi/33JL3ICabuUhzM9YUdtmWp0uaPuB6PARyHZYuUI=; b=gYqPC36ugFqQxBMTyZXG6T/fyjHqDvM33LfHvuXx41df4VNWyEWz3AhWD3/xol5Mxj NKPvTAI+qRAEo8BvKUNG+r4oXT6XS7K2O2b01+Pfx/AYFcU4nLeoLlu8c0IfhZk+4Vt9 vozUBzQuFl7WMNzZI0JGbyZRG9ta8y8dWHuTsH2RUxz9mfhFetxvtp9/dzhf8VSOkQw0 WGIaAMexuYR+ZQ46BBRUE+eBix3JOxFlRKtrAbBBDem0fX4FsbU+Q408CPDzQBYhDwhP EpES3DjgWXesVQ5d5irnllJWLhk1frdrEPIYB/J/TTDY2L8Azr7DkUpjAWYZ6qKihGIz KgKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hhayoNb7; dkim=fail header.i=@linux-foundation.org header.s=google header.b=VkKcg62I; 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 p12-v6si1378857pll.191.2018.03.09.11.06.13; Fri, 09 Mar 2018 11:06:29 -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=hhayoNb7; dkim=fail header.i=@linux-foundation.org header.s=google header.b=VkKcg62I; 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 S932365AbeCITFU (ORCPT + 99 others); Fri, 9 Mar 2018 14:05:20 -0500 Received: from mail-it0-f49.google.com ([209.85.214.49]:53575 "EHLO mail-it0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932069AbeCITFS (ORCPT ); Fri, 9 Mar 2018 14:05:18 -0500 Received: by mail-it0-f49.google.com with SMTP id w63so3912592ita.3 for ; Fri, 09 Mar 2018 11:05:18 -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=sCi/33JL3ICabuUhzM9YUdtmWp0uaPuB6PARyHZYuUI=; b=hhayoNb7oK9q0LoHQqLpE2U6075Q/ORDxVlhHSgL3lFhH7y0sTYTi6djuNzfnhtoQ3 emRkfM9rUsdvUHVJ6kwVUNZlM98HbKMFn7c+xOmjjov1OW4UsVWQyKUxtomyDZOm6xl0 JiJ3njhPuRihKVykXXsztJI/SuVzNgtCc8U6y2/aS+vJ44DpxRY697eRFdFWFzkVcWMw 0ftdd+y+oTNB/GUDauJEcpwbXOYeoPRGfkXY/Ni0ChUthvd/l8a3qw0bkS0dKk9WnH/D fivDEbtm6atzhbrUnMN6MDF45T/xm2CJzF5vX1990OWUZc/tOYHhxlmQ7hK8sKWNsO34 Ixog== 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=sCi/33JL3ICabuUhzM9YUdtmWp0uaPuB6PARyHZYuUI=; b=VkKcg62IfHN0+V5XkNiAi27xmP0puwY9p9lBxO+ujNBPTS0M7hYItKMt8OmRbmKUud NDUpsEHKTiqgKmcxGOkDiQ2as7yow9x6643rRFdHTRSIOMpe8HnpK1YrB6Hb/V9emvzm QZsMmD4Yp1Oc/9Fdovaw6EwmqsRd14x60GfeA= 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=sCi/33JL3ICabuUhzM9YUdtmWp0uaPuB6PARyHZYuUI=; b=Tr/x2DqAO9LDBB2HMaKZVmhgFNxzs8UXWVWKkNhGI3dMLuuDMMP5yrzxLyrXN9yFtn V6xhz+XqbhWw4AAduPrd8L5RbZeiKAD4CMik7KyD7dNdQwP3eK6kkCT5HogNVRx7wEAI BP+X0uJ3apjXxyVQAHiv9wmTa0HSep0DwNQx64NpocQSOHdzipV1kzg8o5bbGtlqYfnv EbLeNKzJ3jWbLaWsFgf3EMmkJY7f61KsxPGP50TK5R153RnC82+eVk2IZd5XRE3boLPY clMc6x3gIVMsSqjRbyXqAldwbWEk7z8iRSL9KAPwK+1c7Ra305r56n7GZtN+pHNngUda We7Q== X-Gm-Message-State: AElRT7FUZNXFtMRiy9c7gbZGCbARCdMd2Udb0WezXxQ3rU9pNvNCHtBB LVlJZmA6sj8cN6TEDp6P1zeHMqW3hwq7WTKKu8c= X-Received: by 10.36.148.204 with SMTP id j195mr4824722ite.1.1520622317650; Fri, 09 Mar 2018 11:05:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.135.221 with HTTP; Fri, 9 Mar 2018 11:05:17 -0800 (PST) In-Reply-To: <20180309150153.3sxbbpd6jdn2d5yy@pathway.suse.cz> References: <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> <20180308141824.bfk2pr6wmjh4ytdi@pathway.suse.cz> <20180309150153.3sxbbpd6jdn2d5yy@pathway.suse.cz> From: Linus Torvalds Date: Fri, 9 Mar 2018 11:05:17 -0800 X-Google-Sender-Auth: hspr7qBn9GJHEtRDBiw-Hhmqats 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 Fri, Mar 9, 2018 at 7:01 AM, Petr Mladek wrote: > Also it makes the handling unified. We print: > > + (null) when pure NULL pointer is dereferenced > + (efault) when an invalid address is dereferenced > + pointer address otherwise This is still fundamentally completely wrong. It never prints "pointer address", and if it were to do that, it would be wrong. It should never ever trigger for an address operation, only for the "we will get _data_ from the ponter". The strchr thing is also completely broken, and in a very subtle way. "strchr(string, 0)" is special, and the Open Group states "The terminating null byte is considered to be part of the string" so a NUL character will *always* return success, which is actually completely wrong for this case, because now it does that whole crazy thing for %p that it shouldn't do. Not that I actually verified that our strchr() follows the actual rules anyway - I personally consider "strchr(string, 0)" to not really be "special", but be a bug. Either way, the comment is wrong, but the code is also wrong. Linus