Remove taskname from lowmemorykiller kill reports

Required because the lowmem_shrinker cannot use get_cmdline when called
from the direct reclaim path. Direct reclaim in do_page_fault() takes
mm->mmap_sem before calling shrinkers and get_cmdline also takes
mm->mmap_sem by calling access_process_vm. Userspace should be able to
recover taskname using the reported PID.

Bug: 130017100
Signed-off-by: Jim Blackler <jimblackler@google.com>
Test: Manually
Change-Id: I5f8b15bda60f9e2c0f6373ef54ad6fb95cda7a44
This commit is contained in:
Jim Blackler
2020-12-12 22:47:50 +01:00
committed by Francescodario Cuzzocrea
parent a716a13c15
commit f805bf7eab
+1 -14
View File
@@ -114,21 +114,8 @@ void handle_lmk_event(struct task_struct *selected, int selected_tasksize,
int tail;
struct lmk_event *events;
struct lmk_event *event;
int res;
char taskname[MAX_TASKNAME];
unsigned long long start_time;
res = get_cmdline(selected, taskname, MAX_TASKNAME - 1);
/* No valid process name means this is definitely not associated with a
* userspace activity.
*/
if (res <= 0 || res >= MAX_TASKNAME)
return;
taskname[res] = '\0';
spin_lock(&lmk_event_lock);
head = event_buffer.head;
@@ -146,7 +133,7 @@ void handle_lmk_event(struct task_struct *selected, int selected_tasksize,
(unsigned long long)selected->real_start_time.tv_sec * NSEC_PER_SEC
+ selected->real_start_time.tv_nsec;
memcpy(event->taskname, taskname, res + 1);
strncpy(event->taskname, selected->comm, MAX_TASKNAME);
event->pid = selected->pid;
event->uid = from_kuid_munged(current_user_ns(), task_uid(selected));