<feed xmlns='http://www.w3.org/2005/Atom'>
<title>xavi/android_kernel_m2note/fs/proc/task_mmu.c, branch ng-7.1.2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<id>https://gitea.privatedns.org/xavi/android_kernel_m2note/atom?h=ng-7.1.2</id>
<link rel='self' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/atom?h=ng-7.1.2'/>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/'/>
<updated>2018-11-29T16:49:05+00:00</updated>
<entry>
<title>Replace &lt;asm/uaccess.h&gt; with &lt;linux/uaccess.h&gt; globally</title>
<updated>2018-11-29T16:49:05+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-12-24T19:46:01+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=8588b01909e0145e5e84f5fe0a5353bd194f205c'/>
<id>urn:sha1:8588b01909e0145e5e84f5fe0a5353bd194f205c</id>
<content type='text'>
This was entirely automated, using the script by Al:

  PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*&lt;asm/uaccess.h&gt;'
  sed -i -e "s!$PATT!#include &lt;linux/uaccess.h&gt;!" \
        $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Moyster &lt;oysterized@gmail.com&gt;
</content>
</entry>
<entry>
<title>fs: proc: task_mmu: fix proc_mem_open creds for fs access checks</title>
<updated>2017-09-23T16:29:49+00:00</updated>
<author>
<name>Mister Oyster</name>
<email>oysterized@gmail.com</email>
</author>
<published>2017-09-23T16:27:49+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=c7f42f5bcd6ae56cb5657a20aaf8f4a50565b4d3'/>
<id>urn:sha1:c7f42f5bcd6ae56cb5657a20aaf8f4a50565b4d3</id>
<content type='text'>
Should fix :
[ 2201.337557]&lt;0&gt; (0)[672:android.bg]WARNING: at
../../../../../../kernel/meizu/m2note/kernel/ptrace.c:239
__ptrace_may_access+0x164/0x178()
[ 2201.337568]&lt;0&gt; (0)[672:android.bg]denying ptrace access check without
PTRACE_MODE_*CREDS
[ 2201.337583]&lt;0&gt; (0)[672:android.bg]CPU: 0 PID: 672 Comm: android.bg
Tainted: G        W    3.10.107-NOyster #1
[ 2201.337593]&lt;0&gt; (0)[672:android.bg]Call trace:
[ 2201.337609]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc000089558&gt;]
dump_backtrace+0x0/0x148
[ 2201.337625]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0000896b4&gt;]
show_stack+0x14/0x1c
[ 2201.337642]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0009e88d4&gt;]
dump_stack+0x20/0x28
[ 2201.337657]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc00009b6cc&gt;]
warn_slowpath_fmt+0xb0/0x134
[ 2201.337673]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0000ab378&gt;]
__ptrace_may_access+0x164/0x178
[ 2201.337687]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0000ab8c0&gt;]
ptrace_may_access+0x2c/0x4c
[ 2201.337704]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc000098d48&gt;]
mm_access+0x98/0xe0
[ 2201.337722]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc00020e788&gt;]
proc_mem_open+0x2c/0xa0
[ 2201.337739]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc00020a79c&gt;]
pid_smaps_open+0x48/0x88
[ 2201.337756]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0001a0c54&gt;]
do_dentry_open+0x178/0x268
[ 2201.337772]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0001a1e30&gt;]
finish_open+0x30/0x5c
[ 2201.337787]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0001b12c0&gt;]
do_last.isra.29+0x45c/0xcbc
[ 2201.337802]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0001b1bd8&gt;]
path_openat.isra.30+0xb8/0x494
[ 2201.337817]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0001b2028&gt;]
do_filp_open+0x40/0xb4
[ 2201.337834]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0001a22fc&gt;]
do_sys_open+0x118/0x1f0
[ 2201.337851]&lt;0&gt; (0)[672:android.bg][&lt;ffffffc0001a240c&gt;]
SyS_openat+0x10/0x18
[ 2201.337861]&lt;0&gt; (0)[672:android.bg]---[ end trace e7bf4b0b0cb5766d
]---

Signed-off-by: Mister Oyster &lt;oysterized@gmail.com&gt;
</content>
</entry>
<entry>
<title>seq_file: remove "%n" usage from seq_file users</title>
<updated>2017-09-23T13:02:44+00:00</updated>
<author>
<name>Tetsuo Handa</name>
<email>penguin-kernel@I-love.SAKURA.ne.jp</email>
</author>
<published>2013-11-14T22:31:57+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=e5d7201d83b72fb67d5fd7dc7b0e003106026973'/>
<id>urn:sha1:e5d7201d83b72fb67d5fd7dc7b0e003106026973</id>
<content type='text'>
All seq_printf() users are using "%n" for calculating padding size,
convert them to use seq_setwidth() / seq_pad() pair.

Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Git-commit: 652586df95e5d76b37d07a11839126dcfede1621
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[davidb@codeaurora.org: Resolve merge conflicts with ipv4/6 ping
 changes in upstream]
