From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Robin Holt <holt@sgi.com>, Stefani Seibold <stefani@seibold.net>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Michal Simek <monstr@monstr.eu>, Ingo Molnar <mingo@elte.hu>
Subject: [07/39] revert "procfs: provide stack information for threads" and its fixup commits
Date: Mon, 24 May 2010 16:15:19 -0700 [thread overview]
Message-ID: <20100524231813.825754602@clark.site> (raw)
In-Reply-To: <20100524231840.GA17857@kroah.com>
2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Robin Holt <holt@sgi.com>
commit 34441427aab4bdb3069a4ffcda69a99357abcb2e upstream.
Originally, commit d899bf7b ("procfs: provide stack information for
threads") attempted to introduce a new feature for showing where the
threadstack was located and how many pages are being utilized by the
stack.
Commit c44972f1 ("procfs: disable per-task stack usage on NOMMU") was
applied to fix the NO_MMU case.
Commit 89240ba0 ("x86, fs: Fix x86 procfs stack information for threads on
64-bit") was applied to fix a bug in ia32 executables being loaded.
Commit 9ebd4eba7 ("procfs: fix /proc/<pid>/stat stack pointer for kernel
threads") was applied to fix a bug which had kernel threads printing a
userland stack address.
Commit 1306d603f ('proc: partially revert "procfs: provide stack
information for threads"') was then applied to revert the stack pages
being used to solve a significant performance regression.
This patch nearly undoes the effect of all these patches.
The reason for reverting these is it provides an unusable value in
field 28. For x86_64, a fork will result in the task->stack_start
value being updated to the current user top of stack and not the stack
start address. This unpredictability of the stack_start value makes
it worthless. That includes the intended use of showing how much stack
space a thread has.
Other architectures will get different values. As an example, ia64
gets 0. The do_fork() and copy_process() functions appear to treat the
stack_start and stack_size parameters as architecture specific.
I only partially reverted c44972f1 ("procfs: disable per-task stack usage
on NOMMU") . If I had completely reverted it, I would have had to change
mm/Makefile only build pagewalk.o when CONFIG_PROC_PAGE_MONITOR is
configured. Since I could not test the builds without significant effort,
I decided to not change mm/Makefile.
I only partially reverted 89240ba0 ("x86, fs: Fix x86 procfs stack
information for threads on 64-bit") . I left the KSTK_ESP() change in
place as that seemed worthwhile.
Signed-off-by: Robin Holt <holt@sgi.com>
Cc: Stefani Seibold <stefani@seibold.net>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
Documentation/filesystems/proc.txt | 3 +--
fs/compat.c | 2 --
fs/exec.c | 2 --
fs/proc/array.c | 3 +--
fs/proc/task_mmu.c | 19 -------------------
include/linux/sched.h | 1 -
kernel/fork.c | 2 --
7 files changed, 2 insertions(+), 30 deletions(-)
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -308,7 +308,7 @@ address perms offset dev in
08049000-0804a000 rw-p 00001000 03:00 8312 /opt/test
0804a000-0806b000 rw-p 00000000 00:00 0 [heap]
a7cb1000-a7cb2000 ---p 00000000 00:00 0
-a7cb2000-a7eb2000 rw-p 00000000 00:00 0 [threadstack:001ff4b4]
+a7cb2000-a7eb2000 rw-p 00000000 00:00 0
a7eb2000-a7eb3000 ---p 00000000 00:00 0
a7eb3000-a7ed5000 rw-p 00000000 00:00 0
a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6
@@ -344,7 +344,6 @@ is not associated with a file:
[stack] = the stack of the main process
[vdso] = the "virtual dynamic shared object",
the kernel system call handler
- [threadstack:xxxxxxxx] = the stack of the thread, xxxxxxxx is the stack size
or if empty, the mapping is anonymous.
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1530,8 +1530,6 @@ int compat_do_execve(char * filename,
if (retval < 0)
goto out;
- current->stack_start = current->mm->start_stack;
-
/* execve succeeded */
current->fs->in_exec = 0;
current->in_execve = 0;
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1386,8 +1386,6 @@ int do_execve(char * filename,
if (retval < 0)
goto out;
- current->stack_start = current->mm->start_stack;
-
/* execve succeeded */
current->fs->in_exec = 0;
current->in_execve = 0;
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -82,7 +82,6 @@
#include <linux/pid_namespace.h>
#include <linux/ptrace.h>
#include <linux/tracehook.h>
-#include <linux/swapops.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
@@ -494,7 +493,7 @@ static int do_task_stat(struct seq_file
rsslim,
mm ? mm->start_code : 0,
mm ? mm->end_code : 0,
- (permitted && mm) ? task->stack_start : 0,
+ (permitted && mm) ? mm->start_stack : 0,
esp,
eip,
/* The signal information here is obsolete.
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -243,25 +243,6 @@ static void show_map_vma(struct seq_file
} else if (vma->vm_start <= mm->start_stack &&
vma->vm_end >= mm->start_stack) {
name = "[stack]";
- } else {
- unsigned long stack_start;
- struct proc_maps_private *pmp;
-
- pmp = m->private;
- stack_start = pmp->task->stack_start;
-
- if (vma->vm_start <= stack_start &&
- vma->vm_end >= stack_start) {
- pad_len_spaces(m, len);
- seq_printf(m,
- "[threadstack:%08lx]",
-#ifdef CONFIG_STACK_GROWSUP
- vma->vm_end - stack_start
-#else
- stack_start - vma->vm_start
-#endif
- );
- }
}
} else {
name = "[vdso]";
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1560,7 +1560,6 @@ struct task_struct {
/* bitmask of trace recursion */
unsigned long trace_recursion;
#endif /* CONFIG_TRACING */
- unsigned long stack_start;
#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
struct memcg_batch_info {
int do_batch; /* incremented when batch uncharge started */
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1134,8 +1134,6 @@ static struct task_struct *copy_process(
p->bts = NULL;
- p->stack_start = stack_start;
-
/* Perform scheduler related setup. Assign this task to a CPU. */
sched_fork(p, clone_flags);
next prev parent reply other threads:[~2010-05-24 23:23 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-24 23:18 [00/39] 2.6.33.5-stable review Greg KH
2010-05-24 23:15 ` [01/39] ipv4: udp: fix short packet and bad checksum logging Greg KH
2010-05-24 23:15 ` [02/39] hp_accel: fix race in device removal Greg KH
2010-05-24 23:15 ` [03/39] fbdev: bfin-t350mcqb-fb: fix fbmem allocation with blanking lines Greg KH
2010-05-24 23:15 ` [04/39] hugetlbfs: kill applications that use MAP_NORESERVE with SIGBUS instead of OOM-killer Greg KH
2010-05-24 23:15 ` [05/39] dma-mapping: fix dma_sync_single_range_* Greg KH
2010-05-24 23:15 ` [06/39] ALSA: Revert "ALSA: hda/realtek: quirk for D945GCLF2 mainboard" Greg KH
2010-05-24 23:15 ` Greg KH [this message]
2010-05-24 23:15 ` [08/39] ALSA: hda - fix DG45ID SPDIF output Greg KH
2010-05-24 23:15 ` [09/39] ACPI: sleep: eliminate duplicate entries in acpisleep_dmi_table[] Greg KH
2010-05-24 23:15 ` [10/39] mmc: atmel-mci: fix two parameters swapped Greg KH
2010-05-24 23:15 ` [11/39] mmc: atmel-mci: prevent kernel oops while removing card Greg KH
2010-05-24 23:15 ` [12/39] mmc: atmel-mci: remove data error interrupt after xfer Greg KH
2010-05-24 23:15 ` [13/39] drm/i915: use PIPE_CONTROL instruction on Ironlake and Sandy Bridge Greg KH
2010-05-24 23:15 ` [14/39] drm/i915: fix non-Ironlake 965 class crashes Greg KH
2010-05-24 23:15 ` [15/39] [S390] ptrace: fix return value of do_syscall_trace_enter() Greg KH
2010-05-24 23:15 ` [16/39] [S390] dasd: fix race between tasklet and dasd_sleep_on Greg KH
2010-05-24 23:15 ` [17/39] powerpc/perf_event: Fix oops due to perf_event_do_pending call Greg KH
2010-05-24 23:15 ` [18/39] cifs: guard against hardlinking directories Greg KH
2010-05-24 23:15 ` [19/39] serial: imx.c: fix CTS trigger level lower to avoid lost chars Greg KH
2010-05-24 23:15 ` [20/39] tty: Fix unbalanced BKL handling in error path Greg KH
2010-05-24 23:15 ` [21/39] ALSA: ice1724 - Fix ESI Maya44 capture source control Greg KH
2010-05-24 23:15 ` [22/39] ALSA: virtuoso: fix Xonar D1/DX front panel microphone Greg KH
2010-05-24 23:15 ` [23/39] ALSA: hda: Fix 0 dB for Lenovo models using Conexant CX20549 (Venice) Greg KH
2010-05-24 23:15 ` [24/39] inotify: race use after free/double free in inotify inode marks Greg KH
2010-05-24 23:15 ` [25/39] inotify: dont leak user struct on inotify release Greg KH
2010-05-24 23:15 ` [26/39] profile: fix stats and data leakage Greg KH
2010-05-24 23:15 ` [27/39] x86, k8: Fix build error when K8_NB is disabled Greg KH
2010-05-24 23:15 ` [28/39] x86, cacheinfo: Turn off L3 cache index disable feature in virtualized environments Greg KH
2010-05-25 1:50 ` Hugh Dickins
2010-05-25 17:14 ` Greg KH
2010-05-25 20:41 ` Hugh Dickins
2010-05-25 20:50 ` Greg KH
2010-05-24 23:15 ` [29/39] x86, amd: Check X86_FEATURE_OSVW bit before accessing OSVW MSRs Greg KH
2010-05-24 23:15 ` [30/39] Btrfs: check for read permission on src file in the clone ioctl Greg KH
2010-05-24 23:15 ` [31/39] ALSA: hda - New Intel HDA controller Greg KH
2010-05-24 23:15 ` [32/39] drm/i915: Disable FBC on 915GM and 945GM Greg KH
2010-05-24 23:15 ` [33/39] iwlwifi: check for aggregation frame and queue Greg KH
2010-05-24 23:15 ` [34/39] iwlwifi: clear all the stop_queue flag after load firmware Greg KH
2010-05-24 23:15 ` [35/39] CacheFiles: Fix error handling in cachefiles_determine_cache_security() Greg KH
2010-05-24 23:15 ` [36/39] mmap_min_addr check CAP_SYS_RAWIO only for write Greg KH
2010-05-24 23:15 ` [37/39] nilfs2: fix sync silent failure Greg KH
2010-05-24 23:15 ` [38/39] Revert "ath9k: fix lockdep warning when unloading module" on stable kernels Greg KH
2010-05-24 23:15 ` [39/39] crypto: authenc - Add EINPROGRESS check Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100524231813.825754602@clark.site \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=holt@sgi.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=monstr@monstr.eu \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=stefani@seibold.net \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox