Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2055896pxk; Mon, 14 Sep 2020 03:43:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzo645/7oKfDwr3/aInRA5sMCpD++dcsggtXEBVsqzRNSVWVCo0IeIh45p5r/4CN1j17rzL X-Received: by 2002:a17:906:729e:: with SMTP id b30mr13759928ejl.479.1600080196315; Mon, 14 Sep 2020 03:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600080196; cv=none; d=google.com; s=arc-20160816; b=o1mScXGJ/V3kV06GVu5TZdh8YbR33tJJ2OoY0DxXPCGJKLJHYTf3oJFDcKOy8d6NEx AbW8vrgkJpRQirIjLnnALibkB7+JCsAb90PWuFnvYu38T/vfVixBZCYabPKQDdjkrQ/V hcZQQ5hP7zRWTwlE1OBVRV+6exvgdJP0jTl5HElQJLrTRFkUpylVqIoH79tkKSYpBfmq JHl+fcWd+ybtemxxH5E7R47s980M7U1pwQC9KWUDoKCf5Izgm4nb/jSTC0odsLXb74M3 gQ6r8NitD8S2iPp2MqS73iO8U1rNYYDVDlbeiHkO5BD8DlW2e4dwKB6MEPyzBCTmw1r4 mM0A== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=wlDIRDEfQWNob552Fwn5LzRLZbzE03QEuC1qTEAINRc=; b=0T4rUlRfeXZNBsQMBfr+JLwYYL2CKNuxCzZK9ruShs4vcp2ark89hYh13LVdt28aZ4 6Bfzw2cr+gRrhXMHIiPQXARiP02C9qlSLYY8Giqp836/k/LgTPI3qAlTQSXtgftIn0CL kRjfkeAQYH3+ylaT0SP0nmjHtxL3uuSgEU2S23L7Y8I9k85jyhUgyY/5QwjQu3ph6Ov7 TWryYfVRmDYSlDq90WzsQ7C3nX1VtALy2tCTEQHUZ2pBo0tJzONYf6qyIkE9m2U+H+qR RKchvjJc76Cjn6Z+P++IFXrawIDqH4oV5MNM0fyzZHZoy99shYtpag4BzhBefDEiODup YBhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aurel32.net header.s=202004.hall header.b=cIcaToVt; 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 c17si6924183ejx.205.2020.09.14.03.42.53; Mon, 14 Sep 2020 03:43:16 -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=@aurel32.net header.s=202004.hall header.b=cIcaToVt; 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 S1726458AbgINKjs (ORCPT + 99 others); Mon, 14 Sep 2020 06:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbgINKjM (ORCPT ); Mon, 14 Sep 2020 06:39:12 -0400 Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AAC1C06174A; Mon, 14 Sep 2020 03:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Content-Transfer-Encoding:From:Reply-To: Subject:Content-ID:Content-Description:X-Debbugs-Cc; bh=wlDIRDEfQWNob552Fwn5LzRLZbzE03QEuC1qTEAINRc=; b=cIcaToVtgQV2EaIpn+9phQNfAf Xs+f1cwrLc7phMf80weTR9ISZSPzE0C4tpCZGbLV9An2Wpy9k9xjPSTziIN0UUSUxmthKj+TEGh4p JbrqNbMH5QnBvF8CCeIrt60XCHtye5EmobBMb3Fa1C64YZmeqCiisQHwknK9JDku02Hgu9b4R+SFt gbez+4TVMC+cQ9azI90zA50Vx4zry07F8glQ9yhqeF99KoxAi6N8Kyb7iCxi91my2VTfFzLOgwqiN SRKyU8CB5XZQ+MLWdfiJN3XRDUaXASQYhMY4wEHq1lufzoESIDrombnpb7FKjZ21PrndsJ/3Csbga hkmubpXA==; Received: from [2a01:e35:2fdd:a4e1:fe91:fc89:bc43:b814] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHlsb-0001fB-Oz; Mon, 14 Sep 2020 12:38:37 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.94) (envelope-from ) id 1kHlsa-00Cx5R-Sz; Mon, 14 Sep 2020 12:38:36 +0200 Date: Mon, 14 Sep 2020 12:38:36 +0200 From: Aurelien Jarno To: Guo Ren Cc: Palmer Dabbelt , Paul Walmsley , Anup Patel , Greentime Hu , Zong Li , Albert Ou , Thomas Gleixner , Tycho Andersen , Nick Hu , linux-riscv , Guo Ren , Linux Kernel Mailing List , linux-csky@vger.kernel.org Subject: Re: [PATCH V2 1/3] riscv: Fixup static_obj() fail Message-ID: <20200914103836.GB2705@aurel32.net> Mail-Followup-To: Guo Ren , Palmer Dabbelt , Paul Walmsley , Anup Patel , Greentime Hu , Zong Li , Albert Ou , Thomas Gleixner , Tycho Andersen , Nick Hu , linux-riscv , Guo Ren , Linux Kernel Mailing List , linux-csky@vger.kernel.org References: <1593266228-61125-1-git-send-email-guoren@kernel.org> <1593266228-61125-2-git-send-email-guoren@kernel.org> <20200911204512.GA2705@aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.14.6 (2020-07-11) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-09-12 10:39, Guo Ren wrote: > It's come from mm/usercopy.c > /* Is this address range in the kernel text area? */ > static inline void check_kernel_text_object(const unsigned long ptr, > unsigned long n, bool to_user) > { > unsigned long textlow = (unsigned long)_stext; > unsigned long texthigh = (unsigned long)_etext; > unsigned long textlow_linear, texthigh_linear; > > if (overlaps(ptr, n, textlow, texthigh)) > usercopy_abort("kernel text", NULL, to_user, ptr - textlow, n); > > The __init_text/data areas will be freed after bootup, so I think it should be: > - unsigned long textlow = (unsigned long)_stext; > + unsigned long textlow = (unsigned long)_text; > > That means _stext should include init_text/data and _text is only for freeable. I have no idea if it is the right thing to do or not, but I can confirm this fixes the issue. How should we proceed to get that fixed in time for 5.9? For the older branches where it has been backported (so far 5.7 and 5.8), should we just get that commit reverted instead? Thanks, Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net