Skip to contentSkip to conversation

proc: Remove empty line in /proc/self/status

PATCH In review Guenter Roeck 3 participants 3 messages Jan 16, 2019 – Jan 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: Remove empty line in /proc/self/status

If CONFIG_SECCOMP=n, /proc/self/status includes an empty line. This causes the iotop application to bail out with an error message.

File "/usr/local/lib64/python2.7/site-packages/iotop/data.py", line 196,
in parse_proc_pid_status
key, value = line.split(':\t', 1)
ValueError: need more than 1 value to unpack

The problem is seen in v4.9.y but not upstream because commit af884cd4a5ae6 ("proc: report no_new_privs state") has not been backported to v4.9.y. The backport of commit fae1fa0fc6cc ("proc: Provide details on speculation flaw mitigations") tried to address the resulting differences but was wrong, introducing the problem.

Fixes 51ef9af2a35b ("proc: Provide details on speculation flaw mitigations")
Cc Kees Cook <[email protected]>
Cc Gwendal Grignou <[email protected]>

---
This patch only applies to v4.9.y. v4.4.y also needs to be fixed (see
https://www.spinics.net/lists/stable/msg279131.html), but the fix is slightly different. v4.14.y and later are not affected.

 fs/proc/array.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/array.c +2 -1
index 94f83e74db24..712b44c63701 100644
@@ -346,8 +346,9 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
 {
 #ifdef CONFIG_SECCOMP
 	seq_put_decimal_ull(m, "Seccomp:\t", p->seccomp.mode);
+	seq_putc(m, '\n');
 #endif
-	seq_printf(m, "\nSpeculation_Store_Bypass:\t");
+	seq_printf(m, "Speculation_Store_Bypass:\t");
 	switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) {
 	case -EINVAL:
 		seq_printf(m, "unknown");
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Guenter Roeck

If CONFIG_SECCOMP=n, /proc/self/status includes an empty line. This causes the iotop application to bail out with an error message.

File "/usr/local/lib64/python2.7/site-packages/iotop/data.py", line 196,
in parse_proc_pid_status
key, value = line.split(':\t', 1)
ValueError: need more than 1 value to unpack

The problem is seen in v4.9.y but not upstream because commit af884cd4a5ae6 ("proc: report no_new_privs state") has not been backported to v4.9.y. The backport of commit fae1fa0fc6cc ("proc: Provide details on speculation flaw mitigations") tried to address the resulting differences but was wrong, introducing the problem.

Quoted 4 lines
Fixes 51ef9af2a35b ("proc: Provide details on speculation flaw mitigations")
Cc Kees Cook <[email protected]>
Cc Gwendal Grignou <[email protected]>

-Kees

Quoted 26 lines

---
This patch only applies to v4.9.y. v4.4.y also needs to be fixed (see
https://www.spinics.net/lists/stable/msg279131.html), but the fix is slightly different. v4.14.y and later are not affected.

 fs/proc/array.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/array.c +2 -2
index 94f83e74db24..712b44c63701 100644
@@ -346,8 +346,9 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
 {
 #ifdef CONFIG_SECCOMP
        seq_put_decimal_ull(m, "Seccomp:\t", p->seccomp.mode);
+       seq_putc(m, '\n');
 #endif
-       seq_printf(m, "\nSpeculation_Store_Bypass:\t");
+       seq_printf(m, "Speculation_Store_Bypass:\t");
        switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) {
        case -EINVAL:
                seq_printf(m, "unknown");
--

2.7.4

Signature · 1 line
Kees Cook
#2 lore raw
In reply to Guenter Roeck
Quoted 14 lines · Guenter Roeck

If CONFIG_SECCOMP=n, /proc/self/status includes an empty line. This causes the iotop application to bail out with an error message.

File "/usr/local/lib64/python2.7/site-packages/iotop/data.py", line 196,
in parse_proc_pid_status
key, value = line.split(':\t', 1)
ValueError: need more than 1 value to unpack

The problem is seen in v4.9.y but not upstream because commit af884cd4a5ae6 ("proc: report no_new_privs state") has not been backported to v4.9.y. The backport of commit fae1fa0fc6cc ("proc: Provide details on speculation flaw mitigations") tried to address the resulting differences but was wrong, introducing the problem.

Quoted 8 lines
Fixes 51ef9af2a35b ("proc: Provide details on speculation flaw mitigations")
Cc Kees Cook <[email protected]>
Cc Gwendal Grignou <[email protected]>

---
This patch only applies to v4.9.y. v4.4.y also needs to be fixed (see
https://www.spinics.net/lists/stable/msg279131.html), but the fix is slightly different. v4.14.y and later are not affected.

Now queued up, thanks.

greg k-h