Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4017309ybb; Mon, 6 Apr 2020 22:09:13 -0700 (PDT) X-Google-Smtp-Source: APiQypIFTkAeG7hTmRVQLzvloiCluSN+3SkKnA2K9txUTTgCV7GhRARzIt0GGrWdjDKzn97BQYha X-Received: by 2002:a9d:63c9:: with SMTP id e9mr186251otl.65.1586236153575; Mon, 06 Apr 2020 22:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586236153; cv=none; d=google.com; s=arc-20160816; b=gEgOCG2WsyY/wdRmeyPSTqEq8+aBollp6DjC3G9JG8ZrShN7lYzpgv761zxBK1+i9E XRjvE0LeF627nRhM+E20zLKBPc5v1KZbZRmfinzJPg1j/BesbKv8z1v4Cqj9hPD+l2Sj N8B5WyyYnflyExEZNZZNVE+z3zGWB5nPTeVGWLFZMLCmIJR6l0U3u25jxrQHhS4rdF+i gY0tjnyS4RQF/dBARhUjBgb6KueYRj0FRcuofWB417KkLBQM2vSAy6jQCH2wZeWj+n/C MEsk9FWG4rTACPHjApYWu7QAcxTfPvflK9E07ppiLmFAIBZuQagndIwHTm7IBHdrV9sj sKQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:to:subject:from; bh=kR5TWREsyqUXcW4PBPOrV/S1MaN10Jvq79eFy/DhZNk=; b=drEKCZfDy2L85A6Ww6b6nFDMSUUIriVNdrFK5dakRmcFimN3j8Hj9xftj8oNE8Ozxu b7Bx4t2HB2bUp9xXIKsIn//tuc4h1PuTZffgQ0ylfp3Q3BqW28yE215KoOP7wYgYnNVM JsBpwsJJPfrzm+DdzeFDm4wuOTsYrVtVGCBGvo1vH3HaXvN2ekLTrlCyG5WX2ZpcRHGD U+fYYGLmkoE3H1jSXwN59nENSDlNsDQ5VX4anRi1IdiynQimlFnxwSo+Ku6HhkplXf1b LaofYwdBOiteAa951AekybD5pE+gIop8zC2s21J8WKdox8PB2c7RN4fbwDSyiLv2viMH /NHw== ARC-Authentication-Results: i=1; mx.google.com; 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 y35si694263otb.315.2020.04.06.22.09.01; Mon, 06 Apr 2020 22:09:13 -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; 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 S1726704AbgDGFIR (ORCPT + 99 others); Tue, 7 Apr 2020 01:08:17 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:58413 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbgDGFIR (ORCPT ); Tue, 7 Apr 2020 01:08:17 -0400 X-Originating-IP: 2.7.45.25 Received: from [192.168.1.101] (lfbn-lyo-1-453-25.w2-7.abo.wanadoo.fr [2.7.45.25]) (Authenticated sender: alex@ghiti.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 3A5D660004; Tue, 7 Apr 2020 05:08:14 +0000 (UTC) From: Alex Ghiti Subject: Re: [PATCH RFC 1/8] riscv/kaslr: add interface to get kaslr offset To: Zong Li , palmer@dabbelt.com, paul.walmsley@sifive.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: Message-ID: Date: Tue, 7 Apr 2020 01:08:13 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/24/20 3:30 AM, Zong Li wrote: > Add interface to get the random offset. > > Signed-off-by: Zong Li > --- > arch/riscv/include/asm/page.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h > index 92848e172a40..e2c2020f0a8d 100644 > --- a/arch/riscv/include/asm/page.h > +++ b/arch/riscv/include/asm/page.h > @@ -101,6 +101,11 @@ extern unsigned long kernel_virt_addr; > extern unsigned long max_low_pfn; > extern unsigned long min_low_pfn; > > +static inline unsigned long get_kaslr_offset(void) > +{ > + return kernel_virt_addr - PAGE_OFFSET; > +} > + > #define __pa_to_va_nodebug(x) ((void *)((unsigned long) (x) + va_pa_offset)) > #define __va_to_pa_nodebug(x) ((unsigned long)(x) - va_pa_offset) > > No problem for this one: Reviewed-by: Alexandre Ghiti Thanks, Alex