From patchwork Thu May 24 20:57:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 161203 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1BFADB6F86 for ; Fri, 25 May 2012 06:57:31 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755738Ab2EXU5a (ORCPT ); Thu, 24 May 2012 16:57:30 -0400 Received: from shards.monkeyblade.net ([198.137.202.13]:42911 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755587Ab2EXU53 (ORCPT ); Thu, 24 May 2012 16:57:29 -0400 Received: from localhost (cpe-66-108-119-99.nyc.res.rr.com [66.108.119.99]) (authenticated bits=0) by shards.monkeyblade.net (8.14.4/8.14.4) with ESMTP id q4OKvSd2003210 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Thu, 24 May 2012 13:57:29 -0700 Date: Thu, 24 May 2012 16:57:28 -0400 (EDT) Message-Id: <20120524.165728.2124546768664666818.davem@davemloft.net> To: sparclinux@vger.kernel.org Subject: [PATCH] sparc: Fix user_addr_max() definition. From: David Miller X-Mailer: Mew version 6.5 on Emacs 24.0.95 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (shards.monkeyblade.net [198.137.202.13]); Thu, 24 May 2012 13:57:29 -0700 (PDT) Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org We need to use TASK_SIZE because for 64-bit tasks the value of STACK_TOP actually sits in the middle of the address space so we'll get false-negatives. Adjust the TASK_SIZE definition on sparc64 to accomodate this, in the context in which user_addr_max() is used we have the test_thread_flag() definition available but not the one for test_tsk_thread_flag(). Signed-off-by: David S. Miller --- Some glibc testsuite failures for 64-bit showed me that STACK_TOP isn't the right thing to use here because of how we place the 64-bit process stack in the middle of the address space. Committed to master. arch/sparc/include/asm/processor_64.h | 4 +++- arch/sparc/include/asm/uaccess.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h index e713db2..6ca7709 100644 --- a/arch/sparc/include/asm/processor_64.h +++ b/arch/sparc/include/asm/processor_64.h @@ -42,7 +42,9 @@ #define TASK_SIZE_OF(tsk) \ (test_tsk_thread_flag(tsk,TIF_32BIT) ? \ (1UL << 32UL) : ((unsigned long)-VPTE_SIZE)) -#define TASK_SIZE TASK_SIZE_OF(current) +#define TASK_SIZE \ + (test_thread_flag(TIF_32BIT) ? \ + (1UL << 32UL) : ((unsigned long)-VPTE_SIZE)) #ifdef __KERNEL__ #define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE) diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h index 20c2acb..0167d26 100644 --- a/arch/sparc/include/asm/uaccess.h +++ b/arch/sparc/include/asm/uaccess.h @@ -7,7 +7,7 @@ #endif #define user_addr_max() \ - (segment_eq(get_fs(), USER_DS) ? STACK_TOP : ~0UL) + (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) extern long strncpy_from_user(char *dest, const char __user *src, long count);