[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#137125: marked as done (libc6: msync() succeeds on locked pages)



Your message dated Thu, 02 Jan 2003 15:29:02 +0900
with message-id <80wulo5akx.wl@oris.opensource.jp>
and subject line libc6: msync() succeeds on locked pages
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 6 Mar 2002 19:43:46 +0000
>From joey@silk.kitenet.net Wed Mar 06 13:43:46 2002
Return-path: <joey@silk.kitenet.net>
Received: from as5800-82-144.access.naxs.com (silk.kitenet.net) [216.98.82.144] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 16ihJv-0007cE-00; Wed, 06 Mar 2002 13:43:45 -0600
Received: from joey by silk.kitenet.net with local (Exim 3.35 #1 (Debian))
	id 16ihMd-0003ES-00; Wed, 06 Mar 2002 14:46:15 -0500
From: Joey Hess <joeyh@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libc6: msync() succeeds on locked pages
X-Mailer: reportbug 1.44
Date: Wed, 06 Mar 2002 14:46:15 -0500
Message-Id: <E16ihMd-0003ES-00@silk.kitenet.net>
Sender: Joey Hess <joey@silk.kitenet.net>
Delivered-To: submit@bugs.debian.org

Package: libc6
Version: 2.2.5-3
Severity: normal

This might really be a bug in the linux kernel, I'm not sure.

This is another item that was turned up by the LSB test suite. According
to its documentation,

    as defined in System Interfaces and Headers, Issue 5:
         A  call  to msync() when some or all of the addresses in
         the range [addr,addr+len] are locked  and MS_INVALIDATE
         is specified shall return -1 and set errno to EBUSY.
			   
Instead, the test program below, and the test program in the LSB
testsuite both show msync happily syncing away, even if the memory it
was supposed to sync has been mlocked. 

You have to run the test program as root, of course, and it needs
/tmp/testfile to be some existing file of at least 4096 * 2 bytes. I
just copy in /etc/passwd, and watch it change the first line to
"xoot:x:0:0:root:/root:/usr/bin/zsh"

#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

main() {
	int	fd;
	char	*addr;

	fd = open("/tmp/testfile", O_RDWR | O_CREAT, 0600);
	if (fd == -1)
		perror("open");

	if ((addr = (char *)mmap(0, 4096 * 2, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == (char *)MAP_FAILED) {
		perror("mmap");
	}

	if (mlock(addr, 4096 * 2) == -1) {
		perror("mlock");
	}

	addr[0]='x'; // not really necessary
	
	if (msync(addr, 4096, MS_INVALIDATE) != -1) {
		perror("msync succeeded with all of range locked, expected to fail");
	}
} 

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux silk 2.4.18 #1 Tue Feb 26 00:23:37 EST 2002 i686
Locale: LANG=C, LC_CTYPE=C


---------------------------------------
Received: (at 137125-done) by bugs.debian.org; 2 Jan 2003 06:29:04 +0000
>From gotom@debian.or.jp Thu Jan 02 00:29:04 2003
Return-path: <gotom@debian.or.jp>
Received: from oris.opensource.jp (oris.opensource.gr.jp) [218.44.239.73] (postfix)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 18Tyql-0005v6-00; Thu, 02 Jan 2003 00:29:04 -0600
Received: from oris.opensource.jp (oris.opensource.jp [218.44.239.73])
	by oris.opensource.gr.jp (Postfix) with ESMTP id 801BEC33C6
	for <137125-done@bugs.debian.org>; Thu,  2 Jan 2003 15:29:02 +0900 (JST)
Date: Thu, 02 Jan 2003 15:29:02 +0900
Message-ID: <80wulo5akx.wl@oris.opensource.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: 137125-done@bugs.debian.org
Subject: Re: libc6: msync() succeeds on locked pages
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 137125-done@bugs.debian.org
X-Spam-Status: No, hits=-4.7 required=5.0
	tests=QUOTED_EMAIL_TEXT,SPAM_PHRASE_01_02,USER_AGENT
	version=2.41
X-Spam-Level: 

> This might really be a bug in the linux kernel, I'm not sure.
> 
> This is another item that was turned up by the LSB test suite. According
> to its documentation,
> 
>     as defined in System Interfaces and Headers, Issue 5:
>          A  call  to msync() when some or all of the addresses in
>          the range [addr,addr+len] are locked  and MS_INVALIDATE
>          is specified shall return -1 and set errno to EBUSY.
> 			   
> Instead, the test program below, and the test program in the LSB
> testsuite both show msync happily syncing away, even if the memory it
> was supposed to sync has been mlocked. 

This behavior is fixed in linux kernel 2.4.20/2.5.43.
mm/{filemap.c,msync.c}:msync_interval() has MS_INVALIDATE && VM_LOCKED
checking, and this test program does not complain with perror().
This is not glibc issue, and kernel is already fixed.

I close this bug.

-- gotom



Reply to: