Commit 946c6b59 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'mm-hotfixes-stable-2023-07-08-10-43' of...

Merge tag 'mm-hotfixes-stable-2023-07-08-10-43' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull hotfixes from Andrew Morton:
 "16 hotfixes. Six are cc:stable and the remainder address post-6.4
  issues"

The merge undoes the disabling of the CONFIG_PER_VMA_LOCK feature, since
it was all hopefully fixed in mainline.

* tag 'mm-hotfixes-stable-2023-07-08-10-43' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  lib: dhry: fix sleeping allocations inside non-preemptable section
  kasan, slub: fix HW_TAGS zeroing with slub_debug
  kasan: fix type cast in memory_is_poisoned_n
  mailmap: add entries for Heiko Stuebner
  mailmap: update manpage link
  bootmem: remove the vmemmap pages from kmemleak in free_bootmem_page
  MAINTAINERS: add linux-next info
  mailmap: add Markus Schneider-Pargmann
  writeback: account the number of pages written back
  mm: call arch_swap_restore() from do_swap_page()
  squashfs: fix cache race with migration
  mm/hugetlb.c: fix a bug within a BUG(): inconsistent pte comparison
  docs: update ocfs2-devel mailing list address
  MAINTAINERS: update ocfs2-devel mailing list address
  mm: disable CONFIG_PER_VMA_LOCK until its fixed
  fork: lock VMAs of the parent process when forking
