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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1250219961-11681-1-git-send-email-graff.yang@gmail.com>
Date:	Fri, 14 Aug 2009 11:19:21 +0800
From:	<graff.yang@...il.com>
To:	dhowells@...hat.com, linux-kernel@...r.kernel.org
CC:	akpm@...ux-foundation.org, uclinux-dist-devel@...ckfin.uclinux.org,
	Graff Yang <graff.yang@...il.com>
Subject: [PATCH] mm/nommu.c: check read permission in validate_mmap_request()

From: Graff Yang <graff.yang@...il.com>

According to the POSIX (1003.1-2008), the file shall have been opened
with read permission, regardless of the protection options specified.
The ltp test cases mmap06/07 need this.

Signed-off-by: Graff Yang <graff.yang@...il.com>
---
 mm/nommu.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index 53cab10..ac13b23 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -922,6 +922,10 @@ static int validate_mmap_request(struct file *file,
 		if (!file->f_op->read)
 			capabilities &= ~BDI_CAP_MAP_COPY;
 
+		/* The file shall have been opened with read permission. */
+		if (!(file->f_mode & FMODE_READ))
+			return -EACCES;
+
 		if (flags & MAP_SHARED) {
 			/* do checks for writing, appending and locking */
 			if ((prot & PROT_WRITE) &&
-- 
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