Suren Baghdasaryan e269b5d291 alloc_tag: fix module allocation tags populated area calculation
vm_module_tags_populate() calculation of the populated area assumes that
area starts at a page boundary and therefore when new pages are allocation,
the end of the area is page-aligned as well. If the start of the area is
not page-aligned then allocating a page and incrementing the end of the
area by PAGE_SIZE leads to an area at the end but within the area boundary
which is not populated. Accessing this are will lead to a kernel panic.
Fix the calculation by down-aligning the start of the area and using that
as the location allocated pages are mapped to.

[gehao@kylinos.cn: fix vm_module_tags_populate's KASAN poisoning logic]
  Link: https://lkml.kernel.org/r/20241205170528.81000-1-hao.ge@linux.dev
[gehao@kylinos.cn: fix panic when CONFIG_KASAN enabled and CONFIG_KASAN_VMALLOC not enabled]
  Link: https://lkml.kernel.org/r/20241212072126.134572-1-hao.ge@linux.dev
Link: https://lkml.kernel.org/r/20241130001423.1114965-1-surenb@google.com
Fixes: 0f9b685626da ("alloc_tag: populate memory for module tags as needed")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202411132111.6a221562-lkp@intel.com
Acked-by: Yu Zhao <yuzhao@google.com>
Tested-by: Adrian Huang <ahuang12@lenovo.com> 
Cc: David Wang <00107082@163.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Sourav Panda <souravpanda@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-12-18 19:04:46 -08:00
..
2024-07-12 16:39:53 -07:00
2024-02-01 13:06:40 +01:00
2018-08-16 12:14:42 -07:00
2023-11-03 07:08:36 -10:00
2021-01-21 14:06:00 -07:00
2022-03-07 12:48:35 -07:00
2021-08-19 09:02:55 +09:00
2023-02-02 22:50:01 -08:00
2023-02-02 22:50:01 -08:00
2024-07-30 09:30:11 -10:00
2021-01-03 20:05:18 -05:00
2024-05-21 15:29:01 -07:00
2022-03-07 12:48:35 -07:00
2022-10-03 14:03:21 -07:00
2024-11-18 16:50:08 -08:00
2021-08-19 09:02:55 +09:00
2024-04-25 21:07:05 -07:00
2024-05-22 11:53:02 -07:00
2023-08-21 13:46:25 -07:00
2023-04-17 18:01:23 +02:00
2023-10-16 12:44:06 -04:00
2024-10-14 16:33:24 -05:00
2023-10-16 12:44:06 -04:00
2024-11-27 10:20:50 -08:00
2018-10-16 13:45:44 +02:00
2022-10-03 17:34:32 -07:00
2024-07-04 23:43:10 -07:00
2021-07-08 11:48:20 -07:00
2024-02-15 12:17:28 -05:00
2021-06-18 11:43:09 +02:00
2024-06-10 11:14:52 +01:00
2024-11-30 22:41:35 -05:00