linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lkdtm: move SCSI_DISPATCH_CMD to scsi_queue_rq
@ 2021-08-06 22:59 Kevin Mitchell
  2021-08-07  3:17 ` Bart Van Assche
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Mitchell @ 2021-08-06 22:59 UTC (permalink / raw)
  Cc: Kevin Mitchell, Kees Cook, Arnd Bergmann, Greg Kroah-Hartman,
	Hannes Reinecke, Bart Van Assche, linux-kernel

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")
Signed-off-by: Kevin Mitchell <kevmitch@arista.com>
---
 drivers/misc/lkdtm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c
index 97803f213..2612f214d 100644
--- a/drivers/misc/lkdtm/core.c
+++ b/drivers/misc/lkdtm/core.c
@@ -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
 };
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] lkdtm: move SCSI_DISPATCH_CMD to scsi_queue_rq
  2021-08-06 22:59 [PATCH] lkdtm: move SCSI_DISPATCH_CMD to scsi_queue_rq Kevin Mitchell
@ 2021-08-07  3:17 ` Bart Van Assche
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2021-08-07  3:17 UTC (permalink / raw)
  To: Kevin Mitchell
  Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, Hannes Reinecke,
	linux-kernel

On 8/6/21 3:59 PM, Kevin Mitchell wrote:
> 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")
> Signed-off-by: Kevin Mitchell <kevmitch@arista.com>
> ---
>  drivers/misc/lkdtm/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c
> index 97803f213..2612f214d 100644
> --- a/drivers/misc/lkdtm/core.c
> +++ b/drivers/misc/lkdtm/core.c
> @@ -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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lkdtm: move SCSI_DISPATCH_CMD to scsi_queue_rq
  2021-08-17  1:57 Kevin Mitchell
@ 2021-08-17  4:26 ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-08-17  4:26 UTC (permalink / raw)
  To: Kevin Mitchell
  Cc: linux-scsi, Christoph Hellwig, James E.J. Bottomley,
	Martin K. Petersen, Kees Cook, Arnd Bergmann, Greg Kroah-Hartman,
	Hannes Reinecke, Bart Van Assche, linux-kernel

On Mon, Aug 16, 2021 at 06:57:18PM -0700, Kevin Mitchell wrote:
> 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")
> Signed-off-by: Kevin Mitchell <kevmitch@arista.com>

This looks ok.  Does any userspace hardcode these names or can we
use a saner name?

Btw, generic_ide_ioctl is gone as well, together with the whole legacy ide
subsystem.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] lkdtm: move SCSI_DISPATCH_CMD to scsi_queue_rq
@ 2021-08-17  1:57 Kevin Mitchell
  2021-08-17  4:26 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Mitchell @ 2021-08-17  1:57 UTC (permalink / raw)
  Cc: linux-scsi, Christoph Hellwig, James E.J. Bottomley,
	Martin K. Petersen, Kevin Mitchell, Kees Cook, Arnd Bergmann,
	Greg Kroah-Hartman, Hannes Reinecke, Bart Van Assche,
	linux-kernel

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")
Signed-off-by: Kevin Mitchell <kevmitch@arista.com>
---
 drivers/misc/lkdtm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c
index 9dda87c6b54a..c3db17e90631 100644
--- a/drivers/misc/lkdtm/core.c
+++ b/drivers/misc/lkdtm/core.c
@@ -82,7 +82,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
 };
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-17  4:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 22:59 [PATCH] lkdtm: move SCSI_DISPATCH_CMD to scsi_queue_rq Kevin Mitchell
2021-08-07  3:17 ` Bart Van Assche
2021-08-17  1:57 Kevin Mitchell
2021-08-17  4:26 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).