CRs-fixed: 665291
Change-Id: Ia0416c9dbe3d80ff35f24f9c93c3543d1200a327
Signed-off-by: David Brown &lt;davidb@codeaurora.org&gt;
</content>
</entry>
<entry>
<title>mm: larger stack guard gap, between vmas</title>
<updated>2017-07-04T10:11:29+00:00</updated>
<author>
<name>Hugh Dickins</name>
<email>hughd@google.com</email>
</author>
<published>2017-06-19T11:03:24+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=005510a4492897b8459a7678191bd9ea39335bee'/>
<id>urn:sha1:005510a4492897b8459a7678191bd9ea39335bee</id>
<content type='text'>
commit 1be7107fbe18eed3e319a6c3e83c78254b693acb upstream.

Stack guard page is a useful feature to reduce a risk of stack smashing
into a different mapping. We have been using a single page gap which
is sufficient to prevent having stack adjacent to a different mapping.
But this seems to be insufficient in the light of the stack usage in
userspace. E.g. glibc uses as large as 64kB alloca() in many commonly
used functions. Others use constructs liks gid_t buffer[NGROUPS_MAX]
which is 256kB or stack strings with MAX_ARG_STRLEN.

This will become especially dangerous for suid binaries and the default
no limit for the stack size limit because those applications can be
tricked to consume a large portion of the stack and a single glibc call
could jump over the guard page. These attacks are not theoretical,
unfortunatelly.

Make those attacks less probable by increasing the stack guard gap
to 1MB (on systems with 4k pages; but make it depend on the page size
because systems with larger base pages might cap stack allocations in
the PAGE_SIZE units) which should cover larger alloca() and VLA stack
allocations. It is obviously not a full fix because the problem is
somehow inherent, but it should reduce attack space a lot.

One could argue that the gap size should be configurable from userspace,
but that can be done later when somebody finds that the new 1MB is wrong
for some special case applications.  For now, add a kernel command line
option (stack_guard_gap) to specify the stack gap size (in page units).

Implementation wise, first delete all the old code for stack guard page:
because although we could get away with accounting one extra page in a
stack vma, accounting a larger gap can break userspace - case in point,
a program run with "ulimit -S -v 20000" failed when the 1MB gap was
counted for RLIMIT_AS; similar problems could come with RLIMIT_MLOCK
and strict non-overcommit mode.

Instead of keeping gap inside the stack vma, maintain the stack guard
gap as a gap between vmas: using vm_start_gap() in place of vm_start
(or vm_end_gap() in place of vm_end if VM_GROWSUP) in just those few
places which need to respect the gap - mainly arch_get_unmapped_area(),
and and the vma tree's subtree_gap support for that.

Original-patch-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Original-patch-by: Michal Hocko &lt;mhocko@suse.com&gt;
Signed-off-by: Hugh Dickins &lt;hughd@google.com&gt;
[wt: backport to 4.11: adjust context]
[wt: backport to 4.9: adjust context ; kernel doc was not in admin-guide]
[wt: backport to 4.4: adjust context ; drop ppc hugetlb_radix changes]
[wt: backport to 3.18: adjust context ; no FOLL_POPULATE ;
     s390 uses generic arch_get_unmapped_area()]
