From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E12A0C04AB1 for ; Thu, 9 May 2019 13:47:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAECD205C9 for ; Thu, 9 May 2019 13:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726652AbfEINrG convert rfc822-to-8bit (ORCPT ); Thu, 9 May 2019 09:47:06 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:35843 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbfEINrG (ORCPT ); Thu, 9 May 2019 09:47:06 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-2-cILVDsqaNZKuy6_7SA1Hbw-1; Thu, 09 May 2019 14:47:00 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b::d117) by AcuMS.aculab.com (fd9f:af1c:a25b::d117) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 9 May 2019 14:46:59 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 9 May 2019 14:46:59 +0100 From: David Laight To: =?iso-8859-1?Q?=27Michal_Such=E1nek=27?= , 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 Thread-Topic: [PATCH] vsprintf: Do not break early boot with probing addresses Thread-Index: AQHVBmyk/iTC8Q7sI0elwkZY5/gFJaZizfQA Date: Thu, 9 May 2019 13:46:59 +0000 Message-ID: <8ad8bb83b7034f7e92df12040fb8c2c2@AcuMS.aculab.com> References: <20190509121923.8339-1-pmladek@suse.com> <20190509153829.06319d0c@kitsune.suse.cz> In-Reply-To: <20190509153829.06319d0c@kitsune.suse.cz> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: cILVDsqaNZKuy6_7SA1Hbw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Suchánek > Sent: 09 May 2019 14:38 ... > > 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. Does the early_ variant get patched so the it is reasonably efficient after the 'patching' is done? Or should there be a third version which gets patched across? David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47B43C04AB1 for ; Thu, 9 May 2019 17:51:09 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93BB22089E for ; Thu, 9 May 2019 17:51:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93BB22089E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ACULAB.COM Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 450LVd67KqzDqS3 for ; Fri, 10 May 2019 03:51:05 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=aculab.com (client-ip=207.82.80.151; helo=eu-smtp-delivery-151.mimecast.com; envelope-from=david.laight@aculab.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ACULAB.COM Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [207.82.80.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 450LSt2YClzDqRW for ; Fri, 10 May 2019 03:49:31 +1000 (AEST) Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-2-cILVDsqaNZKuy6_7SA1Hbw-1; Thu, 09 May 2019 14:47:00 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b::d117) by AcuMS.aculab.com (fd9f:af1c:a25b::d117) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 9 May 2019 14:46:59 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 9 May 2019 14:46:59 +0100 From: David Laight To: =?iso-8859-1?Q?=27Michal_Such=E1nek=27?= , Petr Mladek Subject: RE: [PATCH] vsprintf: Do not break early boot with probing addresses Thread-Topic: [PATCH] vsprintf: Do not break early boot with probing addresses Thread-Index: AQHVBmyk/iTC8Q7sI0elwkZY5/gFJaZizfQA Date: Thu, 9 May 2019 13:46:59 +0000 Message-ID: <8ad8bb83b7034f7e92df12040fb8c2c2@AcuMS.aculab.com> References: <20190509121923.8339-1-pmladek@suse.com> <20190509153829.06319d0c@kitsune.suse.cz> In-Reply-To: <20190509153829.06319d0c@kitsune.suse.cz> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: cILVDsqaNZKuy6_7SA1Hbw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , Sergey Senozhatsky , Rasmus Villemoes , "linuxppc-dev@lists.ozlabs.org" , Heiko Carstens , "linux-kernel@vger.kernel.org" , Steven Rostedt , Michal Hocko , Sergey Senozhatsky , Stephen Rothwell , Andy Shevchenko , Linus Torvalds , Martin Schwidefsky , "Tobin C . Harding" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Michal Such=C3=A1nek > Sent: 09 May 2019 14:38 ... > > 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 earl= y > > (before we've patched features). >=20 > 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. Does the early_ variant get patched so the it is reasonably efficient after the 'patching' is done? Or should there be a third version which gets patched across? =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)