Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1806778yba; Fri, 10 May 2019 01:07:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaJ/KAYpIZkNBkcuozGt/jkjAmOLqBCIeUB+aS5Ap2iGX7pnhYOx1xV59sR82brOfTU3zg X-Received: by 2002:aa7:8d81:: with SMTP id i1mr12064726pfr.127.1557475639826; Fri, 10 May 2019 01:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557475639; cv=none; d=google.com; s=arc-20160816; b=Vu10ZKDTbY3x5ZwHSj82uV7Y6AI7kCpKKx9bXM6MYdTLQVPSki0AhVTmnOxLoHQU97 3xL+r58sj2oQloZ/mnFJCuFc4H/pE1V28YyhF+tthZK/V4tBy1BASdH9zrG3hCssMdQp wPF6ub0FQ9iLZY87RzKPgzGk4rhFs1ilOtdKTT4IMdOYx51xe8vj9GJGLpY7NNWayM0Z wyikzypwK0F8MBx+WhO7FgpE6Wpzb40I3p4V+TCUiDn2A2KZB2rZVBJdaXkDl37CW6Ee abiysuXGfu0uxfV+VS4FQeAVoHe4HQTfdlFQ80fZgyTAvu1TP0V+BwByJg/3mjy6n5Hv 0Shw== 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; bh=V0y5qebUkXzLrCuvJEZZZAGUdPVDTRI2r5EnoeJ00J0=; b=vlkCszNW1dPZP1YCWAAiLOdliPaQTiaxJ3dT5fdbR72+uuMgZZMkT3fjXeIt5H9WVz NhwWVwjiHPOMLQeuItqKohQVgcfcBEURHBtW6Vc4gsrHXntTsKjGRlYG63gBKwNEOR9R ybnbJXcI/BHv3zYiu7/NGWiFj1nD5iiZH7eGzpBu4ziU+2pU/eS7nne9JTmram7g/A5c 1XBntg+tXqQ6oY0puE1jSQuFimDziT/XnUT3kepJkb+ROwxapoBhJKYMAXywsmubY42i SWH9M5DLHYBFm4sTXLloiwBJL60/3xYKearo+G1KJf7S4SSZRURpkUb5vE8H81JMrGmn j9tw== 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 1si6476985pls.222.2019.05.10.01.07.02; Fri, 10 May 2019 01:07:19 -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 S1727038AbfEJIGF (ORCPT + 99 others); Fri, 10 May 2019 04:06:05 -0400 Received: from mx2.suse.de ([195.135.220.15]:40136 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726899AbfEJIGF (ORCPT ); Fri, 10 May 2019 04:06:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 718D5AD69; Fri, 10 May 2019 08:06:03 +0000 (UTC) Date: Fri, 10 May 2019 10:06:02 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Linus Torvalds , Andy Shevchenko , Rasmus Villemoes , "Tobin C . Harding" , Michal Hocko , Sergey Senozhatsky , Steven Rostedt , linux-kernel@vger.kernel.org, Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Russell Currey , Christophe Leroy , Stephen Rothwell , Heiko Carstens , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Martin Schwidefsky Subject: Re: [PATCH] vsprintf: Do not break early boot with probing addresses Message-ID: <20190510080602.mdfk54f6lpyg6unw@pathway.suse.cz> References: <20190509121923.8339-1-pmladek@suse.com> <20190510043200.GC15652@jagdpanzerIV> <20190510050709.GA1831@jagdpanzerIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510050709.GA1831@jagdpanzerIV> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2019-05-10 14:07:09, Sergey Senozhatsky wrote: > On (05/09/19 21:47), Linus Torvalds wrote: > > [ Sorry about html and mobile crud, I'm not at the computer right now ] > > How about we just undo the whole misguided probe_kernel_address() thing? > > But the problem will remain - %pS/%pF on PPC (and some other arch-s) > do dereference_function_descriptor(), which calls probe_kernel_address(). > So if probe_kernel_address() starts to dump_stack(), then we are heading > towards stack overflow. Unless I'm totally missing something. That is true. On the other hand, %pS/%pF uses dereference_function_descriptor() only on three architectures. And these modifiers are used only rarely (ok, in dump_stack() but still). On the other hand, any infinite loop in vsprintf() via probe_kernel_address() would break any printk(). And would be hard to debug. I tend to agree with Linus. probe_kernel_address() is too complicated. It is prone to these infinite loops and should not be used in the default printk() path. It would be nice to have a lightweight and safe alternative. But I can't find any. And I think that it is not worth any huge complexity. It was just a nice to have idea... I am going to send a patch replacing probe_kernel_address() with a simple check: if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr)) return "(efault)"; The original patch still makes sense because it adds the check into more locations and replaces some custom variants. Best Regards, Petr