Skip to content

Conversation

@mihails-strasuns
Copy link

Based on https://github.com/joe-lawrence/kpatch-unit-test-objs/tree/initial-aarch64

Adds 2 more unit tests on top of that using aarch64 regressions we have previously noticed/fixed internally at Amazon Linux.

joe-lawrence and others added 3 commits June 14, 2024 12:43
Add a snapshot of aarch64objfiles currently available in kpatch repo.

  compiler: gcc-11.2.1-9.1.el9
  kernel:   5.17.0-rc4+ (v13 with dropped STACK_VALIDATION dependency on
                         top of v5.17-rc4)

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Generated from 6.1.52-71.125 using the following patch:

```
diff --git a/kernel/sys.c b/kernel/sys.c
index c85e1abf7b7c..3aa9a596f840 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1296,13 +1296,15 @@ static int override_release(char __user *release, size_t len)
 	return ret;
 }

-SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
+#include "kpatch-syscall.h"
+KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 {
 	struct new_utsname tmp;

 	down_read(&uts_sem);
 	memcpy(&tmp, utsname(), sizeof(tmp));
 	up_read(&uts_sem);
+       strcat(tmp.sysname, ".kpatch");
 	if (copy_to_user(name, &tmp, sizeof(tmp)))
 		return -EFAULT;

 ```

Regression test for the following fix in the aarch64 implementation
branch:

c4ddae0 kpatch-syscall.h: add aarch64 helper

Signed-off-by: Mihails Strasuns <mstrasun@amazon.com>
Generated on version 6.1.52-71.125 using the following patch:

---
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b6c16db86c71..07abdacab1d1 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -506,6 +506,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t
gfp_mask,
         */
        size = SKB_DATA_ALIGN(size);
        size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
+       printk("trigger");
        osize = kmalloc_size_roundup(size);
        data = kmalloc_reserve(osize, gfp_mask, node, &pfmemalloc);
        if (unlikely(!data))
---

Regression test for the following fix in the aarch64 implementation
branch:

46456da create-diff-object: Fix mapping symbol handling on aarch64

Signed-off-by: Mihails Strasuns <mstrasun@amazon.com>
@georgejguo
Copy link

hi, Could you tell me how the unit test produced? I have seen lots of .o object files?

@mihails-strasuns
Copy link
Author

@georgejguo bb3e6f6 is coming from an original aarch64 branch (https://github.com/joe-lawrence/kpatch-unit-test-objs/tree/initial-aarch64). Follow-up tests are generated by creating a kpatch with a given kernel version and patch (commit text describes which were used) and copying intermediate object files from a kpatch build directory.

@joe-lawrence
Copy link
Contributor

@mihails-strasuns : a long over due thanks for your work on this! I've rebased/recreated the unit tests as part of #54 and hopefully made sure that it covers the additional cases you added here.

@mihails-strasuns
Copy link
Author

Glad to hear this is moving forward!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants