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] [day] [month] [year] [list]
Date:   Mon, 7 Nov 2022 09:25:11 +0800
From:   Chao Yu <chao@...nel.org>
To:     "zhiguo.niu" <zhiguo.niu@...soc.com>, jaegeuk@...nel.org,
        linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org
Cc:     niuzhiguo84@...il.com
Subject: Re: [PATCH] f2fs: fix atgc bug on issue in 32bits platform

On 2022/11/4 15:40, zhiguo.niu wrote:
> From: Zhiguo Niu <zhiguo.niu@...soc.com>
> 
> There is bug on issue after atgc feature is enabled in
> 32bits platform as the following log:
> 
> F2FS-fs (dm-x): inconsistent rbtree, cur(3470333575168) next(3320009719808)
> ------------[ cut here ]------------
> kernel BUG at fs/f2fs/gc.c:602!
> Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
> PC is at get_victim_by_default+0x13c0/0x1498
> LR is at f2fs_check_rb_tree_consistence+0xc4/0xd4
> ....
> [<c04d98b0>] (get_victim_by_default) from [<c04d4f44>] (f2fs_gc+0x220/0x6cc)
> [<c04d4f44>] (f2fs_gc) from [<c04d4780>] (gc_thread_func+0x2ac/0x708)
> [<c04d4780>] (gc_thread_func) from [<c015c774>] (kthread+0x1a8/0x1b4)
> [<c015c774>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
> 
> The reason is the 64bits key in struct rb_entry has __packed attibute
> but has not in struct victim_entry, so the wrong key value got by
> in f2fs_check_rb_tree_consistence, the following are the memory layouts
> of struct rb_entry and struct victim_entry in 32bits platform:
> 
> struct rb_entry {
>     [0] struct rb_node rb_node;
>         union {
>             struct {...};
>    [12]     unsigned long long key;
>         };
> }
> struct victim_entry {
>     [0] struct rb_node rb_node;
>         union {
>             struct {...};
>    [16]     struct victim_info vi;
>         };
>    [32] struct list_head list;
> }

Shouldn't we add __packed for struct victim_entry?

> 
> This patch fix this inconsistence layout of 64bits key between
> struct rb_entry and struct victim_entry.
> 

Fixes: 093749e296e2 ("f2fs: support age threshold based garbage collection")

> Signed-off-by: Zhiguo Niu <zhiguo.niu@...soc.com>

Powered by blists - more mailing lists