[wt: backport to 3.16: adjust context]
[wt: backport to 3.10: adjust context ; code logic in PARISC's
     arch_get_unmapped_area() wasn't found ; code inserted into
     expand_upwards() and expand_downwards() runs under anon_vma lock;
     changes for gup.c:faultin_page go to memory.c:__get_user_pages();
     included Hugh Dickins' fixes]
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>mempolicy: fix show_numa_map() vs exec() + do_set_mempolicy() race</title>
<updated>2016-09-28T13:15:17+00:00</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2014-10-09T22:27:52+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=b4f19709f1dded1df666a03124702274a6f68693'/>
<id>urn:sha1:b4f19709f1dded1df666a03124702274a6f68693</id>
<content type='text'>
9e7814404b77 "hold task-&gt;mempolicy while numa_maps scans." fixed the
race with the exiting task but this is not enough.

The current code assumes that get_vma_policy(task) should either see
task-&gt;mempolicy == NULL or it should be equal to -&gt;task_mempolicy saved
by hold_task_mempolicy(), so we can never race with __mpol_put(). But
this can only work if we can't race with do_set_mempolicy(), and thus
we can't race with another do_set_mempolicy() or do_exit() after that.

However, do_set_mempolicy()-&gt;down_write(mmap_sem) can not prevent this
race. This task can exec, change it's -&gt;mm, and call do_set_mempolicy()
after that; in this case they take 2 different locks.

Change hold_task_mempolicy() to use get_task_policy(), it never returns
NULL, and change show_numa_map() to use __get_vma_policy() or fall back
to proc_priv-&gt;task_mempolicy.

Note: this is the minimal fix, we will cleanup this code later. I think
hold_task_mempolicy() and release_task_mempolicy() should die, we can
move this logic into show_numa_map(). Or we can move get_task_policy()
outside of -&gt;mmap_sem and !CONFIG_NUMA code at least.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.com&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Cc: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Cc: Alexander Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: "Kirill A. Shutemov" &lt;kirill.shutemov@linux.intel.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&gt;
Cc: Naoya Horiguchi &lt;n-horiguchi@ah.jp.nec.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: W4TCH0UT &lt;ateekujjawal@gmail.com&gt;
</content>
</entry>
<entry>
<title>proc/maps: make vm_is_stack() logic namespace-friendly</title>
<updated>2016-09-28T13:15:16+00:00</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2014-10-09T22:25:54+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=740561452df6f151d608d336aaf53bc0c6602e75'/>
<id>urn:sha1:740561452df6f151d608d336aaf53bc0c6602e75</id>
<content type='text'>
- Rename vm_is_stack() to task_of_stack() and change it to return
  "struct task_struct *" rather than the global (and thus wrong in
  general) pid_t.

- Add the new pid_of_stack() helper which calls task_of_stack() and
  uses the right namespace to report the correct pid_t.

  Unfortunately we need to define this helper twice, in task_mmu.c
  and in task_nommu.c. perhaps it makes sense to add fs/proc/util.c
  and move at least pid_of_stack/task_of_stack there to avoid the
  code duplication.

- Change show_map_vma() and show_numa_map() to use the new helper.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Alexander Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Greg Ungerer &lt;gerg@uclinux.org&gt;
Cc: "Kirill A. Shutemov" &lt;kirill.shutemov@linux.intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: W4TCH0UT &lt;ateekujjawal@gmail.com&gt;

Conflicts:
	fs/proc/task_nommu.c
	mm/util.c
</content>
</entry>
<entry>
<title>proc/maps: replace proc_maps_private-&gt;pid with "struct inode *inode"</title>
<updated>2016-09-28T13:15:15+00:00</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2014-10-09T22:25:51+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=e215de016d2ab7f8c4633bb5fc0783d332ff7228'/>
<id>urn:sha1:e215de016d2ab7f8c4633bb5fc0783d332ff7228</id>
<content type='text'>
m_start() can use get_proc_task() instead, and "struct inode *"
provides more potentially useful info, see the next changes.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Alexander Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Greg Ungerer &lt;gerg@uclinux.org&gt;
Cc: "Kirill A. Shutemov" &lt;kirill.shutemov@linux.intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: W4TCH0UT &lt;ateekujjawal@gmail.com&gt;
</content>
</entry>
<entry>
<title>fs/proc/task_mmu.c: update m-&gt;version in the main loop in m_start()</title>
<updated>2016-09-28T13:15:14+00:00</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2014-10-09T22:25:43+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=b1d502583021f1533fd6e08b7e570b4312a5fc52'/>
<id>urn:sha1:b1d502583021f1533fd6e08b7e570b4312a5fc52</id>
<content type='text'>
Change the main loop in m_start() to update m-&gt;version. Mostly for
consistency, but this can help to avoid the same loop if the very
1st -&gt;show() fails due to seq_overflow().

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Kirill A. Shutemov &lt;kirill.shutemov@linux.intel.com&gt;
Cc: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: W4TCH0UT &lt;ateekujjawal@gmail.com&gt;
</content>
</entry>
<entry>
<title>fs/proc/task_mmu.c: reintroduce m-&gt;version logic</title>
<updated>2016-09-28T13:15:13+00:00</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2014-10-09T22:25:41+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=7a6a1025f836bfa0fdf7fef7240fdf295a46372d'/>
<id>urn:sha1:7a6a1025f836bfa0fdf7fef7240fdf295a46372d</id>
<content type='text'>
Add the "last_addr" optimization back. Like before, every -&gt;show()
method checks !seq_overflow() and sets m-&gt;version = vma-&gt;vm_start.

However, it also checks that m_next_vma(vma) != NULL, otherwise it
sets m-&gt;version = -1 for the lockless "EOF" fast-path in m_start().

m_start() can simply do find_vma() + m_next_vma() if last_addr is
not zero, the code looks clear and simple and this case is clearly
separated from "scan vmas" path.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Kirill A. Shutemov &lt;kirill.shutemov@linux.intel.com&gt;
Cc: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: W4TCH0UT &lt;ateekujjawal@gmail.com&gt;

Conflicts:
	fs/proc/task_mmu.c
</content>
</entry>
<entry>
<title>fs/proc/task_mmu.c: introduce m_next_vma() helper</title>
<updated>2016-09-28T13:15:12+00:00</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2014-10-09T22:25:39+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/android_kernel_m2note/commit/?id=08b29b79c414d1122686d221bcfe9f5ae6c4ef84'/>
<id>urn:sha1:08b29b79c414d1122686d221bcfe9f5ae6c4ef84</id>
<content type='text'>
Extract the tail_vma/vm_next calculation from m_next() into the new
trivial helper, m_next_vma().

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Kirill A. Shutemov &lt;kirill.shutemov@linux.intel.com&gt;
Cc: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: W4TCH0UT &lt;ateekujjawal@gmail.com&gt;
</content>
</entry>
</feed>
