Bug 3293 - kernel crashed when 1 arm kpatch triggered
Summary: kernel crashed when 1 arm kpatch triggered
Status: RESOLVED FIXED
Alias: None
Product: ANCK 4.19 Dev
Classification: ANCK
Component: ARM (show other bugs) ARM
Version: 4.19-026.x
Hardware: All Linux
: P3-Medium S1-blocker
Target Milestone: ---
Assignee: binbinyin
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-30 14:09 UTC by wangchuanguo_lc
Modified: 2022-12-02 08:57 UTC (History)
2 users (show)

See Also:


Attachments
kernel crash stack info (94.66 KB, image/png)
2022-11-30 14:09 UTC, wangchuanguo_lc
Details
vmcore-dmesg (44.16 KB, text/plain)
2022-12-01 15:45 UTC, wangchuanguo_lc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wangchuanguo_lc inspur_group 2022-11-30 14:09:35 UTC
Created attachment 498 [details]
kernel crash stack info

I make 1 kpatch at drop_caches_sysctl_handler() that changes drop_caches string to DROP_CACHES.
Loaded successfully,but kernel crash when I do 'echo 3 > >/proc/sys/vm/drop_caches '

and the stack just like below:


why?
Comment 1 wangchuanguo_lc inspur_group 2022-11-30 15:12:46 UTC
echo 3 > /proc/sys/vm/drop_caches
and the patch diff:

From 39f418471abaa0d70375581ef8f5acf8a588f185 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Tue, 29 Nov 2022 21:31:04 -0500
Subject: [PATCH] drop_caches: Change lowercase to uppercase

Signed-off-by: root <root@localhost.localdomain>
---
 fs/drop_caches.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index dc1a1d5d8..4a2025a99 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -46,7 +46,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)
 	iput(toput_inode);
 }
 
-int drop_caches_sysctl_handler(struct ctl_table *table, int write,
+__always_inline int drop_caches_sysctl_handler(struct ctl_table *table, int write,
 	void __user *buffer, size_t *length, loff_t *ppos)
 {
 	int ret;
@@ -66,7 +66,7 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write,
 			count_vm_event(DROP_SLAB);
 		}
 		if (!stfu) {
-			pr_info("%s (%d): drop_caches: %d\n",
+			pr_info("%s (%d): DROP_CACHES: %d\n",
 				current->comm, task_pid_nr(current),
 				sysctl_drop_caches);
 		}
-- 
2.31.1
Comment 2 binbinyin alibaba_cloud_group 2022-12-01 09:57:06 UTC
hi wangchuanguo
帮忙上传更vmcore-dmesg文件
Comment 3 wangchuanguo_lc inspur_group 2022-12-01 15:45:59 UTC
Created attachment 503 [details]
vmcore-dmesg
Comment 4 wangchuanguo_lc inspur_group 2022-12-02 08:57:24 UTC
My kernel crash problem was circumvent by removing the __always_inline flag. Please check why adding the __always_inline flag causes the kernel to crash.
Thanks!