parents fb49c455 8ba388c0
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
# same person appearing not to be so or badly displayed. Also allows for # same person appearing not to be so or badly displayed. Also allows for
# old email addresses to map to new email addresses. # old email addresses to map to new email addresses.
# #
# For format details, see "MAPPING AUTHORS" in "man git-shortlog". # For format details, see "man gitmailmap" or "MAPPING AUTHORS" in
# "man git-shortlog" on older systems.
# #
# Please keep this list dictionary sorted. # Please keep this list dictionary sorted.
# #
...@@ -177,6 +178,9 @@ Gustavo Padovan <padovan@profusion.mobi> ...@@ -177,6 +178,9 @@ Gustavo Padovan <padovan@profusion.mobi>
Hanjun Guo <guohanjun@huawei.com> <hanjun.guo@linaro.org> Hanjun Guo <guohanjun@huawei.com> <hanjun.guo@linaro.org>
Heiko Carstens <hca@linux.ibm.com> <h.carstens@de.ibm.com> Heiko Carstens <hca@linux.ibm.com> <h.carstens@de.ibm.com>
Heiko Carstens <hca@linux.ibm.com> <heiko.carstens@de.ibm.com> Heiko Carstens <hca@linux.ibm.com> <heiko.carstens@de.ibm.com>
Heiko Stuebner <heiko@sntech.de> <heiko.stuebner@bqreaders.com>
Heiko Stuebner <heiko@sntech.de> <heiko.stuebner@theobroma-systems.com>
Heiko Stuebner <heiko@sntech.de> <heiko.stuebner@vrull.eu>
Henk Vergonet <Henk.Vergonet@gmail.com> Henk Vergonet <Henk.Vergonet@gmail.com>
Henrik Kretzschmar <henne@nachtwindheim.de> Henrik Kretzschmar <henne@nachtwindheim.de>
Henrik Rydberg <rydberg@bitmath.org> Henrik Rydberg <rydberg@bitmath.org>
...@@ -305,6 +309,7 @@ Marek Behún <kabel@kernel.org> <marek.behun@nic.cz> ...@@ -305,6 +309,7 @@ Marek Behún <kabel@kernel.org> <marek.behun@nic.cz>
Marek Behún <kabel@kernel.org> Marek Behun <marek.behun@nic.cz> Marek Behún <kabel@kernel.org> Marek Behun <marek.behun@nic.cz>
Mark Brown <broonie@sirena.org.uk> Mark Brown <broonie@sirena.org.uk>
Mark Starovoytov <mstarovo@pm.me> <mstarovoitov@marvell.com> Mark Starovoytov <mstarovo@pm.me> <mstarovoitov@marvell.com>
Markus Schneider-Pargmann <msp@baylibre.com> <mpa@pengutronix.de>
Mark Yao <markyao0591@gmail.com> <mark.yao@rock-chips.com> Mark Yao <markyao0591@gmail.com> <mark.yao@rock-chips.com>
Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com> Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com>
Martin Kepplinger <martink@posteo.de> <martin.kepplinger@puri.sm> Martin Kepplinger <martink@posteo.de> <martin.kepplinger@puri.sm>
......
What: /sys/o2cb What: /sys/o2cb
Date: Dec 2005 Date: Dec 2005
KernelVersion: 2.6.16 KernelVersion: 2.6.16
Contact: ocfs2-devel@oss.oracle.com Contact: ocfs2-devel@lists.linux.dev
Description: Ocfs2-tools looks at 'interface-revision' for versioning Description: Ocfs2-tools looks at 'interface-revision' for versioning
information. Each logmask/ file controls a set of debug prints information. Each logmask/ file controls a set of debug prints
and can be written into with the strings "allow", "deny", or and can be written into with the strings "allow", "deny", or
"off". Reading the file returns the current state. "off". Reading the file returns the current state.
Was renamed to /sys/fs/u2cb/ Was renamed to /sys/fs/u2cb/
Users: ocfs2-tools. It's sufficient to mail proposed changes to Users: ocfs2-tools. It's sufficient to mail proposed changes to
ocfs2-devel@oss.oracle.com. ocfs2-devel@lists.linux.dev.
What: /sys/o2cb symlink What: /sys/o2cb symlink
Date: May 2011 Date: May 2011
KernelVersion: 3.0 KernelVersion: 3.0
Contact: ocfs2-devel@oss.oracle.com Contact: ocfs2-devel@lists.linux.dev
Description: This is a symlink: /sys/o2cb to /sys/fs/o2cb. The symlink is Description: This is a symlink: /sys/o2cb to /sys/fs/o2cb. The symlink is
removed when new versions of ocfs2-tools which know to look removed when new versions of ocfs2-tools which know to look
in /sys/fs/o2cb are sufficiently prevalent. Don't code new in /sys/fs/o2cb are sufficiently prevalent. Don't code new
software to look here, it should try /sys/fs/o2cb instead. software to look here, it should try /sys/fs/o2cb instead.
Users: ocfs2-tools. It's sufficient to mail proposed changes to Users: ocfs2-tools. It's sufficient to mail proposed changes to
ocfs2-devel@oss.oracle.com. ocfs2-devel@lists.linux.dev.
What: /sys/fs/o2cb/ What: /sys/fs/o2cb/
Date: Dec 2005 Date: Dec 2005
KernelVersion: 2.6.16 KernelVersion: 2.6.16
Contact: ocfs2-devel@oss.oracle.com Contact: ocfs2-devel@lists.linux.dev
Description: Ocfs2-tools looks at 'interface-revision' for versioning Description: Ocfs2-tools looks at 'interface-revision' for versioning
information. Each logmask/ file controls a set of debug prints information. Each logmask/ file controls a set of debug prints
and can be written into with the strings "allow", "deny", or and can be written into with the strings "allow", "deny", or
"off". Reading the file returns the current state. "off". Reading the file returns the current state.
Users: ocfs2-tools. It's sufficient to mail proposed changes to Users: ocfs2-tools. It's sufficient to mail proposed changes to
ocfs2-devel@oss.oracle.com. ocfs2-devel@lists.linux.dev.
What: /sys/fs/ocfs2/ What: /sys/fs/ocfs2/
Date: April 2008 Date: April 2008
Contact: ocfs2-devel@oss.oracle.com Contact: ocfs2-devel@lists.linux.dev
Description: Description:
The /sys/fs/ocfs2 directory contains knobs used by the The /sys/fs/ocfs2 directory contains knobs used by the
ocfs2-tools to interact with the filesystem. ocfs2-tools to interact with the filesystem.
What: /sys/fs/ocfs2/max_locking_protocol What: /sys/fs/ocfs2/max_locking_protocol
Date: April 2008 Date: April 2008
Contact: ocfs2-devel@oss.oracle.com Contact: ocfs2-devel@lists.linux.dev
Description: Description:
The /sys/fs/ocfs2/max_locking_protocol file displays version The /sys/fs/ocfs2/max_locking_protocol file displays version
of ocfs2 locking supported by the filesystem. This version of ocfs2 locking supported by the filesystem. This version
...@@ -28,7 +28,7 @@ Description: ...@@ -28,7 +28,7 @@ Description:
What: /sys/fs/ocfs2/loaded_cluster_plugins What: /sys/fs/ocfs2/loaded_cluster_plugins
Date: April 2008 Date: April 2008
Contact: ocfs2-devel@oss.oracle.com Contact: ocfs2-devel@lists.linux.dev
Description: Description:
The /sys/fs/ocfs2/loaded_cluster_plugins file describes The /sys/fs/ocfs2/loaded_cluster_plugins file describes
the available plugins to support ocfs2 cluster operation. the available plugins to support ocfs2 cluster operation.
...@@ -48,7 +48,7 @@ Description: ...@@ -48,7 +48,7 @@ Description:
What: /sys/fs/ocfs2/active_cluster_plugin What: /sys/fs/ocfs2/active_cluster_plugin
Date: April 2008 Date: April 2008
Contact: ocfs2-devel@oss.oracle.com Contact: ocfs2-devel@lists.linux.dev
Description: Description:
The /sys/fs/ocfs2/active_cluster_plugin displays which The /sys/fs/ocfs2/active_cluster_plugin displays which
cluster plugin is currently in use by the filesystem. cluster plugin is currently in use by the filesystem.
...@@ -65,7 +65,7 @@ Description: ...@@ -65,7 +65,7 @@ Description:
What: /sys/fs/ocfs2/cluster_stack What: /sys/fs/ocfs2/cluster_stack
Date: April 2008 Date: April 2008
Contact: ocfs2-devel@oss.oracle.com Contact: ocfs2-devel@lists.linux.dev
Description: Description:
The /sys/fs/ocfs2/cluster_stack file contains the name The /sys/fs/ocfs2/cluster_stack file contains the name
of current ocfs2 cluster stack. This value is set by of current ocfs2 cluster stack. This value is set by
...@@ -86,4 +86,4 @@ Description: ...@@ -86,4 +86,4 @@ Description:
stack return an error. stack return an error.
Users: Users:
ocfs2-tools <ocfs2-tools-devel@oss.oracle.com> ocfs2-tools <ocfs2-tools-devel@lists.linux.dev>
...@@ -12,7 +12,7 @@ dlmfs is built with OCFS2 as it requires most of its infrastructure. ...@@ -12,7 +12,7 @@ dlmfs is built with OCFS2 as it requires most of its infrastructure.
:Project web page: http://ocfs2.wiki.kernel.org :Project web page: http://ocfs2.wiki.kernel.org
:Tools web page: https://github.com/markfasheh/ocfs2-tools :Tools web page: https://github.com/markfasheh/ocfs2-tools
:OCFS2 mailing lists: https://oss.oracle.com/projects/ocfs2/mailman/ :OCFS2 mailing lists: https://subspace.kernel.org/lists.linux.dev.html
All code copyright 2005 Oracle except when otherwise noted. All code copyright 2005 Oracle except when otherwise noted.
......
...@@ -14,7 +14,7 @@ get "mount.ocfs2" and "ocfs2_hb_ctl". ...@@ -14,7 +14,7 @@ get "mount.ocfs2" and "ocfs2_hb_ctl".
Project web page: http://ocfs2.wiki.kernel.org Project web page: http://ocfs2.wiki.kernel.org
Tools git tree: https://github.com/markfasheh/ocfs2-tools Tools git tree: https://github.com/markfasheh/ocfs2-tools
OCFS2 mailing lists: https://oss.oracle.com/projects/ocfs2/mailman/ OCFS2 mailing lists: https://subspace.kernel.org/lists.linux.dev.html
All code copyright 2005 Oracle except when otherwise noted. All code copyright 2005 Oracle except when otherwise noted.
......
...@@ -12069,6 +12069,13 @@ F: Documentation/litmus-tests/ ...@@ -12069,6 +12069,13 @@ F: Documentation/litmus-tests/
F: Documentation/memory-barriers.txt F: Documentation/memory-barriers.txt
F: tools/memory-model/ F: tools/memory-model/
LINUX-NEXT TREE
M: Stephen Rothwell <sfr@canb.auug.org.au>
L: linux-next@vger.kernel.org
S: Supported
B: mailto:linux-next@vger.kernel.org and the appropriate development tree
T: git git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/
LIS3LV02D ACCELEROMETER DRIVER LIS3LV02D ACCELEROMETER DRIVER
M: Eric Piel <eric.piel@tremplin-utc.net> M: Eric Piel <eric.piel@tremplin-utc.net>
S: Maintained S: Maintained
...@@ -15894,7 +15901,7 @@ ORACLE CLUSTER FILESYSTEM 2 (OCFS2) ...@@ -15894,7 +15901,7 @@ ORACLE CLUSTER FILESYSTEM 2 (OCFS2)
M: Mark Fasheh <mark@fasheh.com> M: Mark Fasheh <mark@fasheh.com>
M: Joel Becker <jlbec@evilplan.org> M: Joel Becker <jlbec@evilplan.org>
M: Joseph Qi <joseph.qi@linux.alibaba.com> M: Joseph Qi <joseph.qi@linux.alibaba.com>
L: ocfs2-devel@oss.oracle.com (moderated for non-subscribers) L: ocfs2-devel@lists.linux.dev
S: Supported S: Supported
W: http://ocfs2.wiki.kernel.org W: http://ocfs2.wiki.kernel.org
F: Documentation/filesystems/dlmfs.rst F: Documentation/filesystems/dlmfs.rst
......
...@@ -17,9 +17,9 @@ config OCFS2_FS ...@@ -17,9 +17,9 @@ config OCFS2_FS
You'll want to install the ocfs2-tools package in order to at least You'll want to install the ocfs2-tools package in order to at least
get "mount.ocfs2". get "mount.ocfs2".
Project web page: https://oss.oracle.com/projects/ocfs2 Project web page: https://ocfs2.wiki.kernel.org/
Tools web page: https://oss.oracle.com/projects/ocfs2-tools Tools web page: https://github.com/markfasheh/ocfs2-tools
OCFS2 mailing lists: https://oss.oracle.com/projects/ocfs2/mailman/ OCFS2 mailing lists: https://subspace.kernel.org/lists.linux.dev.html
For more information on OCFS2, see the file For more information on OCFS2, see the file
<file:Documentation/filesystems/ocfs2.rst>. <file:Documentation/filesystems/ocfs2.rst>.
......
...@@ -166,6 +166,26 @@ static int squashfs_bio_read_cached(struct bio *fullbio, ...@@ -166,6 +166,26 @@ static int squashfs_bio_read_cached(struct bio *fullbio,
return 0; return 0;
} }
static struct page *squashfs_get_cache_page(struct address_space *mapping,
pgoff_t index)
{
struct page *page;
if (!mapping)
return NULL;
page = find_get_page(mapping, index);
if (!page)
return NULL;
if (!PageUptodate(page)) {
put_page(page);
return NULL;
}
return page;
}
static int squashfs_bio_read(struct super_block *sb, u64 index, int length, static int squashfs_bio_read(struct super_block *sb, u64 index, int length,
struct bio **biop, int *block_offset) struct bio **biop, int *block_offset)
{ {
...@@ -190,11 +210,10 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length, ...@@ -190,11 +210,10 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length,
for (i = 0; i < page_count; ++i) { for (i = 0; i < page_count; ++i) {
unsigned int len = unsigned int len =
min_t(unsigned int, PAGE_SIZE - offset, total_len); min_t(unsigned int, PAGE_SIZE - offset, total_len);
struct page *page = NULL; pgoff_t index = (read_start >> PAGE_SHIFT) + i;
struct page *page;
if (cache_mapping) page = squashfs_get_cache_page(cache_mapping, index);
page = find_get_page(cache_mapping,
(read_start >> PAGE_SHIFT) + i);
if (!page) if (!page)
page = alloc_page(GFP_NOIO); page = alloc_page(GFP_NOIO);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#define __LINUX_BOOTMEM_INFO_H #define __LINUX_BOOTMEM_INFO_H
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/kmemleak.h>
/* /*
* Types for free bootmem stored in page->lru.next. These have to be in * Types for free bootmem stored in page->lru.next. These have to be in
...@@ -59,6 +60,7 @@ static inline void get_page_bootmem(unsigned long info, struct page *page, ...@@ -59,6 +60,7 @@ static inline void get_page_bootmem(unsigned long info, struct page *page,
static inline void free_bootmem_page(struct page *page) static inline void free_bootmem_page(struct page *page)
{ {
kmemleak_free_part(page_to_virt(page), PAGE_SIZE);
free_reserved_page(page); free_reserved_page(page);
} }
#endif #endif
......
...@@ -139,8 +139,15 @@ int dhry(int n) ...@@ -139,8 +139,15 @@ int dhry(int n)
/* Initializations */ /* Initializations */
Next_Ptr_Glob = (Rec_Pointer)kzalloc(sizeof(Rec_Type), GFP_KERNEL); Next_Ptr_Glob = (Rec_Pointer)kzalloc(sizeof(Rec_Type), GFP_ATOMIC);
Ptr_Glob = (Rec_Pointer)kzalloc(sizeof(Rec_Type), GFP_KERNEL); if (!Next_Ptr_Glob)
return -ENOMEM;
Ptr_Glob = (Rec_Pointer)kzalloc(sizeof(Rec_Type), GFP_ATOMIC);
if (!Ptr_Glob) {
kfree(Next_Ptr_Glob);
return -ENOMEM;
}
Ptr_Glob->Ptr_Comp = Next_Ptr_Glob; Ptr_Glob->Ptr_Comp = Next_Ptr_Glob;
Ptr_Glob->Discr = Ident_1; Ptr_Glob->Discr = Ident_1;
......
...@@ -7246,7 +7246,12 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -7246,7 +7246,12 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
pte = (pte_t *)pmd_alloc(mm, pud, addr); pte = (pte_t *)pmd_alloc(mm, pud, addr);
} }
} }
BUG_ON(pte && pte_present(ptep_get(pte)) && !pte_huge(ptep_get(pte)));
if (pte) {
pte_t pteval = ptep_get_lockless(pte);
BUG_ON(pte_present(pteval) && !pte_huge(pteval));
}
return pte; return pte;
} }
......
...@@ -130,9 +130,10 @@ static __always_inline bool memory_is_poisoned_n(const void *addr, size_t size) ...@@ -130,9 +130,10 @@ static __always_inline bool memory_is_poisoned_n(const void *addr, size_t size)
if (unlikely(ret)) { if (unlikely(ret)) {
const void *last_byte = addr + size - 1; const void *last_byte = addr + size - 1;
s8 *last_shadow = (s8 *)kasan_mem_to_shadow(last_byte); s8 *last_shadow = (s8 *)kasan_mem_to_shadow(last_byte);
s8 last_accessible_byte = (unsigned long)last_byte & KASAN_GRANULE_MASK;
if (unlikely(ret != (unsigned long)last_shadow || if (unlikely(ret != (unsigned long)last_shadow ||
(((long)last_byte & KASAN_GRANULE_MASK) >= *last_shadow))) last_accessible_byte >= *last_shadow))
return true; return true;
} }
return false; return false;
......
...@@ -466,18 +466,6 @@ static inline void kasan_unpoison(const void *addr, size_t size, bool init) ...@@ -466,18 +466,6 @@ static inline void kasan_unpoison(const void *addr, size_t size, bool init)
if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK)) if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK))
return; return;
/*
* Explicitly initialize the memory with the precise object size to
* avoid overwriting the slab redzone. This disables initialization in
* the arch code and may thus lead to performance penalty. This penalty
* does not affect production builds, as slab redzones are not enabled
* there.
*/
if (__slub_debug_enabled() &&
init && ((unsigned long)size & KASAN_GRANULE_MASK)) {
init = false;
memzero_explicit((void *)addr, size);
}
size = round_up(size, KASAN_GRANULE_SIZE); size = round_up(size, KASAN_GRANULE_SIZE);
hw_set_mem_tag_range((void *)addr, size, tag, init); hw_set_mem_tag_range((void *)addr, size, tag, init);
......
...@@ -3950,6 +3950,13 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) ...@@ -3950,6 +3950,13 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
} }
} }
/*
* Some architectures may have to restore extra metadata to the page
* when reading from swap. This metadata may be indexed by swap entry
* so this must be called before swap_free().
*/
arch_swap_restore(entry, folio);
/* /*
* Remove the swap entry and conditionally try to free up the swapcache. * Remove the swap entry and conditionally try to free up the swapcache.
* We're already holding a reference on the page but haven't mapped it * We're already holding a reference on the page but haven't mapped it
......
...@@ -2434,6 +2434,7 @@ int write_cache_pages(struct address_space *mapping, ...@@ -2434,6 +2434,7 @@ int write_cache_pages(struct address_space *mapping,
for (i = 0; i < nr_folios; i++) { for (i = 0; i < nr_folios; i++) {
struct folio *folio = fbatch.folios[i]; struct folio *folio = fbatch.folios[i];
unsigned long nr;
done_index = folio->index; done_index = folio->index;
...@@ -2471,6 +2472,7 @@ int write_cache_pages(struct address_space *mapping, ...@@ -2471,6 +2472,7 @@ int write_cache_pages(struct address_space *mapping,
trace_wbc_writepage(wbc, inode_to_bdi(mapping->host)); trace_wbc_writepage(wbc, inode_to_bdi(mapping->host));
error = writepage(folio, wbc, data); error = writepage(folio, wbc, data);
nr = folio_nr_pages(folio);
if (unlikely(error)) { if (unlikely(error)) {
/* /*
* Handle errors according to the type of * Handle errors according to the type of
...@@ -2489,8 +2491,7 @@ int write_cache_pages(struct address_space *mapping, ...@@ -2489,8 +2491,7 @@ int write_cache_pages(struct address_space *mapping,
error = 0; error = 0;
} else if (wbc->sync_mode != WB_SYNC_ALL) { } else if (wbc->sync_mode != WB_SYNC_ALL) {
ret = error; ret = error;
done_index = folio->index + done_index = folio->index + nr;
folio_nr_pages(folio);
done = 1; done = 1;
break; break;
} }
...@@ -2504,7 +2505,8 @@ int write_cache_pages(struct address_space *mapping, ...@@ -2504,7 +2505,8 @@ int write_cache_pages(struct address_space *mapping,
* keep going until we have written all the pages * keep going until we have written all the pages
* we tagged for writeback prior to entering this loop. * we tagged for writeback prior to entering this loop.
*/ */
if (--wbc->nr_to_write <= 0 && wbc->nr_to_write -= nr;
if (wbc->nr_to_write <= 0 &&
wbc->sync_mode == WB_SYNC_NONE) { wbc->sync_mode == WB_SYNC_NONE) {
done = 1; done = 1;
break; break;
......
...@@ -723,6 +723,7 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s, ...@@ -723,6 +723,7 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s,
unsigned int orig_size) unsigned int orig_size)
{ {
unsigned int zero_size = s->object_size; unsigned int zero_size = s->object_size;
bool kasan_init = init;
size_t i; size_t i;
flags &= gfp_allowed_mask; flags &= gfp_allowed_mask;
...@@ -739,6 +740,17 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s, ...@@ -739,6 +740,17 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s,
(s->flags & SLAB_KMALLOC)) (s->flags & SLAB_KMALLOC))
zero_size = orig_size; zero_size = orig_size;
/*
* When slub_debug is enabled, avoid memory initialization integrated
* into KASAN and instead zero out the memory via the memset below with
* the proper size. Otherwise, KASAN might overwrite SLUB redzones and
* cause false-positive reports. This does not lead to a performance
* penalty on production builds, as slub_debug is not intended to be
* enabled there.
*/
if (__slub_debug_enabled())
kasan_init = false;
/* /*
* As memory initialization might be integrated into KASAN, * As memory initialization might be integrated into KASAN,
* kasan_slab_alloc and initialization memset must be * kasan_slab_alloc and initialization memset must be
...@@ -747,8 +759,8 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s, ...@@ -747,8 +759,8 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s,
* As p[i] might get tagged, memset and kmemleak hook come after KASAN. * As p[i] might get tagged, memset and kmemleak hook come after KASAN.
*/ */
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
p[i] = kasan_slab_alloc(s, p[i], flags, init); p[i] = kasan_slab_alloc(s, p[i], flags, kasan_init);
if (p[i] && init && !kasan_has_integrated_init()) if (p[i] && init && (!kasan_init || !kasan_has_integrated_init()))
memset(p[i], 0, zero_size); memset(p[i], 0, zero_size);
kmemleak_alloc_recursive(p[i], s->object_size, 1, kmemleak_alloc_recursive(p[i], s->object_size, 1,
s->flags, flags); s->flags, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment