<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/proc/task_mmu.c, branch linux-2.6.28.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.28.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.28.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2008-12-10T16:01:53Z</updated>
<entry>
<title>pagemap: fix 32-bit pagemap regression</title>
<updated>2008-12-10T16:01:53Z</updated>
<author>
<name>Matt Mackall</name>
</author>
<published>2008-12-09T21:14:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=49c50342c728344b79c8f9e8293637fe80ef5ad5'/>
<id>urn:sha1:49c50342c728344b79c8f9e8293637fe80ef5ad5</id>
<content type='text'>
The large pages fix from bcf8039ed45 broke 32-bit pagemap by pulling the
pagemap entry code out into a function with the wrong return type.
Pagemap entries are 64 bits on all systems and unsigned long is only 32
bits on 32-bit systems.

Signed-off-by: Matt Mackall &lt;mpm@selenic.com&gt;
Reported-by: Doug Graham &lt;dgraham@nortel.com&gt;
Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Dave Hansen &lt;dave@linux.vnet.ibm.com&gt;
Cc: &lt;stable@kernel.org&gt;		[2.6.26.x, 2.6.27.x]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: fix vma display mismatch between /proc/pid/{maps,smaps}</title>
<updated>2008-10-23T09:21:29Z</updated>
<author>
<name>Joe Korty</name>
</author>
<published>2008-10-16T11:27:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7c88db0cb589df980acfb2f73c3595a0653004ec'/>
<id>urn:sha1:7c88db0cb589df980acfb2f73c3595a0653004ec</id>
<content type='text'>
Commit 4752c369789250eafcd7813e11c8fb689235b0d2 aka
"maps4: simplify interdependence of maps and smaps" broke /proc/pid/smaps,
causing it to display some vmas twice and other vmas not at all.  For example:

    grep .- /proc/1/smaps &gt;/tmp/smaps; diff /proc/1/maps /tmp/smaps

    1  25d24
    2  &lt; 7fd7e23aa000-7fd7e23ac000 rw-p 7fd7e23aa000 00:00 0
    3  28a28
    4  &gt; ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0  [vsyscall]

The bug has something to do with setting m-&gt;version before all the
seq_printf's have been performed.  show_map was doing this correctly,
but show_smap was doing this in the middle of its seq_printf sequence.
This patch arranges things so that the setting of m-&gt;version in show_smap
is also done at the end of its seq_printf sequence.

Testing: in addition to the above grep test, for each process I summed
up the 'Rss' fields of /proc/pid/smaps and compared that to the 'VmRSS'
field of /proc/pid/status.  All matched except for Xorg (which has a
/dev/mem mapping which Rss accounts for but VmRSS does not).  This result
gives us some confidence that neither /proc/pid/maps nor /proc/pid/smaps
are any longer skipping or double-counting vmas.

Signed-off-by: Joe Korty &lt;joe.korty@ccur.com&gt;
Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
</content>
</entry>
<entry>
<title>proc: remove kernel.maps_protect</title>
<updated>2008-10-10T00:24:51Z</updated>
<author>
<name>Alexey Dobriyan</name>
</author>
<published>2008-10-09T23:27:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3bbfe0596746e1590888a6e1e6a07583265238b7'/>
<id>urn:sha1:3bbfe0596746e1590888a6e1e6a07583265238b7</id>
<content type='text'>
After commit 831830b5a2b5d413407adf380ef62fe17d6fcbf2 aka
"restrict reading from /proc/&lt;pid&gt;/maps to those who share -&gt;mm or can ptrace"
sysctl stopped being relevant because commit moved security checks from -&gt;show
time to -&gt;start time (mm_for_maps()).

Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Acked-by: Kees Cook &lt;kees.cook@canonical.com&gt;
</content>
</entry>
<entry>
<title>/proc/self/maps doesn't display the real file offset</title>
<updated>2008-08-20T22:40:30Z</updated>
<author>
<name>Clement Calmels</name>
</author>
<published>2008-08-20T21:09:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1804dc6e145f3f24a8c94deddfc0a986d380a27f'/>
<id>urn:sha1:1804dc6e145f3f24a8c94deddfc0a986d380a27f</id>
<content type='text'>
This addresses

	http://bugzilla.kernel.org/show_bug.cgi?id=11318

In function show_map (file: fs/proc/task_mmu.c), if vma-&gt;vm_pgoff &gt; 2^20
than (vma-&gt;vm_pgoff &lt;&lt; PAGE_SIZE) is greater than 2^32 (with PAGE_SIZE
equal to 4096 (i.e.  2^12).  The next seq_printf use an unsigned long for
the conversion of (vma-&gt;vm_pgoff &lt;&lt; PAGE_SIZE), as a result the offset
value displayed in /proc/self/maps is truncated if the page offset is
greater than 2^20.

A test that shows this issue:

#define _GNU_SOURCE
#include &lt;sys/types.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;sys/mman.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;unistd.h&gt;
#include &lt;string.h&gt;

#define PAGE_SIZE (getpagesize())

#if __i386__
#   define U64_STR "%llx"
#elif __x86_64
#   define U64_STR "%lx"
#else
#   error "Architecture Unsupported"
#endif

int main(int argc, char *argv[])
{
	int fd;
	char *addr;
	off64_t offset = 0x10000000;
	char *filename = "/dev/zero";

	fd = open(filename, O_RDONLY);
	if (fd &lt; 0) {
		perror("open");
		return 1;
	}

	offset *= 0x10;
	printf("offset = " U64_STR "\n", offset);

	addr = (char*)mmap64(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, fd,
			     offset);
	if ((void*)addr == MAP_FAILED) {
		perror("mmap64");
		return 1;
	}

	{
		FILE *fmaps;
		char *line = NULL;
		size_t len = 0;
		ssize_t read;
		size_t filename_len = strlen(filename);

		fmaps = fopen("/proc/self/maps", "r");
		if (!fmaps) {
			perror("fopen");
			return 1;
		}
		while ((read = getline(&amp;line, &amp;len, fmaps)) != -1) {
			if ((read &gt; filename_len + 1)
			    &amp;&amp; (strncmp(&amp;line[read - filename_len - 1], filename, filename_len) == 0))
				printf("%s", line);
		}

		if (line)
			free(line);

		fclose(fmaps);
	}

	close(fd);
	return 0;
}

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Clement Calmels &lt;cboulte@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: fix /proc/*/pagemap some more</title>
<updated>2008-07-22T16:59:41Z</updated>
<author>
<name>Alexey Dobriyan</name>
</author>
<published>2008-07-21T21:21:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ee1e6ab6056a8b9c19377257002da98b83819531'/>
<id>urn:sha1:ee1e6ab6056a8b9c19377257002da98b83819531</id>
<content type='text'>
struct pagemap_walk was placed on stack, some hooks are initialized, the
rest (-&gt;pgd_entry, -&gt;pud_entry, -&gt;pte_entry) are valid but junk.

Reported-by: Eric Sesterhenn &lt;snakebyte@gmx.de&gt;
Signed-off-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: "Vegard Nossum" &lt;vegard.nossum@gmail.com&gt;
Cc: &lt;stable@kernel.org&gt; [2.6.25.x, 2.6.26.x]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Security: split proc ptrace checking into read vs. attach</title>
<updated>2008-07-14T05:01:47Z</updated>
<author>
<name>Stephen Smalley</name>
</author>
<published>2008-05-19T12:32:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=006ebb40d3d65338bd74abb03b945f8d60e362bd'/>
<id>urn:sha1:006ebb40d3d65338bd74abb03b945f8d60e362bd</id>
<content type='text'>
Enable security modules to distinguish reading of process state via
proc from full ptrace access by renaming ptrace_may_attach to
ptrace_may_access and adding a mode argument indicating whether only
read access or full attach access is requested.  This allows security
modules to permit access to reading process state without granting
full ptrace access.  The base DAC/capability checking remains unchanged.

Read access to /proc/pid/mem continues to apply a full ptrace attach
check since check_mem_permission() already requires the current task
to already be ptracing the target.  The other ptrace checks within
proc for elements like environ, maps, and fds are changed to pass the
read mode instead of attach.

In the SELinux case, we model such reading of process state as a
reading of a proc file labeled with the target process' label.  This
enables SELinux policy to permit such reading of process state without
permitting control or manipulation of the target process, as there are
a number of cases where programs probe for such information via proc
but do not need to be able to control the target (e.g. procps,
lsof, PolicyKit, ConsoleKit).  At present we have to choose between
allowing full ptrace in policy (more permissive than required/desired)
or breaking functionality (or in some cases just silencing the denials
via dontaudit rules but this can hide genuine attacks).

This version of the patch incorporates comments from Casey Schaufler
(change/replace existing ptrace_may_attach interface, pass access
mode), and Chris Wright (provide greater consistency in the checking).

Note that like their predecessors __ptrace_may_attach and
ptrace_may_attach, the __ptrace_may_access and ptrace_may_access
interfaces use different return value conventions from each other (0
or -errno vs. 1 or 0).  I retained this difference to avoid any
changes to the caller logic but made the difference clearer by
changing the latter interface to return a bool rather than an int and
by adding a comment about it to ptrace.h for any future callers.

Signed-off-by:  Stephen Smalley &lt;sds@tycho.nsa.gov&gt;
Acked-by: Chris Wright &lt;chrisw@sous-sol.org&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>Fix pagemap_read() use of struct mm_walk</title>
<updated>2008-07-05T20:13:44Z</updated>
<author>
<name>Andrew Morton</name>
</author>
<published>2008-07-05T08:02:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5d7e0d2bd98ef4f5a16ac9da1987ae655368dd6a'/>
<id>urn:sha1:5d7e0d2bd98ef4f5a16ac9da1987ae655368dd6a</id>
<content type='text'>
Fix some issues in pagemap_read noted by Alexey:

- initialize pagemap_walk.mm to "mm" , so the code starts working as
  advertised

- initialize -&gt;private to "&amp;pm" so it wouldn't immediately oops in
  pagemap_pte_hole()

- unstatic struct pagemap_walk, so two threads won't fsckup each other
  (including those started by root, including flipping -&gt;mm when you don't
  have permissions)

- pagemap_read() contains two calls to ptrace_may_attach(), second one
  looks unneeded.

- avoid possible kmalloc(0) and integer wraparound.

Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
[ Personally, I'd just remove the functionality entirely  - Linus ]
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Fix clear_refs_write() use of struct mm_walk</title>
<updated>2008-07-05T20:07:56Z</updated>
<author>
<name>Andrew Morton</name>
</author>
<published>2008-07-05T19:29:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=20cbc972617069c1ed434f62151e4de57d26ea46'/>
<id>urn:sha1:20cbc972617069c1ed434f62151e4de57d26ea46</id>
<content type='text'>
Don't use a static entry, so as to prevent races during concurrent use
of this function.

Reported-by: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>pagemap: fix large pages in pagemap</title>
<updated>2008-06-13T01:05:41Z</updated>
<author>
<name>Dave Hansen</name>
</author>
<published>2008-06-12T22:21:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bcf8039ed45f56013c4afea5520bca7d909e5e61'/>
<id>urn:sha1:bcf8039ed45f56013c4afea5520bca7d909e5e61</id>
<content type='text'>
We were walking right into huge page areas in the pagemap walker, and
calling the pmds pmd_bad() and clearing them.

That leaked huge pages.  Bad.

This patch at least works around that for now.  It ignores huge pages in
the pagemap walker for the time being, and won't leak those pages.

Signed-off-by: Dave Hansen &lt;dave@linux.vnet.ibm.com&gt;
Acked-by: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>pagemap: pass mm into pagewalkers</title>
<updated>2008-06-13T01:05:41Z</updated>
<author>
<name>Dave Hansen</name>
</author>
<published>2008-06-12T22:21:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2165009bdf63f79716a36ad545df14c3cdf958b7'/>
<id>urn:sha1:2165009bdf63f79716a36ad545df14c3cdf958b7</id>
<content type='text'>
We need this at least for huge page detection for now, because powerpc
needs the vm_area_struct to be able to determine whether a virtual address
is referring to a huge page (its pmd_huge() doesn't work).

It might also come in handy for some of the other users.

Signed-off-by: Dave Hansen &lt;dave@linux.vnet.ibm.com&gt;
Acked-by: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
