From patchwork Mon Oct 7 15:10:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11177755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EDE6813BD for ; Mon, 7 Oct 2019 15:10:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CCA7921479 for ; Mon, 7 Oct 2019 15:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570461031; bh=6r8t1dHquGoeni2YRJD6dXFGHQJJSEJgPmcLrD52UVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CCyDEGP3qUcR4me/4eDU5de3xrXdQ9iOpXdyHa/0+AW7mrBIpqLIvp5nNynBwFzfx YJNvwTEXQciY75hDPJePmyHsrQ5jlXtEkCanA/8+fKGHl9C1bbU3j7pbW/XzixnsQo 1GO8kS5f6JnLyVp3W8NZEHmS6YPDOTZVg1LQJhEE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727711AbfJGPKb (ORCPT ); Mon, 7 Oct 2019 11:10:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:35838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbfJGPKb (ORCPT ); Mon, 7 Oct 2019 11:10:31 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 345042070B; Mon, 7 Oct 2019 15:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570461030; bh=6r8t1dHquGoeni2YRJD6dXFGHQJJSEJgPmcLrD52UVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e/cmF24hrXBDDYcLA9BZjxFU+liz1gVBG1zCoAhvOiDQMgL7G1v2F+tf6vEL1xHAq 3IuarbMoRCj6tm7pAYmsv8LZqMLtmy916SylBjscyWkfvWUo3uW0E7uZ1w6CK7O9XB N2P8+ebCe91z0A9CNpQGnXWmkmnqmAm378qnwcqk= From: Masami Hiramatsu To: Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, jaswinder.singh@linaro.org, Alexey Dobriyan Subject: [BUGFIX PATCH 1/5] selftests: proc: Make va_max 3GB on 32bit arch Date: Tue, 8 Oct 2019 00:10:26 +0900 Message-Id: <157046102656.20724.3358140818300189230.stgit@devnote2> X-Mailer: git-send-email 2.20.1 In-Reply-To: <157046101671.20724.9561877942986463668.stgit@devnote2> References: <157046101671.20724.9561877942986463668.stgit@devnote2> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Currently proc-self-map-files-002.c sets va_max (max test address of user virtual address) to 4GB, but it is too big for 32bit arch and 1UL << 32 is overflow on 32bit long. Make va_max 3GB on 32bit arch like i386 and arm. Signed-off-by: Masami Hiramatsu Cc: Alexey Dobriyan --- .../selftests/proc/proc-self-map-files-002.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/proc/proc-self-map-files-002.c b/tools/testing/selftests/proc/proc-self-map-files-002.c index 47b7473dedef..d517f8c479fb 100644 --- a/tools/testing/selftests/proc/proc-self-map-files-002.c +++ b/tools/testing/selftests/proc/proc-self-map-files-002.c @@ -22,6 +22,7 @@ #include #include #include +#include static void pass(const char *fmt, unsigned long a, unsigned long b) { @@ -44,10 +45,18 @@ static void fail(const char *fmt, unsigned long a, unsigned long b) exit(1); } +#if __BITS_PER_LONG == 32 +# define VA_MAX (3UL << 30) +#elif __BITS_PER_LONG == 64 +# define VA_MAX (1UL << 32) +#else +# define VA_MAX 0 +#endif + int main(void) { const int PAGE_SIZE = sysconf(_SC_PAGESIZE); - const unsigned long va_max = 1UL << 32; + const unsigned long va_max = VA_MAX; unsigned long va; void *p; int fd;