|
Packit Service |
da4517 |
Index: kernel/fs/proc/array.c
|
|
Packit Service |
da4517 |
===================================================================
|
|
Packit Service |
da4517 |
--- kernel.orig/fs/proc/array.c
|
|
Packit Service |
da4517 |
+++ kernel/fs/proc/array.c
|
|
Packit Service |
da4517 |
@@ -395,13 +395,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: kernel/kernel/exit.c
|
|
Packit Service |
da4517 |
===================================================================
|
|
Packit Service |
da4517 |
--- kernel.orig/kernel/exit.c
|
|
Packit Service |
da4517 |
+++ kernel/kernel/exit.c
|
|
Packit Service |
da4517 |
@@ -791,6 +791,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 |
@@ -888,6 +889,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, 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 |
Index: kernel/kernel/fork.c
|
|
Packit Service |
da4517 |
===================================================================
|
|
Packit Service |
da4517 |
--- kernel.orig/kernel/fork.c
|
|
Packit Service |
da4517 |
+++ kernel/kernel/fork.c
|
|
Packit Service |
da4517 |
@@ -1760,6 +1760,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 |
@@ -1797,6 +1798,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, 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 |
trace_sched_process_fork(current, p);
|
|
Packit Service |
da4517 |
|