|
Packit Service |
da4517 |
Index: src/fs/proc/array.c
|
|
Packit Service |
da4517 |
===================================================================
|
|
Packit Service |
da4517 |
--- src.orig/fs/proc/array.c
|
|
Packit Service |
da4517 |
+++ src/fs/proc/array.c
|
|
Packit Service |
da4517 |
@@ -394,13 +394,20 @@ 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_printf(m, "voluntary_ctxt_switches:\t%lu\n"
|
|
Packit Service |
da4517 |
"nonvoluntary_ctxt_switches:\t%lu\n",
|
|
Packit Service |
da4517 |
p->nvcsw,
|
|
Packit Service |
da4517 |
p->nivcsw);
|
|
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 |
Index: src/kernel/exit.c
|
|
Packit Service |
da4517 |
===================================================================
|
|
Packit Service |
da4517 |
--- src.orig/kernel/exit.c
|
|
Packit Service |
da4517 |
+++ src/kernel/exit.c
|
|
Packit Service |
da4517 |
@@ -715,6 +715,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 do_exit(long code)
|
|
Packit Service |
da4517 |
{
|
|
Packit Service |
da4517 |
struct task_struct *tsk = current;
|
|
Packit Service |
da4517 |
@@ -812,6 +813,8 @@ void do_exit(long code)
|
|
Packit Service |
da4517 |
check_stack_usage();
|
|
Packit Service |
da4517 |
exit_thread();
|
|
Packit Service |
da4517 |
|
|
Packit Service |
da4517 |
+ klp_shadow_free(tsk, 0);
|
|
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 |
Index: src/kernel/fork.c
|
|
Packit Service |
da4517 |
===================================================================
|
|
Packit Service |
da4517 |
--- src.orig/kernel/fork.c
|
|
Packit Service |
da4517 |
+++ src/kernel/fork.c
|
|
Packit Service |
da4517 |
@@ -1751,6 +1751,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 |
@@ -1788,6 +1789,13 @@ long do_fork(unsigned long clone_flags,
|
|
Packit Service |
da4517 |
if (!IS_ERR(p)) {
|
|
Packit Service |
da4517 |
struct completion vfork;
|
|
Packit Service |
da4517 |
struct pid *pid;
|
|
Packit Service |
da4517 |
+ int *newpid;
|
|
Packit Service |
da4517 |
+ static int ctr = 0;
|
|
Packit Service |
da4517 |
+
|
|
Packit Service |
da4517 |
+ newpid = klp_shadow_get_or_alloc(p, 0, NULL, sizeof(*newpid),
|
|
Packit Service |
da4517 |
+ GFP_KERNEL);
|
|
Packit Service |
da4517 |
+ if (newpid)
|
|
Packit Service |
da4517 |
+ *newpid = ctr++;
|
|
Packit Service |
da4517 |
|
|
Packit Service |
da4517 |
trace_sched_process_fork(current, p);
|
|
Packit Service |
da4517 |
|