Skip to contentSkip to conversation

lkdtm: move SCSI_DISPATCH_CMD to scsi_queue_rq

PATCH In review Kevin Mitchell 2 participants 2 messages Aug 6, 2021 – Aug 7, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lkdtm: move SCSI_DISPATCH_CMD to scsi_queue_rq

When scsi_dispatch_cmd was moved to scsi_lib.c and made static, some compilers (i.e., at least gcc 8.4.0) decided to compile this inline. This is a problem for lkdtm.ko, which needs to insert a kprobe on this function for the SCSI_DISPATCH_CMD crashpoint.

Move this crashpoint one function up the call chain to scsi_queue_rq. Though this is also a static function, it should never be inlined because it is assigned as a structure entry. Therefore, kprobe_register should always be able to find it. Since there is already precedent for crashpoint names not exactly matching their probed functions, keep the name of the crashpoint the same for backwards compatibility.

Fixes 82042a2cdb55 ("scsi: move scsi_dispatch_cmd to scsi_lib.c")
---
 drivers/misc/lkdtm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/lkdtm/core.c +1 -1
index 97803f213..2612f214d 100644
@@ -81,7 +81,7 @@ static struct crashpoint crashpoints[] = {
 	CRASHPOINT("FS_DEVRW",		 "ll_rw_block"),
 	CRASHPOINT("MEM_SWAPOUT",	 "shrink_inactive_list"),
 	CRASHPOINT("TIMERADD",		 "hrtimer_start"),
-	CRASHPOINT("SCSI_DISPATCH_CMD",	 "scsi_dispatch_cmd"),
+	CRASHPOINT("SCSI_DISPATCH_CMD",	 "scsi_queue_rq"),
 	CRASHPOINT("IDE_CORE_CP",	 "generic_ide_ioctl"),
 #endif
 };
Signature · 1 line
2.32.0
#1 lore raw
Quoted 24 lines · Kevin Mitchell

When scsi_dispatch_cmd was moved to scsi_lib.c and made static, some compilers (i.e., at least gcc 8.4.0) decided to compile this inline. This is a problem for lkdtm.ko, which needs to insert a kprobe on this function for the SCSI_DISPATCH_CMD crashpoint.

Move this crashpoint one function up the call chain to scsi_queue_rq. Though this is also a static function, it should never be inlined because it is assigned as a structure entry. Therefore, kprobe_register should always be able to find it. Since there is already precedent for crashpoint names not exactly matching their probed functions, keep the name of the crashpoint the same for backwards compatibility.

Fixes 82042a2cdb55 ("scsi: move scsi_dispatch_cmd to scsi_lib.c")
---
 drivers/misc/lkdtm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/lkdtm/core.c +0 -0
index 97803f213..2612f214d 100644

drivers/misc/lkdtm/core.c static struct crashpoint crashpoints[] = { · line 87

Quoted 8 lines
drivers/misc/lkdtm/core.c +1 -1
@@ -81,7 +81,7 @@ static struct crashpoint crashpoints[] = {
 	CRASHPOINT("FS_DEVRW",		 "ll_rw_block"),
 	CRASHPOINT("MEM_SWAPOUT",	 "shrink_inactive_list"),
 	CRASHPOINT("TIMERADD",		 "hrtimer_start"),
-	CRASHPOINT("SCSI_DISPATCH_CMD",	 "scsi_dispatch_cmd"),
+	CRASHPOINT("SCSI_DISPATCH_CMD",	 "scsi_queue_rq"),
 	CRASHPOINT("IDE_CORE_CP",	 "generic_ide_ioctl"),
 #endif
 };

Please send SCSI patches to the linux-scsi mailing list. See also the MAINTAINERS file.

Thanks,

Bart.