Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/integration/rhel-8.9: integration testing for rhel-8.9 #1366

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/integration/rhel-8.9/bug-table-section.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c
--- src.orig/fs/proc/proc_sysctl.c 2023-05-18 13:26:13.304170797 -0400
+++ src/fs/proc/proc_sysctl.c 2023-05-18 13:26:13.738170286 -0400
@@ -338,6 +338,8 @@ static void start_unregistering(struct c

static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
{
+ if (jiffies == 0)
+ printk("kpatch-test: testing __bug_table section changes\n");
BUG_ON(!head);
spin_lock(&sysctl_lock);
if (!use_table(head))
3 changes: 3 additions & 0 deletions test/integration/rhel-8.9/cmdline-string-LOADED.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

grep kpatch=1 /proc/cmdline
13 changes: 13 additions & 0 deletions test/integration/rhel-8.9/cmdline-string.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c
--- src.orig/fs/proc/cmdline.c 2023-05-18 13:26:13.304170797 -0400
+++ src/fs/proc/cmdline.c 2023-05-18 13:26:20.040162860 -0400
@@ -6,8 +6,7 @@

static int cmdline_proc_show(struct seq_file *m, void *v)
{
- seq_puts(m, saved_command_line);
- seq_putc(m, '\n');
+ seq_printf(m, "%s kpatch=1\n", saved_command_line);
return 0;
}

3 changes: 3 additions & 0 deletions test/integration/rhel-8.9/data-new-LOADED.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

grep "kpatch: 5" /proc/meminfo
20 changes: 20 additions & 0 deletions test/integration/rhel-8.9/data-new.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c
--- src.orig/fs/proc/meminfo.c 2023-05-18 13:26:13.304170797 -0400
+++ src/fs/proc/meminfo.c 2023-05-18 13:26:27.035154617 -0400
@@ -31,6 +31,8 @@ static void show_val_kb(struct seq_file
seq_write(m, " kB\n", 4);
}

+static int foo = 5;
+
static int meminfo_proc_show(struct seq_file *m, void *v)
{
struct sysinfo i;
@@ -150,6 +152,7 @@ static int meminfo_proc_show(struct seq_
show_val_kb(m, "CmaFree: ",
global_zone_page_state(NR_FREE_CMA_PAGES));
#endif
+ seq_printf(m, "kpatch: %d\n", foo);

hugetlb_report_meminfo(m);

11 changes: 11 additions & 0 deletions test/integration/rhel-8.9/data-read-mostly.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff -Nupr src.orig/net/core/dev.c src/net/core/dev.c
--- src.orig/net/core/dev.c 2023-05-18 13:26:13.486170583 -0400
+++ src/net/core/dev.c 2023-05-18 13:26:31.948148828 -0400
@@ -5440,6 +5440,7 @@ skip_classify:
case RX_HANDLER_PASS:
break;
default:
+ printk("BUG!\n");
BUG();
}
}
11 changes: 11 additions & 0 deletions test/integration/rhel-8.9/fixup-section.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff -Nupr src.orig/fs/readdir.c src/fs/readdir.c
--- src.orig/fs/readdir.c 2023-05-18 13:26:13.306170795 -0400
+++ src/fs/readdir.c 2023-05-18 13:26:37.497142290 -0400
@@ -189,6 +189,7 @@ static int filldir(struct dir_context *c
goto efault;
}
dirent = buf->current_dir;
+ asm("nop");
if (__put_user(d_ino, &dirent->d_ino))
goto efault;
if (__put_user(reclen, &dirent->d_reclen))
13 changes: 13 additions & 0 deletions test/integration/rhel-8.9/gcc-constprop.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c
--- src.orig/kernel/time/timekeeping.c 2023-05-18 13:26:13.459170615 -0400
+++ src/kernel/time/timekeeping.c 2023-05-18 13:26:42.511136382 -0400
@@ -1231,6 +1231,9 @@ void do_gettimeofday(struct timeval *tv)
{
struct timespec64 now;

+ if (!tv)
+ return;
+
getnstimeofday64(&now);
tv->tv_sec = now.tv_sec;
tv->tv_usec = now.tv_nsec/1000;
11 changes: 11 additions & 0 deletions test/integration/rhel-8.9/gcc-isra.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c
--- src.orig/fs/proc/proc_sysctl.c 2023-05-18 13:26:13.304170797 -0400
+++ src/fs/proc/proc_sysctl.c 2023-05-18 13:26:48.145129743 -0400
@@ -53,6 +53,7 @@ void proc_sys_poll_notify(struct ctl_tab
if (!poll)
return;

+ printk("kpatch-test: testing gcc .isra function name mangling\n");
atomic_inc(&poll->event);
wake_up_interruptible(&poll->wait);
}
13 changes: 13 additions & 0 deletions test/integration/rhel-8.9/gcc-mangled-3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff -Nupr src.orig/mm/slub.c src/mm/slub.c
--- src.orig/mm/slub.c 2023-05-18 13:26:13.476170595 -0400
+++ src/mm/slub.c 2023-05-18 13:26:51.355125960 -0400
@@ -6085,6 +6085,9 @@ void get_slabinfo(struct kmem_cache *s,
int node;
struct kmem_cache_node *n;

+ if (!jiffies)
+ printk("slabinfo\n");
+
for_each_kmem_cache_node(s, node, n) {
nr_slabs += node_nr_slabs(n);
nr_objs += node_nr_objs(n);
13 changes: 13 additions & 0 deletions test/integration/rhel-8.9/gcc-static-local-var-2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff -Nupr src.orig/mm/mmap.c src/mm/mmap.c
--- src.orig/mm/mmap.c 2023-05-18 13:26:13.475170596 -0400
+++ src/mm/mmap.c 2023-05-18 13:26:54.612122123 -0400
@@ -1691,6 +1691,9 @@ unsigned long mmap_region(struct file *f
struct rb_node **rb_link, *rb_parent;
unsigned long charged = 0;

+ if (!jiffies)
+ printk("kpatch mmap foo\n");
+
/* Check against address space limit. */
if (!may_expand_vm(mm, vm_flags, len >> PAGE_SHIFT)) {
unsigned long nr_pages;
19 changes: 19 additions & 0 deletions test/integration/rhel-8.9/gcc-static-local-var-3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff -Nupr src.orig/kernel/reboot.c src/kernel/reboot.c
--- src.orig/kernel/reboot.c 2023-05-18 13:26:13.457170617 -0400
+++ src/kernel/reboot.c 2023-05-18 13:26:57.125119162 -0400
@@ -393,8 +393,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
return ret;
}

+void kpatch_bar(void)
+{
+ if (!jiffies)
+ printk("kpatch_foo\n");
+}
+
static void deferred_cad(struct work_struct *dummy)
{
+ kpatch_bar();
kernel_restart(NULL);
}

23 changes: 23 additions & 0 deletions test/integration/rhel-8.9/gcc-static-local-var-4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff -Nupr src.orig/fs/aio.c src/fs/aio.c
--- src.orig/fs/aio.c 2023-05-18 13:26:13.270170838 -0400
+++ src/fs/aio.c 2023-05-18 13:26:59.650116186 -0400
@@ -247,11 +247,18 @@ static int __init aio_setup(void)
}
__initcall(aio_setup);

-static void put_aio_ring_file(struct kioctx *ctx)
+void kpatch_aio_foo(void)
+{
+ if (!jiffies)
+ printk("kpatch aio foo\n");
+}
+
+__always_inline static void put_aio_ring_file(struct kioctx *ctx)
{
struct file *aio_ring_file = ctx->aio_ring_file;
struct address_space *i_mapping;

+ kpatch_aio_foo();
if (aio_ring_file) {
truncate_setsize(file_inode(aio_ring_file), 0);

8 changes: 8 additions & 0 deletions test/integration/rhel-8.9/gcc-static-local-var-4.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -o pipefail
if ! $(eu-readelf --wide --symbols test-gcc-static-local-var-4.ko | awk '$NF == "free_ioctx" { exit 1 }'); then
exit 1
else
exit 0
fi
45 changes: 45 additions & 0 deletions test/integration/rhel-8.9/gcc-static-local-var-5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff -Nupr src.orig/kernel/audit.c src/kernel/audit.c
--- src.orig/kernel/audit.c 2023-05-18 13:26:13.449170627 -0400
+++ src/kernel/audit.c 2023-05-18 13:27:02.109113288 -0400
@@ -327,6 +327,12 @@ void audit_panic(const char *message)
}
}

+void kpatch_audit_foo(void)
+{
+ if (!jiffies)
+ printk("kpatch audit foo\n");
+}
+
static inline int audit_rate_check(void)
{
static unsigned long last_check = 0;
@@ -337,6 +343,7 @@ static inline int audit_rate_check(void)
unsigned long elapsed;
int retval = 0;

+ kpatch_audit_foo();
if (!audit_rate_limit) return 1;

spin_lock_irqsave(&lock, flags);
@@ -356,6 +363,11 @@ static inline int audit_rate_check(void)
return retval;
}

+noinline void kpatch_audit_check(void)
+{
+ audit_rate_check();
+}
+
/**
* audit_log_lost - conditionally log lost audit message event
* @message: the message stating reason for lost audit message
@@ -402,6 +414,8 @@ static int audit_log_config_change(char
struct audit_buffer *ab;
int rc = 0;

+ kpatch_audit_check();
+
ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_CONFIG_CHANGE);
if (unlikely(!ab))
return rc;
22 changes: 22 additions & 0 deletions test/integration/rhel-8.9/gcc-static-local-var-6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff -Nupr src.orig/net/ipv6/netfilter.c src/net/ipv6/netfilter.c
--- src.orig/net/ipv6/netfilter.c 2023-05-18 13:26:13.496170571 -0400
+++ src/net/ipv6/netfilter.c 2023-05-18 13:27:04.595110359 -0400
@@ -93,6 +93,8 @@ static int nf_ip6_reroute(struct sk_buff
return 0;
}

+#include "kpatch-macros.h"
+
int __nf_ip6_route(struct net *net, struct dst_entry **dst,
struct flowi *fl, bool strict)
{
@@ -106,6 +108,9 @@ int __nf_ip6_route(struct net *net, stru
struct dst_entry *result;
int err;

+ if (!jiffies)
+ printk("kpatch nf_ip6_route foo\n");
+
result = ip6_route_output(net, sk, &fl->u.ip6);
err = result->error;
if (err)
Loading