Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp831418yba; Thu, 9 May 2019 06:39:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7BH2gHeMHMzvQxIiogjivZdMYOK6Wy4OIfpMbGAeJhywLbUzVWcUkKMuVLSg4f5+69f4h X-Received: by 2002:a17:902:5a2:: with SMTP id f31mr5115640plf.119.1557409186572; Thu, 09 May 2019 06:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557409186; cv=none; d=google.com; s=arc-20160816; b=FnZyJpV1RExZqu+W/Dq6C//c0kb9ldhRkPm2eJJeZDgMtVPE6GLIdW4eftnD4enNb/ VJmNrF+wx89aPI8hyyETeYRGOCocOe+xkz1I+3cyPeQd9a3Hepj2ep//KceapB9tBkNR hbbADPxtb6uiw9y6n1DUrV+w9f05yIpQb4UMTRAfgsNxM8htte+2c0al3jcsNHO449/C xF5TtA1XirCA3fxmtKEbIGX9aHkx2MOCWfWVUkfNEDO6OVEIGCi792LicYiIlynM63sm hn26UD3aELtX1hWWq+6WkLKi9Lw1E3TeBW20TVwzdCnMVBrDvjs+sh4tVuw+p89uE4Bv KX5w== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=be/pxzH2yee+ayE+lzr2cQdQomxXrrIXEUbXGXuyNDE=; b=JTDoYjGda8XPhybTsTT2kmJCJ3PEOOE7NZO56Q7B80Sc1Aen70kq2NRpdQtoIp4TUR cOskbYeCcGSQJKcHr+KZifBt3bpy48vwrY05aVWqJKO+Ien0C9/8jEks/t7Evc8m9RWh iwzuRwnLcsohUGI5BWB3h1w0Qp4Ilrlai4aOrDCwAiQkXOGTwfEb7Aiuf0pKBBK7I1NG 5GPFgqkEuPCCVY8TZ8bWTZ+SFop/fMj/YbgePC9ADTFp9WgwaTC/4Xdacmg4DBKIJl9U RloE4lwZ78bwfb5KFd+dr42TBmbfOipGtgUnHY6Iu0YxgwF1jD9PcsBSAdkULl346XpW jHyw== 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 y92si1141460plb.245.2019.05.09.06.39.30; Thu, 09 May 2019 06:39:46 -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 S1726734AbfEINic (ORCPT + 99 others); Thu, 9 May 2019 09:38:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:46980 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726195AbfEINic (ORCPT ); Thu, 9 May 2019 09:38:32 -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 95C3EABAC; Thu, 9 May 2019 13:38:30 +0000 (UTC) Date: Thu, 9 May 2019 15:38:29 +0200 From: Michal =?UTF-8?B?U3VjaMOhbmVr?= To: Petr Mladek Cc: Linus Torvalds , linux-arch@vger.kernel.org, Sergey Senozhatsky , Heiko Carstens , linux-s390@vger.kernel.org, Rasmus Villemoes , linux-kernel@vger.kernel.org, Steven Rostedt , Michal Hocko , Sergey Senozhatsky , Stephen Rothwell , Andy Shevchenko , linuxppc-dev@lists.ozlabs.org, Martin Schwidefsky , "Tobin C . Harding" Subject: Re: [PATCH] vsprintf: Do not break early boot with probing addresses Message-ID: <20190509153829.06319d0c@kitsune.suse.cz> In-Reply-To: <20190509121923.8339-1-pmladek@suse.com> References: <20190509121923.8339-1-pmladek@suse.com> Organization: SUSE Linux X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-suse-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, 9 May 2019 14:19:23 +0200 Petr Mladek wrote: > The commit 3e5903eb9cff70730 ("vsprintf: Prevent crash when dereferencing > invalid pointers") broke boot on several architectures. The common > pattern is that probe_kernel_read() is not working during early > boot because userspace access framework is not ready. > > The check is only the best effort. Let's not rush with it during > the early boot. > > Details: > > 1. Report on Power: > > Kernel crashes very early during boot with with CONFIG_PPC_KUAP and > CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG > > The problem is the combination of some new code called via printk(), > check_pointer() which calls probe_kernel_read(). That then calls > allow_user_access() (PPC_KUAP) and that uses mmu_has_feature() too early > (before we've patched features). There is early_mmu_has_feature for this case. mmu_has_feature does not work before patching so parts of kernel that can run before patching must use the early_ variant which actually runs code reading the feature bitmap to determine the answer. Thanks Michal