|
Packit Service |
da4517 |
Disabled due to https:/github.com/dynup/kpatch/issues/940
|
|
Packit Service |
da4517 |
---
|
|
Packit Service |
da4517 |
diff -Nupr src/fs/proc/array.c src/fs/proc/array.c
|
|
Packit Service |
da4517 |
--- src/fs/proc/array.c 2020-03-11 11:23:26.874602392 +0000
|
|
Packit Service |
da4517 |
+++ src/fs/proc/array.c 2020-03-11 11:48:34.514964309 +0000
|
|
Packit Service |
da4517 |
@@ -370,12 +370,19 @@ static inline void task_seccomp(struct s
|
|
Packit Service |
da4517 |
seq_putc(m, '\n');
|
|
Packit Service |
da4517 |
}
|
|
Packit Service |
da4517 |
|
|
Packit Service |
da4517 |
+#include <linux/livepatch.h>
|
|
Packit Service |
da4517 |
static inline void task_context_switch_counts(struct seq_file *m,
|
|
Packit Service |
da4517 |
struct task_struct *p)
|
|
Packit Service |
da4517 |
{
|
|
Packit Service |
da4517 |
+ int *newpid;
|
|
Packit Service |
da4517 |
+
|
|
Packit Service |
da4517 |
seq_put_decimal_ull(m, "voluntary_ctxt_switches:\t", p->nvcsw);
|
|
Packit Service |
da4517 |
seq_put_decimal_ull(m, "\nnonvoluntary_ctxt_switches:\t", p->nivcsw);
|
|
Packit Service |
da4517 |
seq_putc(m, '\n');
|
|
Packit Service |
da4517 |
+
|
|
Packit Service |
da4517 |
+ newpid = klp_shadow_get(p, 0);
|
|
Packit Service |
da4517 |
+ if (newpid)
|
|
Packit Service |
da4517 |
+ seq_printf(m, "newpid:\t%d\n", *newpid);
|
|
Packit Service |
da4517 |
}
|
|
Packit Service |
da4517 |
|
|
Packit Service |
da4517 |
static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
|
|
Packit Service |
da4517 |
diff -Nupr src/kernel/exit.c src/kernel/exit.c
|
|
Packit Service |
da4517 |
--- src/kernel/exit.c 2020-03-11 11:23:30.434682812 +0000
|
|
Packit Service |
da4517 |
+++ src/kernel/exit.c 2020-03-11 11:48:34.514964309 +0000
|
|
Packit Service |
da4517 |
@@ -762,6 +762,7 @@ static void check_stack_usage(void)
|
|
Packit Service |
da4517 |
static inline void check_stack_usage(void) {}
|
|
Packit Service |
da4517 |
#endif
|
|
Packit Service |
da4517 |
|
|
Packit Service |
da4517 |
+#include <linux/livepatch.h>
|
|
Packit Service |
da4517 |
void __noreturn do_exit(long code)
|
|
Packit Service |
da4517 |
{
|
|
Packit Service |
da4517 |
struct task_struct *tsk = current;
|
|
Packit Service |
da4517 |
@@ -868,6 +869,8 @@ void __noreturn do_exit(long code)
|
|
Packit Service |
da4517 |
exit_thread(tsk);
|
|
Packit Service |
da4517 |
exit_umh(tsk);
|
|
Packit Service |
da4517 |
|
|
Packit Service |
da4517 |
+ klp_shadow_free(tsk, 0, NULL);
|
|
Packit Service |
da4517 |
+
|
|
Packit Service |
da4517 |
/*
|
|
Packit Service |
da4517 |
* Flush inherited counters to the parent - before the parent
|
|
Packit Service |
da4517 |
* gets woken up by child-exit notifications.
|
|
Packit Service |
da4517 |
diff -Nupr src/kernel/fork.c src/kernel/fork.c
|
|
Packit Service |
da4517 |
--- src/kernel/fork.c 2020-03-11 11:23:30.438682903 +0000
|
|
Packit Service |
da4517 |
+++ src/kernel/fork.c 2020-03-11 11:48:34.514964309 +0000
|
|
Packit Service |
da4517 |
@@ -2210,6 +2210,7 @@ struct task_struct *fork_idle(int cpu)
|
|
Packit Service |
da4517 |
* It copies the process, and if successful kick-starts
|
|
Packit Service |
da4517 |
* it and waits for it to finish using the VM if required.
|
|
Packit Service |
da4517 |
*/
|
|
Packit Service |
da4517 |
+#include <linux/livepatch.h>
|
|
Packit Service |
da4517 |
long _do_fork(unsigned long clone_flags,
|
|
Packit Service |
da4517 |
unsigned long stack_start,
|
|
Packit Service |
da4517 |
unsigned long stack_size,
|
|
Packit Service |
da4517 |
@@ -2222,6 +2223,8 @@ long _do_fork(unsigned long clone_flags,
|
|
Packit Service |
da4517 |
struct task_struct *p;
|
|
Packit Service |
da4517 |
int trace = 0;
|
|
Packit Service |
da4517 |
long nr;
|
|
Packit Service |
da4517 |
+ int *newpid;
|
|
Packit Service |
da4517 |
+ static int ctr = 0;
|
|
Packit Service |
da4517 |
|
|
Packit Service |
da4517 |
/*
|
|
Packit Service |
da4517 |
* Determine whether and which event to report to ptracer. When
|
|
Packit Service |
da4517 |
@@ -2248,6 +2251,11 @@ long _do_fork(unsigned long clone_flags,
|
|
Packit Service |
da4517 |
if (IS_ERR(p))
|
|
Packit Service |
da4517 |
return PTR_ERR(p);
|
|
Packit Service |
da4517 |
|
|
Packit Service |
da4517 |
+ newpid = klp_shadow_get_or_alloc(p, 0, sizeof(*newpid), GFP_KERNEL,
|
|
Packit Service |
da4517 |
+ NULL, NULL);
|
|
Packit Service |
da4517 |
+ if (newpid)
|
|
Packit Service |
da4517 |
+ *newpid = ctr++;
|
|
Packit Service |
da4517 |
+
|
|
Packit Service |
da4517 |
/*
|
|
Packit Service |
da4517 |
* Do this prior waking up the new thread - the thread pointer
|
|
Packit Service |
da4517 |
* might get invalid after that point, if the thread exits quickly.
|