Skip to content

Commit

Permalink
Merge pull request #1389 from ryanbsull/integration-tests-rhel-8.10-f…
Browse files Browse the repository at this point in the history
…inal

test/integration/rhel-8.10: add kernel-4.18.0-552.el8_10 tests
  • Loading branch information
joe-lawrence authored Apr 23, 2024
2 parents b363972 + 5603186 commit b448e7d
Show file tree
Hide file tree
Showing 37 changed files with 924 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/integration/rhel-8.10/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 2024-04-18 14:12:03.460375133 -0400
+++ src/fs/proc/proc_sysctl.c 2024-04-18 14:12:03.887374205 -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.10/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.10/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 2024-04-18 14:12:03.460375133 -0400
+++ src/fs/proc/cmdline.c 2024-04-18 14:12:10.803359173 -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.10/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.10/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 2024-04-18 14:12:03.460375133 -0400
+++ src/fs/proc/meminfo.c 2024-04-18 14:12:13.626353038 -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.10/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 2024-04-18 14:12:03.639374744 -0400
+++ src/net/core/dev.c 2024-04-18 14:12:15.656348626 -0400
@@ -5469,6 +5469,7 @@ skip_classify:
case RX_HANDLER_PASS:
break;
default:
+ printk("BUG!\n");
BUG();
}
}
11 changes: 11 additions & 0 deletions test/integration/rhel-8.10/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 2024-04-18 14:12:03.462375128 -0400
+++ src/fs/readdir.c 2024-04-18 14:12:17.665344260 -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.10/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 2024-04-18 14:12:03.614374798 -0400
+++ src/kernel/time/timekeeping.c 2024-04-18 14:12:19.675339891 -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.10/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 2024-04-18 14:12:03.460375133 -0400
+++ src/fs/proc/proc_sysctl.c 2024-04-18 14:12:21.710335469 -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.10/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 2024-04-18 14:12:03.629374765 -0400
+++ src/mm/slub.c 2024-04-18 14:12:23.903330702 -0400
@@ -6192,6 +6192,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.10/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 2024-04-18 14:12:03.628374767 -0400
+++ src/mm/mmap.c 2024-04-18 14:12:25.958326236 -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.10/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 2024-04-18 14:12:03.612374802 -0400
+++ src/kernel/reboot.c 2024-04-18 14:12:27.985321831 -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.10/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 2024-04-18 14:12:03.428375202 -0400
+++ src/fs/aio.c 2024-04-18 14:12:30.010317430 -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.10/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.10/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 2024-04-18 14:12:03.604374820 -0400
+++ src/kernel/audit.c 2024-04-18 14:12:32.055312985 -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.10/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 2024-04-18 14:12:03.648374724 -0400
+++ src/net/ipv6/netfilter.c 2024-04-18 14:12:34.140308454 -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

0 comments on commit b448e7d

Please sign in to comment.