diff options
| author | Benjamin Marzinski <bmarzins@redhat.com> | 2026-07-02 15:43:07 -0400 |
|---|---|---|
| committer | Yury Norov <ynorov@nvidia.com> | 2026-07-03 12:45:40 -0400 |
| commit | 40d3c88df9d82d32eb52600a06a629520a7900fc (patch) | |
| tree | 8ae16eb71ea38036c17de1844d5b9741aad765fb /scripts | |
| parent | 608720f0e31e2971919f61679c6993e243fd2d1a (diff) | |
| download | linux-next-40d3c88df9d82d32eb52600a06a629520a7900fc.tar.gz linux-next-40d3c88df9d82d32eb52600a06a629520a7900fc.zip | |
bitops: make the *_bit_le functions use unsigned long
The *_bit_le functions use a signed integer for the bit number.
However, the *_bit functions can use an unsigned long. This causes
problems if there is a large bitmap and a bit number > 0x80000000 is
passed in. Since that is a negative int, it will get sign extended to a
long when getting passed to the *_bit function, turning it into a huge
bit number. This usually ends up with the memory address wrapping around
and the function accessing memory before the start of the bitmap.
Avoid this by making the *_bit_le functions take an unsigned int.
This can be triggered by faking a huge dm-mirror device, which uses
bitmaps to track the mirror regions:
This will access memory before the start of the sync_bits bitmap, and
likely hit the guard page of the previously allocated clean_bits bitmap.
I looked and didn't see any crazy code using the signed int to
intentionally try and access bits before some address within the bitmap.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
