* + kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch added to -mm tree
@ 2021-09-29 23:46 akpm
0 siblings, 0 replies; 4+ messages in thread
From: akpm @ 2021-09-29 23:46 UTC (permalink / raw)
To: akpm, elver, mm-commits
The patch titled
Subject: fixup! kfence: limit currently covered allocations when pool nearly full
has been added to the -mm tree. Its filename is
kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Marco Elver <elver@google.com>
Subject: fixup! kfence: limit currently covered allocations when pool nearly full
Fix 32 bit. size_t is UL on 64-bit only; just cast it to size_t
mm/kfence/core.c: In function `get_alloc_stack_hash':
./include/linux/minmax.h:20:28: warning: comparison of distinct pointer types lacks a cast
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
./include/linux/minmax.h:26:4: note: in expansion of macro `__typecheck'
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
./include/linux/minmax.h:36:24: note: in expansion of macro `__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
./include/linux/minmax.h:45:19: note: in expansion of macro `__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
mm/kfence/core.c:177:16: note: in expansion of macro `min'
177 | num_entries = min(num_entries, UNIQUE_ALLOC_STACK_DEPTH);
| ^~~
Link: https://lkml.kernel.org/r/YVQ0fE4Yil2EX8FI@elver.google.com
Signed-off-by: Marco Elver <elver@google.com>
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/kfence/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/kfence/core.c~kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix
+++ a/mm/kfence/core.c
@@ -130,7 +130,7 @@ atomic_t kfence_allocation_gate = ATOMIC
static atomic_t alloc_covered[ALLOC_COVERED_SIZE];
/* Stack depth used to determine uniqueness of an allocation. */
-#define UNIQUE_ALLOC_STACK_DEPTH 8UL
+#define UNIQUE_ALLOC_STACK_DEPTH ((size_t)8)
/*
* Randomness for stack hashes, making the same collisions across reboots and
_
Patches currently in -mm which might be from elver@google.com are
lib-stackdepot-include-gfph.patch
lib-stackdepot-remove-unused-function-argument.patch
lib-stackdepot-introduce-__stack_depot_save.patch
kasan-common-provide-can_alloc-in-kasan_save_stack.patch
kasan-generic-introduce-kasan_record_aux_stack_noalloc.patch
workqueue-kasan-avoid-alloc_pages-when-recording-stack.patch
mm-fix-data-race-in-pagepoisoned.patch
stacktrace-move-filter_irq_stacks-to-kernel-stacktracec.patch
kfence-count-unexpectedly-skipped-allocations.patch
kfence-move-saving-stack-trace-of-allocations-into-__kfence_alloc.patch
kfence-limit-currently-covered-allocations-when-pool-nearly-full.patch
kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix.patch
kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
kfence-add-note-to-documentation-about-skipping-covered-allocations.patch
kfence-test-use-kunit_skip-to-skip-tests.patch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: + kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch added to -mm tree
2021-09-29 3:25 akpm
2021-09-29 4:25 ` Stephen Rothwell
@ 2021-09-29 9:40 ` Marco Elver
1 sibling, 0 replies; 4+ messages in thread
From: Marco Elver @ 2021-09-29 9:40 UTC (permalink / raw)
To: akpm; +Cc: dvyukov, glider, jannh, mm-commits, nogikh, sfr, tarasmadan
On Tue, Sep 28, 2021 at 08:25PM -0700, akpm@linux-foundation.org wrote:
[...]
> --- a/mm/kfence/core.c~kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix
> +++ a/mm/kfence/core.c
> @@ -172,7 +172,7 @@ static inline bool should_skip_covered(v
> return atomic_long_read(&counters[KFENCE_COUNTER_ALLOCATED]) > thresh;
> }
>
> -static u32 get_alloc_stack_hash(unsigned long *stack_entries, size_t num_entries)
> +static u32 get_alloc_stack_hash(unsigned long *stack_entries, unsigned long num_entries)
> {
> num_entries = min(num_entries, UNIQUE_ALLOC_STACK_DEPTH);
> num_entries = filter_irq_stacks(stack_entries, num_entries);
> @@ -839,7 +839,7 @@ void kfence_shutdown_cache(struct kmem_c
> void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags)
> {
> unsigned long stack_entries[KFENCE_STACK_DEPTH];
> - size_t num_stack_entries;
> + unsigned long num_stack_entries;
> u32 alloc_stack_hash;
Thanks, Andrew!
Apologies for missing this. UNIQUE_ALLOC_STACK_DEPTH was turned into an
UL after seeing the same warning on 64-bit builds... :-/
The below would be simpler and more consistent, because we use size_t
for num_stack_entries elsewhere, too. Whichever you think is more
appropriate.
Thanks,
-- Marco
------ >8 ------
From: Marco Elver <elver@google.com>
Date: Wed, 29 Sep 2021 11:20:44 +0200
Subject: [PATCH] fixup! kfence: limit currently covered allocations when pool
nearly full
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix 32 bit. size_t is UL on 64-bit only; just cast it to size_t
mm/kfence/core.c: In function ‘get_alloc_stack_hash’:
./include/linux/minmax.h:20:28: warning: comparison of distinct pointer types lacks a cast
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
./include/linux/minmax.h:26:4: note: in expansion of macro ‘__typecheck’
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
./include/linux/minmax.h:36:24: note: in expansion of macro ‘__safe_cmp’
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
./include/linux/minmax.h:45:19: note: in expansion of macro ‘__careful_cmp’
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
mm/kfence/core.c:177:16: note: in expansion of macro ‘min’
177 | num_entries = min(num_entries, UNIQUE_ALLOC_STACK_DEPTH);
| ^~~
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Marco Elver <elver@google.com>
---
mm/kfence/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/kfence/core.c b/mm/kfence/core.c
index 1f1fc5be1d4d..802905b1c89b 100644
--- a/mm/kfence/core.c
+++ b/mm/kfence/core.c
@@ -130,7 +130,7 @@ atomic_t kfence_allocation_gate = ATOMIC_INIT(1);
static atomic_t alloc_covered[ALLOC_COVERED_SIZE];
/* Stack depth used to determine uniqueness of an allocation. */
-#define UNIQUE_ALLOC_STACK_DEPTH 8UL
+#define UNIQUE_ALLOC_STACK_DEPTH ((size_t)8)
/*
* Randomness for stack hashes, making the same collisions across reboots and
--
2.33.0.685.g46640cef36-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: + kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch added to -mm tree
2021-09-29 3:25 akpm
@ 2021-09-29 4:25 ` Stephen Rothwell
2021-09-29 9:40 ` Marco Elver
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2021-09-29 4:25 UTC (permalink / raw)
To: akpm; +Cc: dvyukov, elver, glider, jannh, mm-commits, nogikh, tarasmadan
[-- Attachment #1: Type: text/plain, Size: 711 bytes --]
Hi Andrew,
On Tue, 28 Sep 2021 20:25:40 -0700 akpm@linux-foundation.org wrote:
>
> The patch titled
> Subject: kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix
> has been added to the -mm tree. Its filename is
> kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
>
> This patch should soon appear at
> https://ozlabs.org/~akpm/mmots/broken-out/kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
> and later at
> https://ozlabs.org/~akpm/mmotm/broken-out/kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
added to linux-next today.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* + kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch added to -mm tree
@ 2021-09-29 3:25 akpm
2021-09-29 4:25 ` Stephen Rothwell
2021-09-29 9:40 ` Marco Elver
0 siblings, 2 replies; 4+ messages in thread
From: akpm @ 2021-09-29 3:25 UTC (permalink / raw)
To: akpm, dvyukov, elver, glider, jannh, mm-commits, nogikh, sfr, tarasmadan
The patch titled
Subject: kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix
has been added to the -mm tree. Its filename is
kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Andrew Morton <akpm@linux-foundation.org>
Subject: kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix
fix i386 build
In file included from ./include/linux/kernel.h:16,
from ./include/linux/list.h:9,
from ./include/linux/wait.h:7,
from ./include/linux/wait_bit.h:8,
from ./include/linux/fs.h:6,
from ./include/linux/debugfs.h:15,
from mm/kfence/core.c:12:
mm/kfence/core.c: In function 'get_alloc_stack_hash':
./include/linux/minmax.h:20:28: error: comparison of distinct pointer types lacks a cast [-Werror]
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
./include/linux/minmax.h:26:4: note: in expansion of macro '__typecheck'
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
./include/linux/minmax.h:36:24: note: in expansion of macro '__safe_cmp'
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
./include/linux/minmax.h:45:19: note: in expansion of macro '__careful_cmp'
45 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~
mm/kfence/core.c:177:16: note: in expansion of macro 'min'
177 | num_entries = min(num_entries, UNIQUE_ALLOC_STACK_DEPTH);
| ^~~
Cc: Aleksandr Nogikh <nogikh@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Taras Madan <tarasmadan@google.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/kfence/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/mm/kfence/core.c~kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix
+++ a/mm/kfence/core.c
@@ -172,7 +172,7 @@ static inline bool should_skip_covered(v
return atomic_long_read(&counters[KFENCE_COUNTER_ALLOCATED]) > thresh;
}
-static u32 get_alloc_stack_hash(unsigned long *stack_entries, size_t num_entries)
+static u32 get_alloc_stack_hash(unsigned long *stack_entries, unsigned long num_entries)
{
num_entries = min(num_entries, UNIQUE_ALLOC_STACK_DEPTH);
num_entries = filter_irq_stacks(stack_entries, num_entries);
@@ -839,7 +839,7 @@ void kfence_shutdown_cache(struct kmem_c
void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags)
{
unsigned long stack_entries[KFENCE_STACK_DEPTH];
- size_t num_stack_entries;
+ unsigned long num_stack_entries;
u32 alloc_stack_hash;
/*
_
Patches currently in -mm which might be from akpm@linux-foundation.org are
mm.patch
mm-mempolicy-convert-from-atomic_t-to-refcount_t-on-mempolicy-refcnt-fix.patch
kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch
ipc-check-checkpoint_restore_ns_capable-to-modify-c-r-proc-files-fix.patch
kernel-forkc-export-kernel_thread-to-modules.patch
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-29 23:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 23:46 + kfence-limit-currently-covered-allocations-when-pool-nearly-full-fix-fix.patch added to -mm tree akpm
-- strict thread matches above, loose matches on Subject: below --
2021-09-29 3:25 akpm
2021-09-29 4:25 ` Stephen Rothwell
2021-09-29 9:40 ` Marco Elver
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.