Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp239655rdb; Thu, 21 Dec 2023 07:56:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbqZ1geKlt9Ixqlk8xIa2BndfE79gLXM+obRGJd0EamjvT+27ytVjX3lQlUeEZfbZ/m+42 X-Received: by 2002:a17:907:75cd:b0:a23:49c5:20d7 with SMTP id jl13-20020a17090775cd00b00a2349c520d7mr2332062ejc.119.1703174210331; Thu, 21 Dec 2023 07:56:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703174210; cv=none; d=google.com; s=arc-20160816; b=ZWJdtOENlIE1V8g5azxF2qOD8Zdy1TpTBpc0mc7DML+aU0Qrrk15kO3mxvJxFTIx1O nXJDOEQNi3h6LfMy0MVyW70ygz1CYsSsiOq+Uz99/hL0U6Sl7G+TIR2TfjqbKSzGK4I9 apgapCNkEjIKUeYT8p/i/ydToOtGo7M0seuTagIfqwM2W4/2Sau08pzZbvV+9NQ40VzH yModUisYebYD1b7zR1YE8HlVneNzO7S8WmTM0FTzrlvhsvNiHjv4DGdBK3Pl4/dlj2yS G26JhZT8U2oYsOqnmFTQgK3SiBNKEJPk5RmHJFK77DV7ry6kvfe9S8eT6hBOUlDqUmnh wgIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=P5fSU2y1bQrGuo1xDnVoB9ZBkV6O9GH5rhy3PHTHV0M=; fh=3YQLS1cPsLhMKuGGotL7Ux7rpkwBoh7ZT2nN27VXc5c=; b=MQFCw4WJIJCJFoRkBl7j95di6HavWy4mCeDOw7crKjPZ7LKZEHPmHXi5j/i4tyWPmV GpAEmA3xHd24AZWiDgiQxrII0lNPIT3bNXwXbcvX+IwIdPZSRCxU7Ox2YuWv25Y0t16v IN1YfaI6eOD3lt4mPZ+DasdrYj3eABOidCkwCw7nWXCPwApEsCU9WPrnP+MmWHFvfpIR IHl9tbIQTHVeBXQKiXP4z5HhrBww10ZewMqCnkcuio+UCPKVWOaU4bAq5J5/eyHyS7as 3/fiVLfKp0075qWnoB4qyxb9kivLM2oagJPCNxBJiVM9w5V7IW1WXFhtbFX89tl9iMX1 YAgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cDlxg7WA; spf=pass (google.com: domain of linux-kernel+bounces-8704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8704-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l16-20020a170906a41000b00a235b1d5de0si970348ejz.440.2023.12.21.07.56.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:56:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cDlxg7WA; spf=pass (google.com: domain of linux-kernel+bounces-8704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8704-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 63B8C1F2965F for ; Thu, 21 Dec 2023 15:47:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7683658204; Thu, 21 Dec 2023 15:47:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cDlxg7WA" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A625455E41; Thu, 21 Dec 2023 15:47:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8972C433C8; Thu, 21 Dec 2023 15:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703173638; bh=dOGyrLopRgWASgaIZLAx6CNRKKRLi1o/fzWOzw5hikY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDlxg7WA1eBIwKV7bwZmyHXskjpiO8H0zm7M2Ghzhr/xJdhhL6Xl5kRI6BWyYA5lD VBxAhJBQbB+9gO3Ag/gZJDFb+yKcYSbIwQNpD0ma517/zmjRtZImkNo7sEdHNxRaMo 1gXtByNw8LvPKTENtE7Eyo0fI2WALLGGdtPJwJF36c/Jju3NFsv75uhnr92pS3Mkxz 9QYAV4nD600gK2ZN6ikxvxtty6vjKnY3kXSgadf2i6U5AbJDy8ZsKxPN1iBVipFQBV fplnF8mxIeIWVezxJQwQjGSA/khdXnqsTghUjHSyjZpLYbroFFW3LkjSldkXwKqcCY 8N6jkGpF6/EHQ== From: guoren@kernel.org To: linux-kernel@vger.kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, alexghiti@rivosinc.com, charlie@rivosinc.com, xiao.w.wang@intel.com, guoren@kernel.org, david@redhat.com, panqinglin2020@iscas.ac.cn, rick.p.edgecombe@intel.com, willy@infradead.org, bjorn@rivosinc.com, conor.dooley@microchip.com, cleger@rivosinc.com, leobras@redhat.com Cc: linux-riscv@lists.infradead.org, Guo Ren , stable@vger.kernel.org Subject: [PATCH V2 2/4] riscv: mm: Fixup compat arch_get_mmap_end Date: Thu, 21 Dec 2023 10:46:59 -0500 Message-Id: <20231221154702.2267684-3-guoren@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231221154702.2267684-1-guoren@kernel.org> References: <20231221154702.2267684-1-guoren@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Guo Ren When the task is in COMPAT mode, the arch_get_mmap_end should be 2GB, not TASK_SIZE_64. The TASK_SIZE has contained is_compat_mode() detection, so change the definition of STACK_TOP_MAX to TASK_SIZE directly. Cc: stable@vger.kernel.org Fixes: add2cc6b6515 ("RISC-V: mm: Restrict address space for sv39,sv48,sv57") Signed-off-by: Guo Ren Signed-off-by: Guo Ren --- arch/riscv/include/asm/processor.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h index f19f861cda54..1f538fc4448d 100644 --- a/arch/riscv/include/asm/processor.h +++ b/arch/riscv/include/asm/processor.h @@ -16,15 +16,13 @@ #ifdef CONFIG_64BIT #define DEFAULT_MAP_WINDOW (UL(1) << (MMAP_VA_BITS - 1)) -#define STACK_TOP_MAX TASK_SIZE_64 +#define STACK_TOP_MAX TASK_SIZE #define arch_get_mmap_end(addr, len, flags) \ ({ \ unsigned long mmap_end; \ typeof(addr) _addr = (addr); \ - if ((_addr) == 0 || (IS_ENABLED(CONFIG_COMPAT) && is_compat_task())) \ - mmap_end = STACK_TOP_MAX; \ - else if ((_addr) >= VA_USER_SV57) \ + if ((_addr) == 0 || (_addr) >= VA_USER_SV57) \ mmap_end = STACK_TOP_MAX; \ else if ((((_addr) >= VA_USER_SV48)) && (VA_BITS >= VA_BITS_SV48)) \ mmap_end = VA_USER_SV48; \ -- 2.40.1