lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1532502987-97496-1-git-send-email-yang.yi@zte.com.cn>
Date:   Wed, 25 Jul 2018 15:16:27 +0800
From:   Yang Yi <yang.yi@....com.cn>
To:     ralf@...ux-mips.org, jhogan@...nel.org
Cc:     linux-kernel@...r.kernel.org, liu.hailong6@....com.cn,
        zhong.weidong@....com.cn, jiang.biao2@....com.cn,
        Yang Yi <yang.yi@....com.cn>
Subject: [PATCH] mips/mm/mmap: fix the wrong return value from  syscall mmap() on mips architecture

According to the latest POSIX standard defined in IEEE Std 1003.1-2017,
the errno should be set to ENOMEM instead of EINVAL when mmap into 
high region address which exceeds the address boundary of a process.

The corresponding description of IEEE Std 1003.1-2017 is as follows:

ERRORS
	The mmap() function shall fail if:
	......
	[ENOMEM]
		MAP_FIXED was specified, and the range [addr,addr+len) 
		exceeds that allowed for the address space of a process; 
		or, if MAP_FIXED was not specified and there is insufficient
		room in the address space to effect the mapping.
	......
		
Signed-off-by: Yang Yi <yang.yi@....com.cn>
Signed-off-by: Hailong Liu <liu.hailong6@....com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@....com.cn>
---
 arch/mips/mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 2f616eb..c47059c 100755
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -69,7 +69,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
 	if (flags & MAP_FIXED) {
 		/* Even MAP_FIXED mappings must reside within TASK_SIZE */
 		if (TASK_SIZE - len < addr)
-			return -EINVAL;
+			return -ENOMEM;

 		/*
 		 * We do not accept a shared mapping if it would violate
--
2.1.0.GIT

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