Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3649695imm; Mon, 25 Jun 2018 02:10:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIW0S6dPxieUKIQK/bjtC3uslym3GUQELBU0dAgXlqMrM8EV4nBHFIXcrkP9bsRGQIi4ftn X-Received: by 2002:a63:8341:: with SMTP id h62-v6mr3360572pge.298.1529917837883; Mon, 25 Jun 2018 02:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529917837; cv=none; d=google.com; s=arc-20160816; b=DWhR9+JqIVkX7xcIII9jlNjJoud3XWzPDmPWnMTqn9KxQqnrh+JDixjBEabdwJvIRN UdcwYg1vagXPvxRaFM/R3ynIbd8NSPr3l+A4FRrqJ476Gx1WrhKmggTqKV4/kkvKcBy1 AsfcbF2KEyYLa6Kw3AMDDwiB1AHc80yAwp2e9rTD490hK+wUy/VFjv3g1/CSDiSZ6b63 ctMVblZfFDJWpuD2jtXNM9qR3yyEfRMK1m6NOrBt9M+R7SKD/m5FpUqdRwlU2NEU6roX tuNbCWPuJ90W03+gPYLzERM/W6adOYvGgAmTStIyVjhg+eVNZoM3nU48sOrWeg8q3g8L zESg== 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:dkim-signature:arc-authentication-results; bh=T4IcgGg6PdWvhDaUl9WTorcuQL/6wKnWxj8NavTnoZE=; b=P0YM+0K1aD8F48GmdwtuKFlmEzLm0LjBFAFktzG/hCyFWlTy/oP8UmplC+cK2ky4lM fNkir29EYMokGTj7YPaI47XCSeD6S8dzahQGLLQAnsH/s2Tj+IU61jva1iocG2TKt0Da 73cQdmlWUPjYvMsnp5gfl0yHrNgcXTj2NNQlurvjAR3U89XFSWMi5PVDfn/thJo75D1B uO9SYP6gHKME3aLYdczxTxgNhT/HdgVRDTg3jjyJx9BEdcW+b6Bi5ux3dgkZ52J6Ei8a oAYXhRaph71CzoV2JBJ11+ycrNZzibVawBid257W2P0BU1fhPXBfjsrdqtdoM7TZkZT7 DQwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="pkHgu/f7"; 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 w76-v6si4184495pfi.88.2018.06.25.02.10.22; Mon, 25 Jun 2018 02:10:37 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="pkHgu/f7"; 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 S1754705AbeFYJJd (ORCPT + 99 others); Mon, 25 Jun 2018 05:09:33 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44496 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754449AbeFYJJc (ORCPT ); Mon, 25 Jun 2018 05:09:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=T4IcgGg6PdWvhDaUl9WTorcuQL/6wKnWxj8NavTnoZE=; b=pkHgu/f7xRh3z10uhRLgjfD82 LqxSGC+lA8hvE/fGShfdm2/cVt5dcoPADfFUPhHq3T8mLH5olw/JvikOaJ40xnmIVxABxXuqAjvlJ fOE5dEKll2tE1mdOhMtY/YIXODcorRTuxXXxS9IMkm/NLetqX3svL3rSiUpYvYj3sSzL5qhvnpuPU RVKVd7YadayfhoHyATJzuCa+WP6mekCTIa8YNdz5AtrbSWC7SQvZrqrixhAAekJxAgqMfc1QJfz0K tEbAOU1PAQcRSbuIJhg4/qG8bODziP7vGt3CO1p3+wa9V+xjwrGDf9sYYdOdIo7fgLC/l69uOpu7w Z2Yq6Qgaw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fXNUr-0001qN-B3; Mon, 25 Jun 2018 09:09:17 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CC2182029F1D9; Mon, 25 Jun 2018 11:09:15 +0200 (CEST) Date: Mon, 25 Jun 2018 11:09:15 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: Pavel Tatashin , steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com, douly.fnst@cn.fujitsu.com, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org, Steven Rostedt Subject: Re: [PATCH v12 01/11] x86: text_poke() may access uninitialized struct pages Message-ID: <20180625090915.GV2494@hirez.programming.kicks-ass.net> References: <20180621212518.19914-1-pasha.tatashin@oracle.com> <20180621212518.19914-2-pasha.tatashin@oracle.com> <20180625081429.GS2494@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 25, 2018 at 10:39:24AM +0200, Thomas Gleixner wrote: > On Mon, 25 Jun 2018, Peter Zijlstra wrote: > > On Thu, Jun 21, 2018 at 05:25:08PM -0400, Pavel Tatashin wrote: > > > -void *text_poke(void *addr, const void *opcode, size_t len) > > > +void __ref *text_poke(void *addr, const void *opcode, size_t len) > > > { > > > unsigned long flags; > > > char *vaddr; > > > struct page *pages[2]; > > > int i; > > > > > > + /* While boot memory allocator is runnig we cannot use struct > > > > Broken comment style.. > > > > > + * pages as they are not yet initialized. However, we also know > > > + * that this is early in boot, and it is safe to fallback to > > > + * text_poke_early. > > > + */ > > > + if (unlikely(!after_bootmem)) > > > + return text_poke_early(addr, opcode, len); > > > > I'm not entirely sure this is right.. Because not only do we need the > > whole fixmap stuff working, we also need #DB and the IPI handlers set-up > > and working. > > IPI? That's early UP boot why would you need an IPI? Because the way this is called is from __jump_label_transform() -> text_poke_bp() -> text_poke() -> text_poke_early(). And if you look at text_poke_bp(), you'll note it relies on #DB and on_each_cpu() IPIs. Which is of course exactly the reason I avoided text_poke_bp() entirely in the first place.