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 DB4B4C27C77 for ; Wed, 12 Jun 2024 13:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=d89DrUEs1kIDLyhtwQqJqL6IksFgShhaBWcU6xLTz3Q=; b=X55vqaNsIvFgYrYn1GCvOhxfNy nZxKoMWKIHWc1F9iyaJhORwUZcPK7bzJ9HSJJ8KbPAOZ6yL+os7aMkVIj2Fmu2eLrzSUjGcKhltbr OAOIU1U2R/fCVB+laW0D7a4mM8rvdmI/ikfzOC6KEN1nNHgToS8B2UfqeCGcSlX/PK1Cojvw+TGMW jzP0P5oHaPtNVRWwmEKRwKjZm+tSA0SsMrr2QpzUPMnp/Qi++EH4/OLTjaDqqHoMgswrQyDzN4p4D 44AuHVnUObaaWy7Lv9x2IDmi2WenJHVxZFTz0DR7QvzwyZNKNbVQqYQEdpCE/lq0VeZx9VT7+kv2I 1PF6MUmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHOL5-0000000CnV8-1WeX; Wed, 12 Jun 2024 13:48:35 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:242:246e::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHOL3-0000000CnU2-0KnE for linux-um@lists.infradead.org; Wed, 12 Jun 2024 13:48:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=d89DrUEs1kIDLyhtwQqJqL6IksFgShhaBWcU6xLTz3Q=; t=1718200112; x=1719409712; b=alLh+4bCA0DslniY1BMS8UGRj0h6IytDhw9Np7ulbzfVe46 NfkqRlfyV93FNJgxjuG8O9wfC5kPHJMKyhsWFdwTvQWHuDKCGb0UUtX+yN6eroVd+ZVLaODU6R04h Eh622cJkmAzxE9Lt6XVV2L2wrgzXsTXnsAd5GZqpWAksw8HJVxNS2z4MifWERfFSF9+2QGLOMXfgr 7wEG+JegyHzYFIyjxQjLqa5KgJWqm8aHfIngxBZ2JRf/jTTXp6lWYll5Cxr0rlJN1eLbj5FZue5h0 2BG/Bl6Z1tkEWG56LQwXSQQ0YrywJoPzpirMhSSBYJqEZq28v+YMGBnV1ahi/IWA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1sHOL0-0000000ALhN-1dvV; Wed, 12 Jun 2024 15:48:30 +0200 From: benjamin@sipsolutions.net To: linux-um@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH v2 1/5] um: Fix stub_start address calculation Date: Wed, 12 Jun 2024 15:48:00 +0200 Message-ID: <20240612134804.1626427-2-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240612134804.1626427-1-benjamin@sipsolutions.net> References: <20240612134804.1626427-1-benjamin@sipsolutions.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_064833_187869_B40707CA X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org From: Benjamin Berg The calculation was wrong as it only subtracted one and then rounded down for alignment. However, this is incorrect if host_task_size is not already aligned. This probably worked fine because on 64 bit the host_task_size is bigger than returned by os_get_top_address. Signed-off-by: Benjamin Berg --- arch/um/kernel/um_arch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index e95f805e5004..0d8b1a73cd5b 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -331,7 +331,8 @@ int __init linux_main(int argc, char **argv) /* reserve a few pages for the stubs (taking care of data alignment) */ /* align the data portion */ BUILD_BUG_ON(!is_power_of_2(STUB_DATA_PAGES)); - stub_start = (host_task_size - 1) & ~(STUB_DATA_PAGES * PAGE_SIZE - 1); + stub_start = (host_task_size - STUB_DATA_PAGES * PAGE_SIZE) & + ~(STUB_DATA_PAGES * PAGE_SIZE - 1); /* another page for the code portion */ stub_start -= PAGE_SIZE; host_task_size = stub_start; -- 2.45.1