Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3938198imm; Mon, 25 Jun 2018 07:08:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLqnGlo8jek/5T+qKamEaPK8oBjayBD+z/qV+S9DJvVUMDXyUW4NcC0DtPqUl0FQM/2oZrH X-Received: by 2002:a17:902:206:: with SMTP id 6-v6mr12713823plc.294.1529935698861; Mon, 25 Jun 2018 07:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529935698; cv=none; d=google.com; s=arc-20160816; b=kre4godqiqZrg3ZZF0wvhqJapj8SC5MW/cmxXWP3tNt43nuoSwoHztpnR67qMvwKdB lQsl5Fj+3GCZzLKzop+YeYR1W+9KzS8dDvCBVZ//XbOvLrIQWHlRvreDAST+Pl5QcwxL ZpAY3ZF1JorxaGHL6yfGz+KcbTVNej3CUNu6hdMKGAgxnYPgc92ljw7sSwqZEmX2oLqR XAxhJflnXtQh6QtMt3kT0kcpH0ERyauFNH6yUppApMOTtZ9eTwwZ9nf6Z6SIn/OC+4qC 7uO800RpurOAe9mUYXCFZQbpleOrwAQ+2ADOBwC27GXOwD1KcE0QPjMgmQgEE5of+8UK xnGQ== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=7ndiITZ+2qweKohVfD8O03LlwPBea3Eg9F3AGiqEUu0=; b=aJP08v9WoJuZX5WYBlzlkyuli1N2+hxoLwBur9BEc9R3AQldZdJ3K/TyUlJs0+dXkR qccclfK4MyQLXnH/8yL9eC+TkC2DveXy10PyGK1LrNbsUC7LjNVEOv2vgdnVIVIM1n+5 KBmQsr4nOI/5PydHEA1HY+WCqEw0CfjELWjwc86bRK0DmHCWwOxzGWhE0tyQMfeGV/G6 QRFllXVRECvm5NEyFyJucCnheu9xCyGR4sIPXZ8jm4/PytJ3VDmOIAM+hM2ep9YL8itc ZEkmHRgByDF8tW35ofJ8gCopIBlvUdX+laRQdR9DSK6yYV/Nh4RDdeWEV7wVET3Lj2K7 A8sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b="qb0/+fZI"; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9-v6si13711213pll.370.2018.06.25.07.08.00; Mon, 25 Jun 2018 07:08:18 -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=@oracle.com header.s=corp-2017-10-26 header.b="qb0/+fZI"; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934253AbeFYOG5 (ORCPT + 99 others); Mon, 25 Jun 2018 10:06:57 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:55782 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934074AbeFYOGz (ORCPT ); Mon, 25 Jun 2018 10:06:55 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5PE450X028744; Mon, 25 Jun 2018 14:06:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : references : in-reply-to : from : date : message-id : subject : to : cc : content-type; s=corp-2017-10-26; bh=7ndiITZ+2qweKohVfD8O03LlwPBea3Eg9F3AGiqEUu0=; b=qb0/+fZIpx6xjocuq0f6a8L6KATV0j92v/AJ1bcW4JoJpVJN6NVWct31+k/ZECb/qlem WJkpnpcwnGAkW+WqQT0ozxz4i6OzBL2r47Fahx8VxmkzZsM803Bc96lks09r4R9mkPLa X77GRTfCIXp/M7Nqel0+/BA5K0Fsqf5kXWY+5e6wBzWkt0Hp1BaoCNC9P6bAEe1rXC1w fQmDjPcApvWhKS83BS1W9fE0vJEdxCgCiitYL6clonJWiuK0WXj4RYaoVs3qyj5wREqJ eGMXeiScUe2Ssgf3iwexk6hp73A6dyPzZisjj7mSM9eQN8vXN4CtDKJ7QFvWJILaeqEp UA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2jt8a7jv3v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Jun 2018 14:06:54 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5PE6lLU025571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Jun 2018 14:06:47 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5PE6l3t010999; Mon, 25 Jun 2018 14:06:47 GMT Received: from mail-oi0-f51.google.com (/209.85.218.51) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 25 Jun 2018 07:06:47 -0700 Received: by mail-oi0-f51.google.com with SMTP id 21-v6so1927416oip.8; Mon, 25 Jun 2018 07:06:46 -0700 (PDT) X-Gm-Message-State: APt69E35RXv8v4d2KiPPg5CrYUWim3wNiTHPCCaMWVTgEsAQetnlWKzd iWYsh9qYySv7GlGvaGYQscLc45hYwXpEZ3V3aNM= X-Received: by 2002:aca:3b09:: with SMTP id i9-v6mr7467357oia.156.1529935606442; Mon, 25 Jun 2018 07:06:46 -0700 (PDT) MIME-Version: 1.0 References: <20180621212518.19914-1-pasha.tatashin@oracle.com> <20180621212518.19914-2-pasha.tatashin@oracle.com> <20180625081429.GS2494@hirez.programming.kicks-ass.net> <20180625090915.GV2494@hirez.programming.kicks-ass.net> <20180625092229.GW2494@hirez.programming.kicks-ass.net> <20180625134851.GB2494@hirez.programming.kicks-ass.net> In-Reply-To: <20180625134851.GB2494@hirez.programming.kicks-ass.net> From: Pavel Tatashin Date: Mon, 25 Jun 2018 10:06:10 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v12 01/11] x86: text_poke() may access uninitialized struct pages To: peterz@infradead.org Cc: tglx@linutronix.de, Steven Sistare , Daniel Jordan , linux@armlinux.org.uk, schwidefsky@de.ibm.com, Heiko Carstens , John Stultz , sboyd@codeaurora.org, x86@kernel.org, LKML , mingo@redhat.com, hpa@zytor.com, douly.fnst@cn.fujitsu.com, prarit@redhat.com, feng.tang@intel.com, Petr Mladek , gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org, Steven Rostedt Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8934 signatures=668703 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1806250164 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Also, I think the better condition is @early_boot_irqs_disabled, until > we enable IRQs for the first time, text_poke_early() should be fine. And > once we enable interrupts, all that other crud should really be working. Sure, I will use early_boot_irqs_disabled flag. I think, we still want to have BUG_ON(!after_bootmem); in text_poke(). I could do BUG_ON(early_boot_irqs_disabled), but I am worried that there are call sites that might be using text_poke() between mem_init() and local_irq_enable() in start_kernel(). > > This gives: > > diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c > index e56c95be2808..425ba6102828 100644 > --- a/arch/x86/kernel/jump_label.c > +++ b/arch/x86/kernel/jump_label.c > @@ -46,6 +46,9 @@ static void __jump_label_transform(struct jump_entry *entry, > const unsigned char default_nop[] = { STATIC_KEY_INIT_NOP }; > const unsigned char *ideal_nop = ideal_nops[NOP_ATOMIC5]; > > + if (early_boot_irqs_disabled) > + poker = text_poke_early; > + > if (type == JUMP_LABEL_JMP) { > if (init) { > /* > > > Also, modify text_poke_early to call sync_core(). Also, we still need to add __ref to __jump_label_transform as text_poke_early() is __init