linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: ratelimit handle_bad_sector() message
@ 2020-10-08  0:23 Tetsuo Handa
  2020-10-08  6:40 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Tetsuo Handa @ 2020-10-08  0:23 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Tetsuo Handa

syzbot is reporting unkillable task [1], for the caller is failing to
handle a corrupted filesystem image which attempts to access beyond
the end of the device. While we need to fix the caller, flooding the
console with handle_bad_sector() message is unlikely useful.

[1] https://syzkaller.appspot.com/bug?id=f1f49fb971d7a3e01bd8ab8cff2ff4572ccf3092

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 10c08ac50697..8b67b6e941db 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -803,8 +803,8 @@ static void handle_bad_sector(struct bio *bio, sector_t maxsector)
 {
 	char b[BDEVNAME_SIZE];
 
-	printk(KERN_INFO "attempt to access beyond end of device\n");
-	printk(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
+	printk_ratelimited(KERN_INFO "attempt to access beyond end of device\n");
+	printk_ratelimited(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
 			bio_devname(bio, b), bio->bi_opf,
 			(unsigned long long)bio_end_sector(bio),
 			(long long)maxsector);
-- 
2.18.4


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

* Re: [PATCH] block: ratelimit handle_bad_sector() message
  2020-10-08  0:23 [PATCH] block: ratelimit handle_bad_sector() message Tetsuo Handa
@ 2020-10-08  6:40 ` Christoph Hellwig
  2020-10-08 13:37   ` [PATCH v2] " Tetsuo Handa
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2020-10-08  6:40 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: Jens Axboe, linux-block

On Thu, Oct 08, 2020 at 09:23:44AM +0900, Tetsuo Handa wrote:
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -803,8 +803,8 @@ static void handle_bad_sector(struct bio *bio, sector_t maxsector)
>  {
>  	char b[BDEVNAME_SIZE];
>  
> -	printk(KERN_INFO "attempt to access beyond end of device\n");
> -	printk(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
> +	printk_ratelimited(KERN_INFO "attempt to access beyond end of device\n");
> +	printk_ratelimited(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
>  			bio_devname(bio, b), bio->bi_opf,
>  			(unsigned long long)bio_end_sector(bio),
>  			(long long)maxsector);

Please use pr_info_ratelimited, and also remove the casts now that
sector_t is guranteed to be an unsigned long long.

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

* [PATCH v2] block: ratelimit handle_bad_sector() message
  2020-10-08  6:40 ` Christoph Hellwig
@ 2020-10-08 13:37   ` Tetsuo Handa
  2020-10-08 13:52     ` Christoph Hellwig
  2020-10-08 16:17     ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Tetsuo Handa @ 2020-10-08 13:37 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, Tetsuo Handa

syzbot is reporting unkillable task [1], for the caller is failing to
handle a corrupted filesystem image which attempts to access beyond
the end of the device. While we need to fix the caller, flooding the
console with handle_bad_sector() message is unlikely useful.

[1] https://syzkaller.appspot.com/bug?id=f1f49fb971d7a3e01bd8ab8cff2ff4572ccf3092

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 block/blk-core.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 10c08ac50697..0014e7caae3d 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -803,11 +803,10 @@ static void handle_bad_sector(struct bio *bio, sector_t maxsector)
 {
 	char b[BDEVNAME_SIZE];
 
-	printk(KERN_INFO "attempt to access beyond end of device\n");
-	printk(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
-			bio_devname(bio, b), bio->bi_opf,
-			(unsigned long long)bio_end_sector(bio),
-			(long long)maxsector);
+	pr_info_ratelimited("attempt to access beyond end of device\n"
+			    "%s: rw=%d, want=%llu, limit=%llu\n",
+			    bio_devname(bio, b), bio->bi_opf,
+			    bio_end_sector(bio), maxsector);
 }
 
 #ifdef CONFIG_FAIL_MAKE_REQUEST
-- 
2.18.4


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

* Re: [PATCH v2] block: ratelimit handle_bad_sector() message
  2020-10-08 13:37   ` [PATCH v2] " Tetsuo Handa
@ 2020-10-08 13:52     ` Christoph Hellwig
  2020-10-08 16:17     ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-10-08 13:52 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: Jens Axboe, linux-block, Christoph Hellwig

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v2] block: ratelimit handle_bad_sector() message
  2020-10-08 13:37   ` [PATCH v2] " Tetsuo Handa
  2020-10-08 13:52     ` Christoph Hellwig
@ 2020-10-08 16:17     ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2020-10-08 16:17 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: linux-block, Christoph Hellwig

On 10/8/20 7:37 AM, Tetsuo Handa wrote:
> syzbot is reporting unkillable task [1], for the caller is failing to
> handle a corrupted filesystem image which attempts to access beyond
> the end of the device. While we need to fix the caller, flooding the
> console with handle_bad_sector() message is unlikely useful.

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2020-10-08 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08  0:23 [PATCH] block: ratelimit handle_bad_sector() message Tetsuo Handa
2020-10-08  6:40 ` Christoph Hellwig
2020-10-08 13:37   ` [PATCH v2] " Tetsuo Handa
2020-10-08 13:52     ` Christoph Hellwig
2020-10-08 16:17     ` Jens Axboe

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).