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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham 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 ADA97C4338F for ; Wed, 28 Jul 2021 14:46:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8848460F91 for ; Wed, 28 Jul 2021 14:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236959AbhG1Oqw (ORCPT ); Wed, 28 Jul 2021 10:46:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:54864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235521AbhG1Oqw (ORCPT ); Wed, 28 Jul 2021 10:46:52 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4215C60527; Wed, 28 Jul 2021 14:46:49 +0000 (UTC) Date: Wed, 28 Jul 2021 10:46:42 -0400 From: Steven Rostedt To: Kefeng Wang Cc: , , , , , , , , , , , Sergey Senozhatsky , Petr Mladek , "Sergey Senozhatsky" Subject: Re: [PATCH v2 2/7] kallsyms: Fix address-checks for kernel related range Message-ID: <20210728104642.7ae75442@oasis.local.home> In-Reply-To: <20210728081320.20394-3-wangkefeng.wang@huawei.com> References: <20210728081320.20394-1-wangkefeng.wang@huawei.com> <20210728081320.20394-3-wangkefeng.wang@huawei.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Wed, 28 Jul 2021 16:13:15 +0800 Kefeng Wang wrote: > The is_kernel_inittext/is_kernel_text/is_kernel function should not > include the end address(the labels _einittext, _etext and _end) when > check the address range, the issue exists since Linux v2.6.12. > > Cc: Arnd Bergmann > Cc: Sergey Senozhatsky > Cc: Petr Mladek > Acked-by: Sergey Senozhatsky > Reviewed-by: Petr Mladek > Signed-off-by: Kefeng Wang Reviewed-by: Steven Rostedt (VMware) -- Steve > --- > include/linux/kallsyms.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h > index 2a241e3f063f..b016c62f30a6 100644 > --- a/include/linux/kallsyms.h > +++ b/include/linux/kallsyms.h > @@ -27,21 +27,21 @@ struct module; > static inline int is_kernel_inittext(unsigned long addr) > { > if (addr >= (unsigned long)_sinittext > - && addr <= (unsigned long)_einittext) > + && addr < (unsigned long)_einittext) > return 1; > return 0; > } > > static inline int is_kernel_text(unsigned long addr) > { > - if ((addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)) > + if ((addr >= (unsigned long)_stext && addr < (unsigned long)_etext)) > return 1; > return in_gate_area_no_mm(addr); > } > > static inline int is_kernel(unsigned long addr) > { > - if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) > + if (addr >= (unsigned long)_stext && addr < (unsigned long)_end) > return 1; > return in_gate_area_no_mm(addr); > }