Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp183677ybg; Sun, 31 May 2020 21:22:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgSbDlLl3tji4lqbHDL1hun3enkYVZH26edURt1w3LbqifQRetk+3KBNp3gPXMHKYcE8lq X-Received: by 2002:a17:906:15d8:: with SMTP id l24mr17559243ejd.479.1590985357601; Sun, 31 May 2020 21:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590985357; cv=none; d=google.com; s=arc-20160816; b=SdgQwdojPdpgnZAt2WIEwIscvzSwNzyDkxjLCI8OEA9uPbKnyIUM6+wYPu7G334UOo gdz8wxtgTC9mU/h6h5ymSNlp6mMTNHs0zfXB2hMM5so5GByk0wrb45lHXIdXXABDOKsa 0PKUWB/NI0bZ3NTzfuywP9ChFWzpdKkEU/iZwBExqV+mXq7/RPjGtXIhEfPnI6CeHlAT vDMkTXxmSQ51jLjWaW+mWNzXtkGIi88mAhN0pJoBSamG2wps3C5pqgaN+EXLXgYsF7dR /Vpzj9xFCxtwCbELNVG1vZM7MIxVtyotGAg1OwzZnN6O8kH2D3VEqCmIY2u8iYBkS2W3 HRnw== 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; bh=8gaMeZxKRbbnoVLMQF6dqM6cOYIG1D5PJgYvrar+GJw=; b=QNfl4SW0zqA8T9xbn1R4I2y5q7UIEKFPV1Wr+/wMxr0uVRr8PnLrSKsokjwJeVthXZ 8c5kL0CZOxEXofVbqbaORK9zaKnFCv4vQTc8l9YQURGJNdm9u5DZayNU5GSgIaVUT8FY C/z9pymbxVnLPmKAvstAyqKxqodkDXvpyn6a7MpgxcFx7fffXDJ9AmMBDOiqTAbR/tKI chGDcqNebGIGBhOvrgTFU859oNf0C7aT3SzF4QjzSldfDKwT/M+bk1qzZ4WBAXkkLHDd 6EqCrkOrfN3XHJJM2uCK9zWM9DB9WqdGXClSvC+VRk6KhSskWkItrs986OcLU1hyjUNn +7MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=xwRDj4p2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ly15si3078301ejb.649.2020.05.31.21.22.14; Sun, 31 May 2020 21:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=xwRDj4p2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725838AbgFAEU1 (ORCPT + 99 others); Mon, 1 Jun 2020 00:20:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbgFAEU0 (ORCPT ); Mon, 1 Jun 2020 00:20:26 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D301C08C5C0 for ; Sun, 31 May 2020 21:20:26 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id c71so9340754wmd.5 for ; Sun, 31 May 2020 21:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8gaMeZxKRbbnoVLMQF6dqM6cOYIG1D5PJgYvrar+GJw=; b=xwRDj4p2YorlEnHTACn3XXVJQgsANhpObQcpjzC94GITlGstEOoiXLrC9N0kcg9uCT 8Q7bJusUHFS6AALVDmmxwiqw/+UIBfFGOzmzom09Ixj5/SNMY45MAUSTUg56uwscGso/ TNMYvsEhs9y3upvTHpG9Wu8hQ1w7c5ZEEfvt8tjj0w9fTYgA4cL/+sa4EtQDC4js9bQD zip8ZVFQGYKY1iBos5h1OVHEMQgJODeH3DUZi2qoiX6lHn5jrosM5Zl7GLMRPtGO/3NP WbOiNeiwzb2/uz3BRP+iefC+FQe/PnDH0F3L0ukmg9MBhPNEgWANuZum4wQ4ZJ+bzs/J GfGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8gaMeZxKRbbnoVLMQF6dqM6cOYIG1D5PJgYvrar+GJw=; b=Udnf6kjP3U21JMaCZ3NErSC4encI/SBRKdK/y3MN4DbVIorwJVsnIjNJVWoph43JVh 8w5xhXS75U9WnNo2EgEX4Bd+5o7SeOPxIE5x0g3eZC4f0PDP4tY+c9FurCtUZYVjVtYv s/EPQZ/VaHM2kV0qLU0YeL8oykj8cvUfJgUu5THRBDHTsuEvSUiXD5H7eNm4TXN2nWYZ QYTpx4fBlVjKAMNMvApydepY5//qDgXQwIerKtFoDS7NI3r0ggd8pKI/qpzzd+gDaUcd uVNRbyUkhlRzxCvH7WfdpooE90i8J0jhU5arosl2oj8wQlJkK3rHa42NZD9x4PpztQq3 ZbSg== X-Gm-Message-State: AOAM531h0R5ix2rMPjncJ/dJni3iumZBIrwnNf4gNaP25nD6U5FE0sGR 0+EPP66j7hoUnCVQKoMTR9p+Q/NVtHyiKBB+uU22fA== X-Received: by 2002:a1c:a3c5:: with SMTP id m188mr8963040wme.152.1590985224670; Sun, 31 May 2020 21:20:24 -0700 (PDT) MIME-Version: 1.0 References: <20200531095748.753388-1-anup.patel@wdc.com> In-Reply-To: <20200531095748.753388-1-anup.patel@wdc.com> From: Anup Patel Date: Mon, 1 Jun 2020 09:50:13 +0530 Message-ID: Subject: Re: [PATCH] RISC-V: Don't mark init section as non-executable To: Anup Patel Cc: Palmer Dabbelt , Paul Walmsley , Albert Ou , Atish Patra , Alistair Francis , linux-riscv , "linux-kernel@vger.kernel.org List" , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 31, 2020 at 3:28 PM Anup Patel wrote: > > The head text section (i.e. _start, secondary_start_sbi, etc) and the > init section fall under same page table level-1 mapping. > > Currently, the runtime CPU hotplug is broken because we are marking > init section as non-executable which in-turn marks head text section > as non-executable. > > Further investigating other architectures, it seems marking the init > section as non-executable is redundant because the init section pages > are anyway poisoned and freed. > > To fix broken runtime CPU hotplug, we simply remove the code marking > the init section as non-executable. > > Fixes: d27c3c90817e ("riscv: add STRICT_KERNEL_RWX support") > Cc: stable@vger.kernel.org > Signed-off-by: Anup Patel > --- > arch/riscv/mm/init.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 736de6c8739f..e0f8ccab8a41 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -482,11 +482,6 @@ static void __init setup_vm_final(void) > > void free_initmem(void) > { > - unsigned long init_begin = (unsigned long)__init_begin; > - unsigned long init_end = (unsigned long)__init_end; > - > - /* Make the region as non-execuatble. */ > - set_memory_nx(init_begin, (init_end - init_begin) >> PAGE_SHIFT); > free_initmem_default(POISON_FREE_INITMEM); > } I just realized that updated free_initmem() over here is exactly same as generic free_initmem() defined in init/main.c so it's better to remove free_initmem() from here. I will send v2. Regards, Anup