From: Greg Kroah-Hartman Date: Fri, 6 Apr 2018 07:51:50 +0000 (+0200) Subject: 3.18-stable patches X-Git-Tag: v3.18.103~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=023060003256af950b2c5ef987722175d72ac051;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: arm-dts-dra7-add-power-hold-and-power-controller-properties-to-palmas.patch documentation-pinctrl-palmas-add-ti-palmas-powerhold-override-property-definition.patch fs-proc-stop-trying-to-report-thread-stacks.patch input-i8042-add-lenovo-thinkpad-l460-to-i8042-reset-list.patch input-i8042-enable-mux-on-sony-vaio-vgn-cs-series-to-fix-touchpad.patch md-raid10-reset-the-first-at-the-end-of-loop.patch proc-revert-proc-pid-maps-annotation.patch vt-change-sgr-21-to-follow-the-standards.patch --- diff --git a/queue-3.18/arm-dts-dra7-add-power-hold-and-power-controller-properties-to-palmas.patch b/queue-3.18/arm-dts-dra7-add-power-hold-and-power-controller-properties-to-palmas.patch new file mode 100644 index 00000000000..8ab6a50900c --- /dev/null +++ b/queue-3.18/arm-dts-dra7-add-power-hold-and-power-controller-properties-to-palmas.patch @@ -0,0 +1,33 @@ +From 7c62de5f3fc92291decc0dac5f36949bdc3fb575 Mon Sep 17 00:00:00 2001 +From: Keerthy +Date: Thu, 13 Apr 2017 10:21:21 +0530 +Subject: ARM: dts: dra7: Add power hold and power controller properties to palmas + +From: Keerthy + +commit 7c62de5f3fc92291decc0dac5f36949bdc3fb575 upstream. + +Add power hold and power controller properties to palmas node. +This is needed to shutdown pmic correctly on boards with +powerhold set. + +Signed-off-by: Keerthy +Signed-off-by: Tony Lindgren +Cc: Ben Hutchings +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/boot/dts/dra7-evm.dts | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm/boot/dts/dra7-evm.dts ++++ b/arch/arm/boot/dts/dra7-evm.dts +@@ -182,6 +182,8 @@ + tps659038: tps659038@58 { + compatible = "ti,tps659038"; + reg = <0x58>; ++ ti,palmas-override-powerhold; ++ ti,system-power-controller; + + tps659038_pmic { + compatible = "ti,tps659038-pmic"; diff --git a/queue-3.18/documentation-pinctrl-palmas-add-ti-palmas-powerhold-override-property-definition.patch b/queue-3.18/documentation-pinctrl-palmas-add-ti-palmas-powerhold-override-property-definition.patch new file mode 100644 index 00000000000..80525db3e4b --- /dev/null +++ b/queue-3.18/documentation-pinctrl-palmas-add-ti-palmas-powerhold-override-property-definition.patch @@ -0,0 +1,43 @@ +From 0ea66f76ba17a4b229caaadd77de694111b21769 Mon Sep 17 00:00:00 2001 +From: Keerthy +Date: Mon, 28 Nov 2016 09:31:58 +0530 +Subject: Documentation: pinctrl: palmas: Add ti,palmas-powerhold-override property definition + +From: Keerthy + +commit 0ea66f76ba17a4b229caaadd77de694111b21769 upstream. + +GPIO7 is configured in POWERHOLD mode which has higher priority +over DEV_ON bit and keeps the PMIC supplies on even after the DEV_ON +bit is turned off. This property enables driver to over ride the +POWERHOLD value to GPIO7 so as to turn off the PMIC in power off +scenarios. + +Signed-off-by: Keerthy +Acked-by: Rob Herring +Signed-off-by: Linus Walleij +Cc: Ben Hutchings +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt ++++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt +@@ -35,6 +35,15 @@ Optional properties: + - ti,palmas-enable-dvfs2: Enable DVFS2. Configure pins for DVFS2 mode. + Selection primary or secondary function associated to GPADC_START + and SYSEN2 pin/pad for DVFS2 interface ++- ti,palmas-override-powerhold: This is applicable for PMICs for which ++ GPIO7 is configured in POWERHOLD mode which has higher priority ++ over DEV_ON bit and keeps the PMIC supplies on even after the DEV_ON ++ bit is turned off. This property enables driver to over ride the ++ POWERHOLD value to GPIO7 so as to turn off the PMIC in power off ++ scenarios. So for GPIO7 if ti,palmas-override-powerhold is set ++ then the GPIO_7 field should never be muxed to anything else. ++ It should be set to POWERHOLD by default and only in case of ++ power off scenarios the driver will over ride the mux value. + + This binding uses the following generic properties as defined in + pinctrl-bindings.txt: diff --git a/queue-3.18/fs-proc-stop-trying-to-report-thread-stacks.patch b/queue-3.18/fs-proc-stop-trying-to-report-thread-stacks.patch new file mode 100644 index 00000000000..1efd000ebf9 --- /dev/null +++ b/queue-3.18/fs-proc-stop-trying-to-report-thread-stacks.patch @@ -0,0 +1,190 @@ +From b18cb64ead400c01bf1580eeba330ace51f8087d Mon Sep 17 00:00:00 2001 +From: Andy Lutomirski +Date: Fri, 30 Sep 2016 10:58:57 -0700 +Subject: fs/proc: Stop trying to report thread stacks + +From: Andy Lutomirski + +commit b18cb64ead400c01bf1580eeba330ace51f8087d upstream. + +This reverts more of: + + b76437579d13 ("procfs: mark thread stack correctly in proc//maps") + +... which was partially reverted by: + + 65376df58217 ("proc: revert /proc//maps [stack:TID] annotation") + +Originally, /proc/PID/task/TID/maps was the same as /proc/TID/maps. + +In current kernels, /proc/PID/maps (or /proc/TID/maps even for +threads) shows "[stack]" for VMAs in the mm's stack address range. + +In contrast, /proc/PID/task/TID/maps uses KSTK_ESP to guess the +target thread's stack's VMA. This is racy, probably returns garbage +and, on arches with CONFIG_TASK_INFO_IN_THREAD=y, is also crash-prone: +KSTK_ESP is not safe to use on tasks that aren't known to be running +ordinary process-context kernel code. + +This patch removes the difference and just shows "[stack]" for VMAs +in the mm's stack range. This is IMO much more sensible -- the +actual "stack" address really is treated specially by the VM code, +and the current thread stack isn't even well-defined for programs +that frequently switch stacks on their own. + +Reported-by: Jann Horn +Signed-off-by: Andy Lutomirski +Acked-by: Thomas Gleixner +Cc: Al Viro +Cc: Andrew Morton +Cc: Borislav Petkov +Cc: Brian Gerst +Cc: Johannes Weiner +Cc: Kees Cook +Cc: Linus Torvalds +Cc: Linux API +Cc: Peter Zijlstra +Cc: Tycho Andersen +Link: http://lkml.kernel.org/r/3e678474ec14e0a0ec34c611016753eea2e1b8ba.1475257877.git.luto@kernel.org +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/filesystems/proc.txt | 26 -------------------------- + fs/proc/task_mmu.c | 29 ++++++++++------------------- + fs/proc/task_nommu.c | 26 +++++++++----------------- + 3 files changed, 19 insertions(+), 62 deletions(-) + +--- a/Documentation/filesystems/proc.txt ++++ b/Documentation/filesystems/proc.txt +@@ -371,32 +371,6 @@ is not associated with a file: + + or if empty, the mapping is anonymous. + +-The /proc/PID/task/TID/maps is a view of the virtual memory from the viewpoint +-of the individual tasks of a process. In this file you will see a mapping marked +-as [stack] if that task sees it as a stack. Hence, for the example above, the +-task-level map, i.e. /proc/PID/task/TID/maps for thread 1001 will look like this: +- +-08048000-08049000 r-xp 00000000 03:00 8312 /opt/test +-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 +-a7eb2000-a7eb3000 ---p 00000000 00:00 0 +-a7eb3000-a7ed5000 rw-p 00000000 00:00 0 [stack] +-a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6 +-a8008000-a800a000 r--p 00133000 03:00 4222 /lib/libc.so.6 +-a800a000-a800b000 rw-p 00135000 03:00 4222 /lib/libc.so.6 +-a800b000-a800e000 rw-p 00000000 00:00 0 +-a800e000-a8022000 r-xp 00000000 03:00 14462 /lib/libpthread.so.0 +-a8022000-a8023000 r--p 00013000 03:00 14462 /lib/libpthread.so.0 +-a8023000-a8024000 rw-p 00014000 03:00 14462 /lib/libpthread.so.0 +-a8024000-a8027000 rw-p 00000000 00:00 0 +-a8027000-a8043000 r-xp 00000000 03:00 8317 /lib/ld-linux.so.2 +-a8043000-a8044000 r--p 0001b000 03:00 8317 /lib/ld-linux.so.2 +-a8044000-a8045000 rw-p 0001c000 03:00 8317 /lib/ld-linux.so.2 +-aff35000-aff4a000 rw-p 00000000 00:00 0 +-ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso] +- + The /proc/PID/smaps is an extension based on maps, showing the memory + consumption for each of the process's mappings. For each of mappings there + is a series of lines such as the following: +--- a/fs/proc/task_mmu.c ++++ b/fs/proc/task_mmu.c +@@ -248,24 +248,15 @@ static int do_maps_open(struct inode *in + * /proc/PID/maps that is the stack of the main task. + */ + static int is_stack(struct proc_maps_private *priv, +- struct vm_area_struct *vma, int is_pid) ++ struct vm_area_struct *vma) + { +- int stack = 0; +- +- if (is_pid) { +- stack = vma->vm_start <= vma->vm_mm->start_stack && +- vma->vm_end >= vma->vm_mm->start_stack; +- } else { +- struct inode *inode = priv->inode; +- struct task_struct *task; +- +- rcu_read_lock(); +- task = pid_task(proc_pid(inode), PIDTYPE_PID); +- if (task) +- stack = vma_is_stack_for_task(vma, task); +- rcu_read_unlock(); +- } +- return stack; ++ /* ++ * We make no effort to guess what a given thread considers to be ++ * its "stack". It's not even well-defined for programs written ++ * languages like Go. ++ */ ++ return vma->vm_start <= vma->vm_mm->start_stack && ++ vma->vm_end >= vma->vm_mm->start_stack; + } + + static void +@@ -332,7 +323,7 @@ show_map_vma(struct seq_file *m, struct + goto done; + } + +- if (is_stack(priv, vma, is_pid)) ++ if (is_stack(priv, vma)) + name = "[stack]"; + } + +@@ -1501,7 +1492,7 @@ static int show_numa_map(struct seq_file + seq_path(m, &file->f_path, "\n\t= "); + } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { + seq_puts(m, " heap"); +- } else if (is_stack(proc_priv, vma, is_pid)) { ++ } else if (is_stack(proc_priv, vma)) { + seq_puts(m, " stack"); + } + +--- a/fs/proc/task_nommu.c ++++ b/fs/proc/task_nommu.c +@@ -124,25 +124,17 @@ unsigned long task_statm(struct mm_struc + } + + static int is_stack(struct proc_maps_private *priv, +- struct vm_area_struct *vma, int is_pid) ++ struct vm_area_struct *vma) + { + struct mm_struct *mm = vma->vm_mm; +- int stack = 0; + +- if (is_pid) { +- stack = vma->vm_start <= mm->start_stack && +- vma->vm_end >= mm->start_stack; +- } else { +- struct inode *inode = priv->inode; +- struct task_struct *task; +- +- rcu_read_lock(); +- task = pid_task(proc_pid(inode), PIDTYPE_PID); +- if (task) +- stack = vma_is_stack_for_task(vma, task); +- rcu_read_unlock(); +- } +- return stack; ++ /* ++ * We make no effort to guess what a given thread considers to be ++ * its "stack". It's not even well-defined for programs written ++ * languages like Go. ++ */ ++ return vma->vm_start <= mm->start_stack && ++ vma->vm_end >= mm->start_stack; + } + + /* +@@ -184,7 +176,7 @@ static int nommu_vma_show(struct seq_fil + if (file) { + seq_pad(m, ' '); + seq_path(m, &file->f_path, ""); +- } else if (mm && is_stack(priv, vma, is_pid)) { ++ } else if (mm && is_stack(priv, vma)) { + seq_pad(m, ' '); + seq_printf(m, "[stack]"); + } diff --git a/queue-3.18/input-i8042-add-lenovo-thinkpad-l460-to-i8042-reset-list.patch b/queue-3.18/input-i8042-add-lenovo-thinkpad-l460-to-i8042-reset-list.patch new file mode 100644 index 00000000000..9f27373d926 --- /dev/null +++ b/queue-3.18/input-i8042-add-lenovo-thinkpad-l460-to-i8042-reset-list.patch @@ -0,0 +1,39 @@ +From b56af54ac78c54a519d82813836f305d7f76ef27 Mon Sep 17 00:00:00 2001 +From: Dennis Wassenberg +Date: Thu, 8 Mar 2018 15:32:09 -0800 +Subject: Input: i8042 - add Lenovo ThinkPad L460 to i8042 reset list + +From: Dennis Wassenberg + +commit b56af54ac78c54a519d82813836f305d7f76ef27 upstream. + +Reset i8042 before probing because of insufficient BIOS initialisation of +the i8042 serial controller. This makes Synaptics touchpad detection +possible. Without resetting the Synaptics touchpad is not detected because +there are always NACK messages from AUX port. + +Signed-off-by: Dennis Wassenberg +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/input/serio/i8042-x86ia64io.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/input/serio/i8042-x86ia64io.h ++++ b/drivers/input/serio/i8042-x86ia64io.h +@@ -603,6 +603,13 @@ static const struct dmi_system_id __init + }, + }, + { ++ /* Lenovo ThinkPad L460 */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"), ++ }, ++ }, ++ { + /* Clevo P650RS, 650RP6, Sager NP8152-S, and others */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Notebook"), diff --git a/queue-3.18/input-i8042-enable-mux-on-sony-vaio-vgn-cs-series-to-fix-touchpad.patch b/queue-3.18/input-i8042-enable-mux-on-sony-vaio-vgn-cs-series-to-fix-touchpad.patch new file mode 100644 index 00000000000..ec998421630 --- /dev/null +++ b/queue-3.18/input-i8042-enable-mux-on-sony-vaio-vgn-cs-series-to-fix-touchpad.patch @@ -0,0 +1,71 @@ +From 04bb1719c4de94700056241d4c0fe3c1413f5aff Mon Sep 17 00:00:00 2001 +From: Ondrej Zary +Date: Tue, 3 Apr 2018 10:24:34 -0700 +Subject: Input: i8042 - enable MUX on Sony VAIO VGN-CS series to fix touchpad + +From: Ondrej Zary + +commit 04bb1719c4de94700056241d4c0fe3c1413f5aff upstream. + +The touch sensor buttons on Sony VAIO VGN-CS series laptops (e.g. +VGN-CS31S) are a separate PS/2 device. As the MUX is disabled for all +VAIO machines by the nomux blacklist, the data from touch sensor +buttons and touchpad are combined. The protocol used by the buttons is +probably similar to the touchpad protocol (both are Synaptics) so both +devices get enabled. The controller combines the data, creating a mess +which results in random button clicks, touchpad stopping working and +lost sync error messages: +psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 4 +psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1 +psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1 +psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1 +psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1 +psmouse serio1: issuing reconnect request + +Add a new i8042_dmi_forcemux_table whitelist with VGN-CS. +With MUX enabled, touch sensor buttons are detected as separate device +(and left disabled as there's currently no driver), fixing all touchpad +problems. + +Signed-off-by: Ondrej Zary +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/input/serio/i8042-x86ia64io.h | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/drivers/input/serio/i8042-x86ia64io.h ++++ b/drivers/input/serio/i8042-x86ia64io.h +@@ -712,6 +712,20 @@ static const struct dmi_system_id __init + { } + }; + ++static const struct dmi_system_id i8042_dmi_forcemux_table[] __initconst = { ++ { ++ /* ++ * Sony Vaio VGN-CS series require MUX or the touch sensor ++ * buttons will disturb touchpad operation ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"), ++ }, ++ }, ++ { } ++}; ++ + /* + * Some Wistron based laptops need us to explicitly enable the 'Dritek + * keyboard extension' to make their extra keys start generating scancodes. +@@ -1124,6 +1138,9 @@ static int __init i8042_platform_init(vo + if (dmi_check_system(i8042_dmi_nomux_table)) + i8042_nomux = true; + ++ if (dmi_check_system(i8042_dmi_forcemux_table)) ++ i8042_nomux = false; ++ + if (dmi_check_system(i8042_dmi_notimeout_table)) + i8042_notimeout = true; + diff --git a/queue-3.18/md-raid10-reset-the-first-at-the-end-of-loop.patch b/queue-3.18/md-raid10-reset-the-first-at-the-end-of-loop.patch new file mode 100644 index 00000000000..f594cd9359c --- /dev/null +++ b/queue-3.18/md-raid10-reset-the-first-at-the-end-of-loop.patch @@ -0,0 +1,38 @@ +From 6f287ca6046edd34ed83aafb7f9033c9c2e809e2 Mon Sep 17 00:00:00 2001 +From: Guoqing Jiang +Date: Thu, 6 Apr 2017 09:12:18 +0800 +Subject: md/raid10: reset the 'first' at the end of loop + +From: Guoqing Jiang + +commit 6f287ca6046edd34ed83aafb7f9033c9c2e809e2 upstream. + +We need to set "first = 0' at the end of rdev_for_each +loop, so we can get the array's min_offset_diff correctly +otherwise min_offset_diff just means the last rdev's +offset diff. + +[only the first chunk, due to b506335e5d2b ("md/raid10: skip spare disk as +'first' disk") being already applied - gregkh] + +Suggested-by: NeilBrown +Signed-off-by: Guoqing Jiang +Reviewed-by: NeilBrown +Signed-off-by: Shaohua Li +Cc: Ben Hutchings +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/raid10.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/md/raid10.c ++++ b/drivers/md/raid10.c +@@ -3717,6 +3717,7 @@ static int run(struct mddev *mddev) + + if (blk_queue_discard(bdev_get_queue(rdev->bdev))) + discard_supported = true; ++ first = 0; + } + + if (mddev->queue) { diff --git a/queue-3.18/proc-revert-proc-pid-maps-annotation.patch b/queue-3.18/proc-revert-proc-pid-maps-annotation.patch new file mode 100644 index 00000000000..9935659f6b0 --- /dev/null +++ b/queue-3.18/proc-revert-proc-pid-maps-annotation.patch @@ -0,0 +1,305 @@ +From 65376df582174ffcec9e6471bf5b0dd79ba05e4a Mon Sep 17 00:00:00 2001 +From: Johannes Weiner +Date: Tue, 2 Feb 2016 16:57:29 -0800 +Subject: proc: revert /proc//maps [stack:TID] annotation + +From: Johannes Weiner + +commit 65376df582174ffcec9e6471bf5b0dd79ba05e4a upstream. + +Commit b76437579d13 ("procfs: mark thread stack correctly in +proc//maps") added [stack:TID] annotation to /proc//maps. + +Finding the task of a stack VMA requires walking the entire thread list, +turning this into quadratic behavior: a thousand threads means a +thousand stacks, so the rendering of /proc//maps needs to look at a +million combinations. + +The cost is not in proportion to the usefulness as described in the +patch. + +Drop the [stack:TID] annotation to make /proc//maps (and +/proc//numa_maps) usable again for higher thread counts. + +The [stack] annotation inside /proc//task//maps is retained, as +identifying the stack VMA there is an O(1) operation. + +Siddesh said: + "The end users needed a way to identify thread stacks programmatically and + there wasn't a way to do that. I'm afraid I no longer remember (or have + access to the resources that would aid my memory since I changed + employers) the details of their requirement. However, I did do this on my + own time because I thought it was an interesting project for me and nobody + really gave any feedback then as to its utility, so as far as I am + concerned you could roll back the main thread maps information since the + information is available in the thread-specific files" + +Signed-off-by: Johannes Weiner +Cc: "Kirill A. Shutemov" +Cc: Siddhesh Poyarekar +Cc: Shaohua Li +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Cc: Ben Hutchings +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/filesystems/proc.txt | 9 +---- + fs/proc/task_mmu.c | 66 ++++++++++++------------------------- + fs/proc/task_nommu.c | 49 +++++++++++---------------- + include/linux/mm.h | 3 - + mm/util.c | 27 --------------- + 5 files changed, 48 insertions(+), 106 deletions(-) + +--- a/Documentation/filesystems/proc.txt ++++ b/Documentation/filesystems/proc.txt +@@ -334,7 +334,7 @@ address perms offset dev in + a7cb1000-a7cb2000 ---p 00000000 00:00 0 + a7cb2000-a7eb2000 rw-p 00000000 00:00 0 + a7eb2000-a7eb3000 ---p 00000000 00:00 0 +-a7eb3000-a7ed5000 rw-p 00000000 00:00 0 [stack:1001] ++a7eb3000-a7ed5000 rw-p 00000000 00:00 0 + a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6 + a8008000-a800a000 r--p 00133000 03:00 4222 /lib/libc.so.6 + a800a000-a800b000 rw-p 00135000 03:00 4222 /lib/libc.so.6 +@@ -366,7 +366,6 @@ is not associated with a file: + + [heap] = the heap of the program + [stack] = the stack of the main process +- [stack:1001] = the stack of the thread with tid 1001 + [vdso] = the "virtual dynamic shared object", + the kernel system call handler + +@@ -374,10 +373,8 @@ is not associated with a file: + + The /proc/PID/task/TID/maps is a view of the virtual memory from the viewpoint + of the individual tasks of a process. In this file you will see a mapping marked +-as [stack] if that task sees it as a stack. This is a key difference from the +-content of /proc/PID/maps, where you will see all mappings that are being used +-as stack by all of those tasks. Hence, for the example above, the task-level +-map, i.e. /proc/PID/task/TID/maps for thread 1001 will look like this: ++as [stack] if that task sees it as a stack. Hence, for the example above, the ++task-level map, i.e. /proc/PID/task/TID/maps for thread 1001 will look like this: + + 08048000-08049000 r-xp 00000000 03:00 8312 /opt/test + 08049000-0804a000 rw-p 00001000 03:00 8312 /opt/test +--- a/fs/proc/task_mmu.c ++++ b/fs/proc/task_mmu.c +@@ -243,23 +243,29 @@ static int do_maps_open(struct inode *in + sizeof(struct proc_maps_private)); + } + +-static pid_t pid_of_stack(struct proc_maps_private *priv, +- struct vm_area_struct *vma, bool is_pid) ++/* ++ * Indicate if the VMA is a stack for the given task; for ++ * /proc/PID/maps that is the stack of the main task. ++ */ ++static int is_stack(struct proc_maps_private *priv, ++ struct vm_area_struct *vma, int is_pid) + { +- struct inode *inode = priv->inode; +- struct task_struct *task; +- pid_t ret = 0; ++ int stack = 0; ++ ++ if (is_pid) { ++ stack = vma->vm_start <= vma->vm_mm->start_stack && ++ vma->vm_end >= vma->vm_mm->start_stack; ++ } else { ++ struct inode *inode = priv->inode; ++ struct task_struct *task; + +- rcu_read_lock(); +- task = pid_task(proc_pid(inode), PIDTYPE_PID); +- if (task) { +- task = task_of_stack(task, vma, is_pid); ++ rcu_read_lock(); ++ task = pid_task(proc_pid(inode), PIDTYPE_PID); + if (task) +- ret = task_pid_nr_ns(task, inode->i_sb->s_fs_info); ++ stack = vma_is_stack_for_task(vma, task); ++ rcu_read_unlock(); + } +- rcu_read_unlock(); +- +- return ret; ++ return stack; + } + + static void +@@ -315,8 +321,6 @@ show_map_vma(struct seq_file *m, struct + + name = arch_vma_name(vma); + if (!name) { +- pid_t tid; +- + if (!mm) { + name = "[vdso]"; + goto done; +@@ -328,21 +332,8 @@ show_map_vma(struct seq_file *m, struct + goto done; + } + +- tid = pid_of_stack(priv, vma, is_pid); +- if (tid != 0) { +- /* +- * Thread stack in /proc/PID/task/TID/maps or +- * the main process stack. +- */ +- if (!is_pid || (vma->vm_start <= mm->start_stack && +- vma->vm_end >= mm->start_stack)) { +- name = "[stack]"; +- } else { +- /* Thread stack in /proc/PID/maps */ +- seq_pad(m, ' '); +- seq_printf(m, "[stack:%d]", tid); +- } +- } ++ if (is_stack(priv, vma, is_pid)) ++ name = "[stack]"; + } + + done: +@@ -1510,19 +1501,8 @@ static int show_numa_map(struct seq_file + seq_path(m, &file->f_path, "\n\t= "); + } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { + seq_puts(m, " heap"); +- } else { +- pid_t tid = pid_of_stack(proc_priv, vma, is_pid); +- if (tid != 0) { +- /* +- * Thread stack in /proc/PID/task/TID/maps or +- * the main process stack. +- */ +- if (!is_pid || (vma->vm_start <= mm->start_stack && +- vma->vm_end >= mm->start_stack)) +- seq_puts(m, " stack"); +- else +- seq_printf(m, " stack:%d", tid); +- } ++ } else if (is_stack(proc_priv, vma, is_pid)) { ++ seq_puts(m, " stack"); + } + + if (is_vm_hugetlb_page(vma)) +--- a/fs/proc/task_nommu.c ++++ b/fs/proc/task_nommu.c +@@ -123,23 +123,26 @@ unsigned long task_statm(struct mm_struc + return size; + } + +-static pid_t pid_of_stack(struct proc_maps_private *priv, +- struct vm_area_struct *vma, bool is_pid) ++static int is_stack(struct proc_maps_private *priv, ++ struct vm_area_struct *vma, int is_pid) + { +- struct inode *inode = priv->inode; +- struct task_struct *task; +- pid_t ret = 0; +- +- rcu_read_lock(); +- task = pid_task(proc_pid(inode), PIDTYPE_PID); +- if (task) { +- task = task_of_stack(task, vma, is_pid); ++ struct mm_struct *mm = vma->vm_mm; ++ int stack = 0; ++ ++ if (is_pid) { ++ stack = vma->vm_start <= mm->start_stack && ++ vma->vm_end >= mm->start_stack; ++ } else { ++ struct inode *inode = priv->inode; ++ struct task_struct *task; ++ ++ rcu_read_lock(); ++ task = pid_task(proc_pid(inode), PIDTYPE_PID); + if (task) +- ret = task_pid_nr_ns(task, inode->i_sb->s_fs_info); ++ stack = vma_is_stack_for_task(vma, task); ++ rcu_read_unlock(); + } +- rcu_read_unlock(); +- +- return ret; ++ return stack; + } + + /* +@@ -181,21 +184,9 @@ static int nommu_vma_show(struct seq_fil + if (file) { + seq_pad(m, ' '); + seq_path(m, &file->f_path, ""); +- } else if (mm) { +- pid_t tid = pid_of_stack(priv, vma, is_pid); +- +- if (tid != 0) { +- seq_pad(m, ' '); +- /* +- * Thread stack in /proc/PID/task/TID/maps or +- * the main process stack. +- */ +- if (!is_pid || (vma->vm_start <= mm->start_stack && +- vma->vm_end >= mm->start_stack)) +- seq_printf(m, "[stack]"); +- else +- seq_printf(m, "[stack:%d]", tid); +- } ++ } else if (mm && is_stack(priv, vma, is_pid)) { ++ seq_pad(m, ' '); ++ seq_printf(m, "[stack]"); + } + + seq_putc(m, '\n'); +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -1242,8 +1242,7 @@ int set_page_dirty_lock(struct page *pag + int clear_page_dirty_for_io(struct page *page); + int get_cmdline(struct task_struct *task, char *buffer, int buflen); + +-extern struct task_struct *task_of_stack(struct task_struct *task, +- struct vm_area_struct *vma, bool in_group); ++int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t); + + extern unsigned long move_page_tables(struct vm_area_struct *vma, + unsigned long old_addr, struct vm_area_struct *new_vma, +--- a/mm/util.c ++++ b/mm/util.c +@@ -185,36 +185,11 @@ void __vma_link_list(struct mm_struct *m + } + + /* Check if the vma is being used as a stack by this task */ +-static int vm_is_stack_for_task(struct task_struct *t, +- struct vm_area_struct *vma) ++int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t) + { + return (vma->vm_start <= KSTK_ESP(t) && vma->vm_end >= KSTK_ESP(t)); + } + +-/* +- * Check if the vma is being used as a stack. +- * If is_group is non-zero, check in the entire thread group or else +- * just check in the current task. Returns the task_struct of the task +- * that the vma is stack for. Must be called under rcu_read_lock(). +- */ +-struct task_struct *task_of_stack(struct task_struct *task, +- struct vm_area_struct *vma, bool in_group) +-{ +- if (vm_is_stack_for_task(task, vma)) +- return task; +- +- if (in_group) { +- struct task_struct *t; +- +- for_each_thread(task, t) { +- if (vm_is_stack_for_task(t, vma)) +- return t; +- } +- } +- +- return NULL; +-} +- + #if defined(CONFIG_MMU) && !defined(HAVE_ARCH_PICK_MMAP_LAYOUT) + void arch_pick_mmap_layout(struct mm_struct *mm) + { diff --git a/queue-3.18/series b/queue-3.18/series index 43f2dd396f6..c05ae94d8f4 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -80,3 +80,11 @@ media-usbtv-prevent-double-free-in-error-case.patch parport_pc-add-support-for-wch-ch382l-pci-e-single-parallel-port-card.patch crypto-ahash-fix-early-termination-in-hash-walk.patch crypto-x86-cast5-avx-fix-ecb-encryption-when-long-sg-follows-short-one.patch +proc-revert-proc-pid-maps-annotation.patch +fs-proc-stop-trying-to-report-thread-stacks.patch +input-i8042-add-lenovo-thinkpad-l460-to-i8042-reset-list.patch +input-i8042-enable-mux-on-sony-vaio-vgn-cs-series-to-fix-touchpad.patch +vt-change-sgr-21-to-follow-the-standards.patch +documentation-pinctrl-palmas-add-ti-palmas-powerhold-override-property-definition.patch +arm-dts-dra7-add-power-hold-and-power-controller-properties-to-palmas.patch +md-raid10-reset-the-first-at-the-end-of-loop.patch diff --git a/queue-3.18/vt-change-sgr-21-to-follow-the-standards.patch b/queue-3.18/vt-change-sgr-21-to-follow-the-standards.patch new file mode 100644 index 00000000000..e5c82fce176 --- /dev/null +++ b/queue-3.18/vt-change-sgr-21-to-follow-the-standards.patch @@ -0,0 +1,66 @@ +From 65d9982d7e523a1a8e7c9af012da0d166f72fc56 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Mon, 29 Jan 2018 17:08:21 -0500 +Subject: vt: change SGR 21 to follow the standards + +From: Mike Frysinger + +commit 65d9982d7e523a1a8e7c9af012da0d166f72fc56 upstream. + +ECMA-48 [1] (aka ISO 6429) has defined SGR 21 as "doubly underlined" +since at least March 1984. The Linux kernel has treated it as SGR 22 +"normal intensity" since it was added in Linux-0.96b in June 1992. +Before that, it was simply ignored. Other terminal emulators have +either ignored it, or treat it as double underline now. xterm for +example added support in its 304 release (May 2014) [2] where it was +previously ignoring it. + +Changing this behavior shouldn't be an issue: +- It isn't a named capability in ncurses's terminfo database, so no + script is using libtinfo/libcurses to look this up, or using tput + to query & output the right sequence. +- Any script assuming SGR 21 will reset intensity in all terminals + already do not work correctly on non-Linux VTs (including running + under screen/tmux/etc...). +- If someone has written a script that only runs in the Linux VT, and + they're using SGR 21 (instead of SGR 22), the output should still + be readable. + +imo it's important to change this as the Linux VT's non-conformance +is sometimes used as an argument for other terminal emulators to not +implement SGR 21 at all, or do so incorrectly. + +[1]: https://www.ecma-international.org/publications/standards/Ecma-048.htm +[2]: https://github.com/ThomasDickey/xterm-snapshots/commit/2fd29cb98d214cb536bcafbee00bc73b3f1eeb9d + +Signed-off-by: Mike Frysinger +Cc: stable +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/vt/vt.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/tty/vt/vt.c ++++ b/drivers/tty/vt/vt.c +@@ -1303,6 +1303,11 @@ static void csi_m(struct vc_data *vc) + case 3: + vc->vc_italic = 1; + break; ++ case 21: ++ /* ++ * No console drivers support double underline, so ++ * convert it to a single underline. ++ */ + case 4: + vc->vc_underline = 1; + break; +@@ -1339,7 +1344,6 @@ static void csi_m(struct vc_data *vc) + vc->vc_disp_ctrl = 1; + vc->vc_toggle_meta = 1; + break; +- case 21: + case 22: + vc->vc_intensity = 1; + break;