Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf8ac51

Browse files
committed
Better wording..
1 parent 4c68dfb commit cf8ac51

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

ch13/2_percpu/percpu_var.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ static int __init init_percpu_var(void)
227227
"module param, aborting ...\n", KBUILD_MODNAME);
228228
return ret;
229229
}
230+
// set up the function pointer
230231
schedsa_ptr = (unsigned long (*)(pid_t pid, const struct cpumask *in_mask))func_ptr;
231232

232233
/* Dynamically allocate the percpu structures */

ch13/2_percpu/run

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
# what you do is only limited by your imagination :).
1111
# b) From 5.7 on, the kernel devs unexported the kallsyms_lookup_name()!
1212
# (Rationale: https://lwn.net/Articles/813350/). With it gone, we now
13-
# simply use this approach: a helper script greps the kallsyms_lookup_name()
14-
# address and passes it to the module! There, we equate it to the exepcted
15-
# function signature - that of sched_setaffinity() - and use it.
16-
# *Not* pedantically right, but hey, it works. Don't do this in production.
13+
# simply use this approach: a helper script greps the sched_setaffinity()
14+
# function's address and passes it to the module! There, we equate it to the
15+
# exepected function signature and use it.
16+
# NOTE!
17+
# a) This latter 5.7+ approach is *Not* pedantically right, but hey, it works.
18+
# Don't do this in production.
19+
# b) It works on a typical desktop-type distro... it likely won't on a locked-down
20+
# and properly security-conscious installation.
1721
#
1822
KMOD=percpu_var
1923
KFUNC=sched_setaffinity
@@ -22,7 +26,7 @@ KFUNC_PTR=0x$(sudo grep -w "T ${KFUNC}" /proc/kallsyms |awk '{print $1}')
2226
echo "${name}: lookup of kallsyms_lookup_name() failed, aborting..."
2327
exit 1
2428
}
25-
echo "KFUNC_PTR=${KFUNC_PTR}"
29+
echo "sched_setaffinity(): KFUNC_PTR=${KFUNC_PTR}"
2630

2731
make clean
2832
make

0 commit comments

Comments
 (0)