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=-5.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 F37F3C433E2 for ; Mon, 14 Sep 2020 10:40:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 614B62076C for ; Mon, 14 Sep 2020 10:40:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=aurel32.net header.i=@aurel32.net header.b="cIcaToVt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726471AbgINKj6 (ORCPT ); Mon, 14 Sep 2020 06:39:58 -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