lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 31 Oct 2020 15:14:41 +0200
From:   Jari Ruusu <jariruusu@...rs.sourceforge.net>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: Linux 4.19.154

Greg Kroah-Hartman wrote:
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -2127,11 +2127,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

Above change "block: ratelimit handle_bad_sector() message"
upstream commit f4ac712e4fe009635344b9af5d890fe25fcc8c0d
in 4.19.154 kernel is not completely OK.

Removing casts from arguments 4 and 5 produces these compile warnings:



In file included from ./include/linux/kernel.h:14:0,
                 from block/blk-core.c:14:
block/blk-core.c: In function 'handle_bad_sector':
./include/linux/kern_levels.h:5:18: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'sector_t {aka long unsigned int}' [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/printk.h:424:10: note: in definition of macro 'printk_ratelimited'
   printk(fmt, ##__VA_ARGS__);    \
          ^~~
./include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
 #define KERN_INFO KERN_SOH "6" /* informational */
                   ^~~~~~~~
./include/linux/printk.h:444:21: note: in expansion of macro 'KERN_INFO'
  printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~~~~
block/blk-core.c:2130:2: note: in expansion of macro 'pr_info_ratelimited'
  pr_info_ratelimited("attempt to access beyond end of device\n"
  ^~~~~~~~~~~~~~~~~~~
./include/linux/kern_levels.h:5:18: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type 'sector_t {aka long unsigned int}' [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/printk.h:424:10: note: in definition of macro 'printk_ratelimited'
   printk(fmt, ##__VA_ARGS__);    \
          ^~~
./include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
 #define KERN_INFO KERN_SOH "6" /* informational */
                   ^~~~~~~~
./include/linux/printk.h:444:21: note: in expansion of macro 'KERN_INFO'
  printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~~~~
block/blk-core.c:2130:2: note: in expansion of macro 'pr_info_ratelimited'
  pr_info_ratelimited("attempt to access beyond end of device\n"
  ^~~~~~~~~~~~~~~~~~~



For 64 bit systems it is only compile time cosmetic warning. For 32 bit
system + CONFIG_LBDAF=n it introduces bugs: output formats are "%llu" and
passed parameters are 32 bits. That is not OK.

Upstream kernels have hardcoded 64 bit sector_t. In older stable trees
sector_t can be either 64 or 32 bit. In other words, backport of above patch
needs to keep those original casts.

-- 
Jari Ruusu  4096R/8132F189 12D6 4C3A DCDA 0AA4 27BD  ACDF F073 3C80 8132 F189

Powered by blists - more mailing lists