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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9337FC433EF for ; Tue, 21 Dec 2021 09:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tqnz+xRPpbGyqwQbSc+VFDY77RYXQtGR0gm5WAgA0G8=; b=rzQqxAq7JDlVO+ Py6Wp9Gg15OfbuDgBNQwkBxoH9SYJO6AhkmZj9FiVNDfkN2snW5tKLYxxEDPw9TaVqpFuv3gCifnf vTC5+zBqdHZ/qNNQ6SnF+Mq0CSo+p/LUpS5TBXS1lz0rd1mowG1zNl0MuJLrdmJiG841BeQkEd9wH tQh8oDazMuIG8hS6lzACP7fpWAkdrj1szz7HCQpf5TR9IukzxtATLQGv+x+lX71VvFvWXXDS259Fs 0WPzMbWD6l6kZTbYOjNJ+4BrWdDBN5zVZNNvJD8IHOfMChpK4agwpSrYKPn5dF4CAUWbbr/mz0WPR Zxdv0ef34XGF2dbhnsig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzbsl-006IA1-C7; Tue, 21 Dec 2021 09:56:31 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzbsf-006I8B-UP for linux-arm-kernel@lists.infradead.org; Tue, 21 Dec 2021 09:56:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=S0BQZTMwuXJKwBE41rMQETrlaUpB9DgVGX/MSnAdwYs=; b=O5whduXDU1UKYQY5xzxMYmecMJ I0K9o0WXX46mn0IZwQZXTMPToILfrxG6OoYSeZtgfyi57q1RmLdB0qQCgX8Ivbiv515gv0eE6B26Z 5AGAuCUS7TPkveh40UuLV5m74Eq8dAsVdi5rlLddpLibBhbD59DWnOzyZW2W+4IvKbbsQvdy1Wqva Y7vbASn/aif+EUX/aZnA5dY6KPREtytRJ1jViGGqpG0zkt3mAzpIwdNZe3JSMgchznxyLBTMeFnq5 XTNdyDt6yH1rMYs+rU5MIobjLtZwOMy8qn/6ezSwFU9WbWNraCSJ8GxaQvDcFw/f0FvX15OgtDR0C sy0sRnBA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:56388) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mzbsZ-0004Hy-Vp; Tue, 21 Dec 2021 09:56:20 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1mzbsX-0002RS-Vr; Tue, 21 Dec 2021 09:56:17 +0000 Date: Tue, 21 Dec 2021 09:56:17 +0000 From: "Russell King (Oracle)" To: Alexander Gordeev Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thierry Reding , Arnd Bergmann Subject: Re: [PATCH] asm/sections: fix memory object end check Message-ID: References: <20211221070624.1541842-1-agordeev@linux.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211221070624.1541842-1-agordeev@linux.ibm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211221_015626_092632_1ACCFA49 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Dec 21, 2021 at 08:06:24AM +0100, Alexander Gordeev wrote: > Function memory_contains() checks whether a memory object is > entirely contained within a memory region. The condition that > checks the upper bound of the object against the upper bound > of the region is inclusive. That does not correspond to the > similar checks in memory_intersects() friend function, nor > to the actual regions memory_contains() is called against. > > In particular, __init_end address assumed do not belong to > the init section itself. Similarly, on ARM __idmap_text_end > and __entry_text_end are affected. __init_end is exclusive as are the other symbols you mention here. They point at the byte immediately following the area. When testing an virt + size, the resulting address of "virt + size" is always exclusive - this also points at the byte immediately following the range of addresses. The preceeding byte is part of the object. For example, if size is one, then we have a single byte, which is at address "virt". "virt + 1" is not part of the object. Therefore, if size is 1MiB, then "virt + 1048576" is similarly not part of the object. Hence, we _do_ want to test address + size <= end. This code appears to me to be correct, and this patch _introduces_ a bug. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel