Re: linux-next: Tree for Jan 13 (UBSAN: invalid-load in ../mm/swap.c:996:11)

From: Randy Dunlap
Date: Thu Jan 13 2022 - 16:27:05 EST




On 1/13/22 12:47, Matthew Wilcox wrote:
> On Thu, Jan 13, 2022 at 12:12:52PM -0800, Randy Dunlap wrote:
>> [ 1.561983] UBSAN: invalid-load in ../mm/swap.c:996:11
>> [ 1.561986] load of value 221 is not a valid value for type '_Bool'
>
> Ooh. This one's mine. Randy, does it repeat easily? This should
> fix it:

Yes, 100% of the time (for N = 3).

Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Tested-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>

Fixed 100% of the time (for N = 3).

Thanks.

> diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
> index dda8d5868c81..67b1246f136b 100644
> --- a/include/linux/pagevec.h
> +++ b/include/linux/pagevec.h
> @@ -111,6 +111,7 @@ static_assert(offsetof(struct pagevec, pages) ==
> static inline void folio_batch_init(struct folio_batch *fbatch)
> {
> fbatch->nr = 0;
> + fbatch->percpu_pvec_drained = false;
> }
>
> static inline unsigned int folio_batch_count(struct folio_batch *fbatch)
>


--
~Randy