From 6fee5681ca4fbec6ab7c31133e1889bef79bd251 Mon Sep 17 00:00:00 2001 From: Kaiwan N Billimoria Date: Thu, 23 Nov 2023 12:20:50 +0530 Subject: [PATCH] Edit ch13 qs1 --- questions/ch13_qs_assignments.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/questions/ch13_qs_assignments.txt b/questions/ch13_qs_assignments.txt index 478c8fc..db32216 100644 --- a/questions/ch13_qs_assignments.txt +++ b/questions/ch13_qs_assignments.txt @@ -1,22 +1,21 @@ As we conclude, here is a list of questions for you to test your knowledge regarding this chapter's material. You will find answers to selected questions here: -https://github.com/PacktPublishing/Linux-Kernel-Programming/tree/master/solutions_to_assgn +https://github.com/PacktPublishing/Linux-Kernel-Programming_2E/tree/main/solutions_to_assgn Chapter 13 : Questions and/or Assignments 1. miscdrv_rdwr_refcount Modify our earlier ch12/2_miscdrv_rdwr_spinlock/miscdrv_rdwr_spinlock.c -driver code. It has the integers ga and gb, which, when being read or -written, are protected via a spinlock. -Now, make them refcount_t variables and use the appropriate refcount_t APIs -when working on them. Test by deliberately making a refcount variable go out -of the allowed range, [0..INT_MAX]. +driver code; it has the integers ga and gb , which, when being read or +written were protected via a spinlock. Now make them refcount variables +(initializing them to some value, say, 42) and use the appropriate +refcount_t methods when working on them. +Include a test case where you deliberately make them go outside the valid +allowed range ([1..INT_MAX-1]). 2. If you haven't already, configure and build a "debug" kernel (ensure you have the Lock Debugging config options enabled, as we explained in -the 'Configuring a debug kernel for lock debugging' section of this chapter.) - +the 'Configuring a debug kernel for lock debugging' section of this chapter). Now, boot from it and try out a buggy kernel module (that has locking/deadlock bugs); lockdep should catch and report this. -