From patchwork Fri Feb 26 16:57:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 63086 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp821739lbc; Fri, 26 Feb 2016 08:59:14 -0800 (PST) X-Received: by 10.98.13.216 with SMTP id 85mr3435275pfn.143.1456505954877; Fri, 26 Feb 2016 08:59:14 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id i3si4323957pap.187.2016.02.26.08.59.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Feb 2016 08:59:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aZLib-0002vX-Ty; Fri, 26 Feb 2016 16:58:17 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aZLi2-0002eV-NY for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2016 16:57:44 +0000 Received: by mail-wm0-x22f.google.com with SMTP id g62so81321652wme.1 for ; Fri, 26 Feb 2016 08:57:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Qac39PRIriZSuuf86eJDtYYaiL88wlL/NkUxgWz168E=; b=klNpxHuqP8vm5aCa2bnyALOoTQd1sSMA0Z/qfp7EMgBjQAVQsR+PGmByCzWoWs27VR 3e+fJ2fERoCyYooaWA0V0QFPB+hEyJnv9enXfUliSfaLnteWpPxhm5BVVC6X3h97bj5l TlHY5ABZ1nZszRDcoIzA8gD16aKlUSeDETiDs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Qac39PRIriZSuuf86eJDtYYaiL88wlL/NkUxgWz168E=; b=YNpl7d7/rMZTJm+fm4Wwy1o5joovkwRUC5vOCsbKRBAI4oFGwVsc9u8SgqJj0kv/aN /R2BHRyEjONwC6mRwJcDX3HFJL2CNLEjIVXjWF2+h7oH8rqG2RKux9yjRkg/Ggpf+clR X/IdJVYoyQND3VUKtB87eEqeBcXWJVqcsfgfI8dIaxUcWM5O3upzT18l5gP48aCw7Hoe lahirwNh9py7f/E6K/c4s3MM0hCpziLv3R6d8BGgnX+ePUVy5mXVfuoKskpCMKAjS5Mf ATJ8FcnNhz4vyEYtFIDPUIYW5AhX96rVocbsD86tECg/SGtB+meSqzBAIMVyGGdskhJB r+XA== X-Gm-Message-State: AD7BkJIs5C0vV/8HToO+EDSR+r3LAuDZIRSq5jb2fe3Bk3IyN+Vgk/95Ek77fQiXS2ten4Cc X-Received: by 10.194.185.108 with SMTP id fb12mr2803464wjc.89.1456505841134; Fri, 26 Feb 2016 08:57:21 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id p125sm3632550wmd.16.2016.02.26.08.57.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Feb 2016 08:57:20 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com Subject: [PATCH v2 2/2] arm64: mm: treat memstart_addr as a signed quantity Date: Fri, 26 Feb 2016 17:57:14 +0100 Message-Id: <1456505834-8638-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456505834-8638-1-git-send-email-ard.biesheuvel@linaro.org> References: <1456505834-8638-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160226_085743_031553_F9485E33 X-CRM114-Status: GOOD ( 11.61 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:22f listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Commit c031a4213c11 ("arm64: kaslr: randomize the linear region") implements randomization of the linear region, by subtracting a random multiple of PUD_SIZE from memstart_addr. This causes the virtual mapping of system RAM to move upwards in the linear region, and at the same time causes memstart_addr to assume a value which may be negative if the offset of system RAM in the physical space is smaller than its offset relative to PAGE_OFFSET in the virtual space. Since memstart_addr is effectively an offset now, redefine its type as s64 so that expressions involving shifting or division preserve its sign. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/memory.h | 2 +- arch/arm64/mm/init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 5f8667a99e41..12f8a00fb3f1 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -135,7 +135,7 @@ #include #include -extern phys_addr_t memstart_addr; +extern s64 memstart_addr; /* PHYS_OFFSET - the physical address of the start of memory. */ #define PHYS_OFFSET ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; }) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 4ea7efc28e65..a2977d33e0dc 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -54,7 +54,7 @@ * executes, which assigns it its actual value. So use a default value * that cannot be mistaken for a real physical address. */ -phys_addr_t memstart_addr __read_mostly = ~0ULL; +s64 memstart_addr __read_mostly = -1; phys_addr_t arm64_dma_phys_limit __read_mostly; #ifdef CONFIG_BLK_DEV_INITRD