Like is done for KCSAN, for KASAN we should also use __always_inline in
compilation units that have instrumentation disabled
(KASAN_SANITIZE_foo.o := n). Adds common documentation for KASAN and
KCSAN explaining the attribute.
Signed-off-by: Marco Elver
---
include/linux/compiler_types.h | 13
lore.kernel.org/lkml/20200505142341.1096942-1-a...@arndb.de
Acked-by: Marco Elver
Signed-off-by: Arnd Bergmann
Signed-off-by: Marco Elver
---
This patch is already in -rcu tree, but since since the series is based
on -tip, to avoid conflict it is required for the subsequent patches.
---
lib/Kconfig.kcsan |
Signed-off-by: Marco Elver
---
scripts/Makefile.kcsan | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/Makefile.kcsan b/scripts/Makefile.kcsan
index c02662b30a7c..ea4a6301633e 100644
--- a/scripts/Makefile.kcsan
+++ b/scripts/Makefile.kcsan
@@ -13,6 +13,7 @@ endif
# if the absence of
The volatile access no longer needs to be wrapped in data_race(),
because we require compilers that emit instrumentation distinguishing
volatile accesses.
Signed-off-by: Marco Elver
---
include/linux/compiler.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include
entry,exit}() insertion effectively disabled
tail-call optimization, there should be no observable change. [This was
caught and confirmed with kcsan-test & UNWINDER_ORC.]
Signed-off-by: Marco Elver
---
scripts/Makefile.kcsan | 11 ++-
1 file changed, 10 insertions(+), 1 deletion(-)
dif
.@mail.gmail.com
Signed-off-by: Marco Elver
---
include/linux/compiler.h | 6 ++
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index e24cc3a2bc3e..17c98b215572 100644
--- a/include/linux/compiler.h
+++ b/include/linux/comp
mbine sanitizer with kcov on clang
Marco Elver (9):
kcsan: Avoid inserting __tsan_func_entry/exit if possible
kcsan: Support distinguishing volatile accesses
kcsan: Pass option tsan-instrument-read-before-write to Clang
kcsan: Remove 'noinline' from __no_kcsan_or_inline
kcsan
d #7.
Link:
https://lkml.kernel.org/r/CANpmjNMTsY_8241bS7=xafqvzhflrvekv_um4aduwe_kh3r...@mail.gmail.com
Signed-off-by: Marco Elver
---
lib/Kconfig.kcsan | 9 -
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan
index a7276035ca0d..3f3b5bca7a8f 1
).
[1]
https://github.com/llvm/llvm-project/commit/5a2c31116f412c3b6888be361137efd705e05814
[2] https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544452.html
This patch allows removing any explicit checks in primitives such as
READ_ONCE() and WRITE_ONCE().
Signed-off-by: Marco Elver
On Sun, 7 Jun 2020 at 11:37, Dmitry Vyukov wrote:
>
> On Fri, Jun 5, 2020 at 3:25 PM 'Andrey Konovalov' via kasan-dev
> wrote:
> > > On Fri, Jun 05, 2020 at 12:57:15PM +0200, Dmitry Vyukov wrote:
> > > > On Fri, Jun 5, 2020 at 10:28 AM Marco Elver wr
On Mon, 8 Jun 2020 at 19:32, Martin Liška wrote:
>
> On 6/3/20 9:23 PM, Marco Elver wrote:
> >
> >
> > On Wed, 03 Jun 2020, Borislav Petkov wrote:
> >
> >> On Thu, May 14, 2020 at 12:05:38PM +0100, Will Deacon wrote:
> >>> Talking off-list, Cla
On Wed, Jul 29, 2020 at 04:23PM -0300, Vitor Massaru Iha wrote:
> This adds the conversion of the runtime tests of test_list_sort,
> from `lib/test_list_sort.c` to KUnit tests.
>
> Please apply this commit first (linux-kselftest/kunit-fixes):
> 3f37d14b8a3152441f36b6bc74000996679f0998 kunit: kunit
On Thu, Jul 02, 2020 at 12:14AM -0700, David Gow wrote:
> As discussed in [1], KUnit tests have hitherto not had a particularly
> consistent naming scheme. This adds documentation outlining how tests
> and test suites should be named, including how those names should be
> used in Kconfig entries an
On Thu, 27 Aug 2020 at 18:17, David Gow wrote:
[...]
> > First of all, thanks for the talk yesterday! I only looked at this
> > because somebody pasted the LKML link. :-)
>
> No worries! Clearly this document needed linking -- even I was
> starting to suspect the reason no-one was complaining abou
erence. If we are not going to clean up behind us, this
> should be a warning and not an error.
There are also some other documentation that would go stale. We probably
have to change KASAN docs to look something like the below.
I wish we could also remove the "but detection of out-of-bo
On Fri, Aug 14, 2020 at 07:27PM +0200, Andrey Konovalov wrote:
> Add documentation for hardware tag-based KASAN mode and also add some
> clarifications for software tag-based mode.
>
> Signed-off-by: Andrey Konovalov
> ---
> Documentation/dev-tools/kasan.rst | 73 +--
On Mon, 24 Aug 2020 at 10:14, Walter Wu wrote:
>
> Generic KASAN support to record the last two timer and workqueue
> stacks and print them in KASAN report. So that need to update
> documentation.
>
> Signed-off-by: Walter Wu
> Cc: Andrey Ryabinin
> Cc: Dmitry Vyukov
> Cc: Alexander Potapenko
On Mon, 24 Aug 2020 at 10:14, Walter Wu wrote:
>
> Adds a test to verify workqueue stack recording and print it in
> KASAN report.
>
> The KASAN report was as follows(cleaned up slightly):
>
> BUG: KASAN: use-after-free in kasan_workqueue_uaf
>
> Freed by task 54:
> kasan_save_stack+0x24/0x50
orkqueue stack.
> - change the aux stack title for common name.
Much cleaner.
In general,
Acked-by: Marco Elver
but I left some more comments. I'm a bit worried about the tests,
because of KASAN-test KUnit rework, but probably not much we can do
until these are added to -mm tree.
Thanks,
-- Marco
c: add workqueue test case
> kasan: update documentation for generic kasan
Acked-by: Marco Elver
> ---
>
> Changes since v2:
> - modify kasan document to be more readable.
> Thanks for Marco suggestion.
>
> Changes since v1:
> - Thanks for Marco and Thomas sugges
On Tue, 1 Sep 2020 at 07:31, David Gow wrote:
> On Tue, Sep 1, 2020 at 7:47 AM Kees Cook wrote:
> > On Fri, Aug 28, 2020 at 12:17:05AM +0800, David Gow wrote:
> > > On Thu, Aug 27, 2020 at 9:14 PM Marco Elver wrote:
[...]
>
> I guess there are two audiences to cater for
On Wed, Sep 02, 2020 at 11:30AM +0800, Boqun Feng wrote:
> Hi Paul and Marco,
>
> The whole update patchset looks good to me, just one question out of
> curiosity fo this one, please see below:
>
> On Mon, Aug 31, 2020 at 11:18:04AM -0700, paul...@kernel.org wrote:
>
On Fri, Sep 04, 2020 at 12:22PM +0800, David Gow wrote:
[...]
>
> This is a good point -- renaming files is definitely a pain. It's
> obviously my hope that KUnit sticks around long enough that it's not
> being added/removed as a dependency too often, particularly for the
> unit tests, so "_kunit"
From: Alexander Potapenko
Add compatibility with KMEMLEAK, by making KMEMLEAK aware of the KFENCE
memory pool. This allows building debug kernels with both enabled, which
also helped in debugging KFENCE.
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander
On Mon, 7 Sep 2020 at 17:43, Jonathan Cameron
wrote:
...
> Interesting bit of work. A few trivial things inline I spotted whilst having
> a first read through.
>
> Thanks,
>
> Jonathan
Thank you for having a look! We'll address these for v2.
Thanks,
-- Marco
On Tue, 11 Aug 2020 at 08:56, Marco Elver wrote:
> On Mon, 10 Aug 2020 at 22:18, Thomas Gleixner wrote:
> > Marco Elver writes:
> > > Since KCSAN instrumentation is everywhere, we need to treat the hooks
> > > NMI-like for interrupt tracing. In order to present an as
On Fri, 7 Aug 2020 at 21:06, Pekka Enberg wrote:
...
> Yeah, it reproduces with defconfig too, as long as you remember to
> pass "slub_debug=Z"... :-/
>
> The following seems to be the culprit:
>
> commit 3202fa62fb43087387c65bfa9c100feffac74aa6
> Author: Kees Cook
> Date: Wed Apr 1 21:04:27 20
On Sun, 30 Aug 2020 at 20:54, Linus Torvalds
wrote:
> On Sun, Aug 30, 2020 at 11:04 AM Thomas Gleixner wrote:
> >
> > - Make is_idle_task() __always_inline to prevent the compiler from putting
> >it out of line into the wrong section because it's used inside noinstr
> >sections.
>
> What
On Mon, 31 Aug 2020 at 09:24, wrote:
>
> On Sun, Aug 30, 2020 at 11:54:19AM -0700, Linus Torvalds wrote:
> > On Sun, Aug 30, 2020 at 11:04 AM Thomas Gleixner wrote:
> > >
> > > - Make is_idle_task() __always_inline to prevent the compiler from
> > > putting
> > >it out of line into the wron
On Mon, Aug 31, 2020 at 12:47PM +0200, SeongJae Park wrote:
[...]
> diff --git a/mm/damon.c b/mm/damon.c
> index 7e3c8c82a010..9815d22fc4de 100644
> --- a/mm/damon.c
> +++ b/mm/damon.c
> @@ -2001,6 +2001,147 @@ static ssize_t debugfs_record_write(struct file *file,
> return ret;
> }
>
> +s
On Mon, 7 Sep 2020 at 17:34, Andrey Konovalov wrote:
>
> On Mon, Sep 7, 2020 at 3:41 PM Marco Elver wrote:
> >
> > Add KFENCE documentation in dev-tools/kfence.rst, and add to index.
> >
> > Co-developed-by: Alexander Potapenko
> > Signed-off-by: Alexander
d-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
lib/Kconfig.kfence | 12 +
mm/kfence/Makefile | 3 +
mm/kfence/kfence-test.c | 777
3 files changed, 792 insertions(+)
create mode 100644 mm/kfence/kfence-test.c
diff --git
Add KFENCE documentation in dev-tools/kfence.rst, and add to index.
Co-developed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
Documentation/dev-tools/index.rst | 1 +
Documentation/dev-tools/kfence.rst | 285 +
2
KFENCE-allocated objects in static_obj().
Co-developed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
kernel/locking/lockdep.c | 8
1 file changed, 8 insertions(+)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index
is_kfence_address().
Co-developed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
For ARM64, we would like to solicit feedback on what the best option is
to obtain a constant address for __kfence_pool. One option is to declare
a memory range in the memory layout to
ctions are __always_inline.
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
mm/slab.c| 46 ++
mm/slab_common.c | 6 +-
2 files changed, 39 insertions(+), 13 deletions(-)
diff --git a/mm/s
ctions are __always_inline.
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
mm/slub.c | 72 ---
1 file changed, 53 insertions(+), 19 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index d4
need to ensure that the pool uses 4K pages, which is done
using the set_memory_4k() helper function.
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
arch/x86/Kconfig | 2 ++
arch/x86/include/asm/kfence.h | 60
of the two is generally discouraged,
CONFIG_EXPERT=y should be set. It also gives us the nice property that
KFENCE will be build-tested by allyesconfig builds.
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
lib/Kconfig.kfence | 2 +-
mm/kasan
-neutral compared to the non-KFENCE baseline.
For more details, see Documentation/dev-tools/kfence.rst (added later in
the series).
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
MAINTAINERS| 11 +
include/linux/kfence.h | 174 +++
mm: add Kernel Electric-Fence infrastructure
x86, kfence: enable KFENCE for x86
mm, kfence: insert KFENCE hooks for SLAB
mm, kfence: insert KFENCE hooks for SLUB
kfence, kasan: make KFENCE compatible with KASAN
kfence, kmemleak: make KFENCE compatible with KMEMLEAK
Marco Elver (4):
arm64, k
On Mon, 7 Sep 2020 at 19:55, Andrey Konovalov wrote:
> On Mon, Sep 7, 2020 at 6:33 PM Marco Elver wrote:
[...]
> > > > +Guarded allocations are set up based on the sample interval. After
> > > > expiration
> > > > +of the sample interval, a gu
On Sun, 6 Sep 2020 at 00:23, Arvind Sankar wrote:
>
> String functions can be useful in early boot, but using instrumented
> versions can be problematic: eg on x86, some of the early boot code is
> executing out of an identity mapping rather than the kernel virtual
> addresses. Accessing any globa
On Tue, Sep 08, 2020 at 05:36PM +0200, Vlastimil Babka wrote:
> On 9/8/20 5:31 PM, Marco Elver wrote:
> >>
> >> How much memory overhead does this end up having? I know it depends on
> >> the object size and so forth. But, could you give some real-world
>
On Tue, Sep 08, 2020 at 08:54AM -0700, Dave Hansen wrote:
> On 9/7/20 6:40 AM, Marco Elver wrote:
> > +The most important parameter is KFENCE's sample interval, which can be set
> > via
> > +the kernel boot parameter ``kfence.sample_interval`` in milliseconds. The
>
On Tue, Sep 08, 2020 at 07:52AM -0700, Dave Hansen wrote:
> On 9/7/20 6:40 AM, Marco Elver wrote:
> > KFENCE is designed to be enabled in production kernels, and has near
> > zero performance overhead. Compared to KASAN, KFENCE trades performance
> > for precision.
>
&
On Tue, Sep 08, 2020 at 04:40PM +0200, Vlastimil Babka wrote:
> On 9/8/20 2:16 PM, Alexander Potapenko wrote:
> >> Toggling a static branch is AFAIK quite disruptive (PeterZ will probably
> >> tell
> >> you better), and with the default 100ms sample interval, I'd think it's
> >> not good
> >> to
ke sense to introduce yet another special
case to KCSAN's runtime, only to cater to the case here.
Signed-off-by: Marco Elver
Cc: Dmitry Vyukov
Cc: Paul E. McKenney
Cc: Will Deacon
---
As discussed, partially reverting behaviour for non-atomic bitops when
KCSAN_ASSUME_PLAIN_WRITES_ATOMIC is sel
On Fri, 14 Aug 2020 at 13:31, Mark Rutland wrote:
> On Fri, Aug 14, 2020 at 12:28:26PM +0100, Mark Rutland wrote:
> > Hi,
> >
> > Sorry to come to this rather late -- this comment equally applies to v2
> > so I'm replying here to have context.
>
> ... and now I see that was already applied, so ple
On Thu, 8 Oct 2020 at 12:45, Mark Rutland wrote:
> On Thu, Oct 08, 2020 at 11:40:52AM +0200, Marco Elver wrote:
> > On Thu, 1 Oct 2020 at 19:58, Mark Rutland wrote:
> > [...]
> > > > > If you need virt_to_page() to work, the address has to be part of t
On Wed, 14 Oct 2020 at 22:44, Andrey Konovalov wrote:
>
> Similarly to kasan_init() mark kasan_init_tags() as __init.
>
> Signed-off-by: Andrey Konovalov
> Link:
> https://linux-review.googlesource.com/id/I8792e22f1ca5a703c5e979969147968a99312558
> ---
> include/linux/kasan.h | 4 ++--
> mm/kas
On Wed, 14 Oct 2020 at 22:45, Andrey Konovalov wrote:
>
> TODO: no meaningful description here yet, please see the cover letter
> for this RFC series.
>
> Signed-off-by: Andrey Konovalov
> Link:
> https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4
> ---
> m
On Thu, 15 Oct 2020 at 15:39, Mark Rutland wrote:
> On Wed, Oct 14, 2020 at 09:12:37PM +0200, Marco Elver wrote:
> > On Thu, 8 Oct 2020 at 12:45, Mark Rutland wrote:
> > > On Thu, Oct 08, 2020 at 11:40:52AM +0200, Marco Elver wrote:
> > > > On Thu, 1 Oct 2020
On Wed, 14 Oct 2020 at 22:44, Andrey Konovalov wrote:
> This patchset is not complete (see particular TODOs in the last patch),
> and I haven't performed any benchmarking yet, but I would like to start the
> discussion now and hear people's opinions regarding the questions mentioned
> below.
>
> =
On Tue, 27 Oct 2020 at 06:14, Arpitha Raghunandan <98.a...@gmail.com> wrote:
[...]
> >> diff --git a/include/kunit/test.h b/include/kunit/test.h
> >> index a423fffefea0..16bf9f334e2c 100644
> >> --- a/include/kunit/test.h
> >> +++ b/include/kunit/test.h
> >> @@ -142,6 +142,12 @@ struct kunit_case {
On Mon, 26 Oct 2020 at 19:36, Arpitha Raghunandan <98.a...@gmail.com> wrote:
[...]
> * success starts as true, and may only be set to false during a
> * test case; thus, it is safe to update this across multiple
> @@ -1742,4 +1760,18 @@ do {
I just tried to give this a spin on some of my tests and noticed some
more things (apologies for the multiple rounds of comments):
On Mon, 26 Oct 2020 at 19:36, Arpitha Raghunandan <98.a...@gmail.com> wrote:
[...]
> /**
> * struct kunit_suite - describes a related collection of &struct kunit_ca
ways_inline.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* Fix obj_to_index for kfence objects.
v3:
* Rewrite patch description to clarify need for 'orig_size'
[reported by Christopher Lameter].
---
i
k
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* MAJOR CHANGE: Removal of HAVE_ARCH_KFENCE_STATIC_POOL and static pool
support in favor of memblock_alloc'd pool only, as it avoids all issues
with virt_to translations.
++--
> mm/kasan/generic.c | 8 ++++
> 8 files changed, 19 insertions(+), 19 deletions(-)
Reviewed-by: Marco Elver
for KCSAN and KASAN.
Thank you!
> diff --git a/arch/x86/boot/compressed/string.c
> b/arch/x86/boot/compressed/string.c
> index 81fc1eaa3
LEAK compatibility patch.
RFC/v1: https://lkml.kernel.org/r/20200907134055.2878499-1-el...@google.com
Alexander Potapenko (5):
mm: add Kernel Electric-Fence infrastructure
x86, kfence: enable KFENCE for x86
mm, kfence: insert KFENCE hooks for SLAB
mm, kfence: insert KFENCE hooks for SLUB
kfence, kasan:
-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
v5:
* Move generic page allocation code to core.c [suggested by Jann Horn].
* Remove comment about HAVE_ARCH_KFENCE_STATIC_POOL, since we no longer
support static pools.
* Force page granularity for the
ed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
v5:
* Add better memory corruption test.
* Test sl*b_def.h primitives.
v4:
* Clarify RCU test comment [reported by Paul E. McKenney].
v3:
* Lower line buffer size to avoid warnings of using more than 1024
Add entry for KFENCE maintainers.
Reviewed-by: Dmitry Vyukov
Reviewed-by: SeongJae Park
Co-developed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
v4:
* Split out from first patch.
---
MAINTAINERS | 11 +++
1 file changed, 11 insertions
need to ensure that the pool uses 4K pages, which is done
using the set_memory_4k() helper function.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* MAJOR CHANGE: Switch to the memblock_alloc'd pool. Ru
ways_inline.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* New kfence_shutdown_cache(): we need to defer kfence_shutdown_cache()
to before the cache is actually freed. In case of SLAB_TYPESAFE_BY_RCU,
the obj
of the two is generally discouraged,
CONFIG_EXPERT=y should be set. It also gives us the nice property that
KFENCE will be build-tested by allyesconfig builds.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* Also
Add KFENCE documentation in dev-tools/kfence.rst, and add to index.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
v3:
* Re-introduce reference to Documentation/dev-tools/kfence.rst.
v2:
* Many clarifications
.
> This generator function should return the next parameter given the
> previous parameter in parameterized tests. It also provides
> a macro to generate common-case generators.
>
> Signed-off-by: Arpitha Raghunandan <98.a...@gmail.com>
> Co-developed-by: Marco Elver
> Signe
Hi Paul,
Let me add another option below, as an alternative to KASAN that
Dmitry mentioned.
On Tue, 27 Oct 2020 at 19:40, Dmitry Vyukov wrote:
> On Tue, Oct 27, 2020 at 6:58 PM Paul E. McKenney wrote:
> >
> > Hello!
> >
> > I have vague memories of some facility some time some where that record
On Wed, 28 Oct 2020 at 00:50, kernel test robot wrote:
>
> Hi Arpitha,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on ext4/dev]
> [also build test WARNING on linus/master v5.10-rc1 next-20201027]
> [If your patch is applied to the wrong git tree, kindly
Avoid setting up watchpoints on NULL pointers, as otherwise we would
crash inside the KCSAN runtime (when checking for value changes) instead
of the instrumented code.
Because that may be confusing, skip any address less than PAGE_SIZE.
Signed-off-by: Marco Elver
---
kernel/kcsan/encoding.h
In preparation of supporting only addresses not within the NULL page,
change the selftest to never use addresses that are less than PAGE_SIZE.
Signed-off-by: Marco Elver
---
v2:
* Introduce patch to series.
---
kernel/kcsan/selftest.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a
Avoid setting up watchpoints on NULL pointers, as otherwise we would
crash inside the KCSAN runtime (when checking for value changes) instead
of the instrumented code.
Because that may be confusing, skip any address less than PAGE_SIZE.
Signed-off-by: Marco Elver
---
kernel/kcsan/encoding.h
On Thu, 22 Oct 2020 at 13:30, Marco Elver wrote:
>
> Avoid setting up watchpoints on NULL pointers, as otherwise we would
> crash inside the KCSAN runtime (when checking for value changes) instead
> of the instrumented code.
>
> Because that may be confusing, skip any address l
On Thu, 22 Oct 2020 at 15:19, Andrey Konovalov wrote:
>
> TODO: no meaningful description here yet, please see the cover letter
> for this RFC series.
>
> Signed-off-by: Andrey Konovalov
> Link:
> https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4
> ---
> m
expected, since that extra address bit is
insignificant for enabled architectures.
Signed-off-by: Marco Elver
---
kernel/kcsan/encoding.h | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/kcsan/encoding.h b/kernel/kcsan/encoding.h
index 64b3c0f2a685..fc5154dd2475
struct kunit *test, void *prev)
\
+ {
\
+ typeof((array)[0]) *__next = prev ? ((typeof(__next)) prev) + 1
: (array); \
+ return __next - (array) < ARR
On Fri, 23 Oct 2020 at 20:48, Marco Elver wrote:
[...]
> > + */
> > +static inline void *kunit_param_generator_helper(struct kunit *test,
>
> I don't think this needs to be inline, but see my other suggestion
> below, which might make this function obsolete.
Ah sor
.
> This generator function should return the next parameter given the
> previous parameter in parameterized tests. It also provides
> a macro to generate common-case generators.
>
> Signed-off-by: Arpitha Raghunandan <98.a...@gmail.com>
> Co-developed-by: Marco Elver
> Signe
k
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v6:
* Record allocation and free task pids, and show them in reports. This
information helps more easily identify e.g. racy use-after-frees.
v5:
* MAJOR CHANGE: Removal of HAVE_ARCH_KFENCE_ST
om
Alexander Potapenko (5):
mm: add Kernel Electric-Fence infrastructure
x86, kfence: enable KFENCE for x86
mm, kfence: insert KFENCE hooks for SLAB
mm, kfence: insert KFENCE hooks for SLUB
kfence, kasan: make KFENCE compatible with KASAN
Marco Elver (4):
arm64, kfence: enable KFENCE for ARM6
ed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
v5:
* Add better memory corruption test.
* Test sl*b_def.h primitives.
v4:
* Clarify RCU test comment [reported by Paul E. McKenney].
v3:
* Lower line buffer size to avoid warnings of using more than 1024
need to ensure that the pool uses 4K pages, which is done
using the set_memory_4k() helper function.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* MAJOR CHANGE: Switch to the memblock_alloc'd pool. Ru
Add entry for KFENCE maintainers.
Reviewed-by: Dmitry Vyukov
Reviewed-by: SeongJae Park
Co-developed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
v4:
* Split out from first patch.
---
MAINTAINERS | 11 +++
1 file changed, 11 insertions
Add KFENCE documentation in dev-tools/kfence.rst, and add to index.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
v3:
* Re-introduce reference to Documentation/dev-tools/kfence.rst.
v2:
* Many clarifications
ways_inline.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* Fix obj_to_index for kfence objects.
v3:
* Rewrite patch description to clarify need for 'orig_size'
[reported by Christopher Lameter].
---
i
of the two is generally discouraged,
CONFIG_EXPERT=y should be set. It also gives us the nice property that
KFENCE will be build-tested by allyesconfig builds.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* Also
ways_inline.
Reviewed-by: Dmitry Vyukov
Co-developed-by: Marco Elver
Signed-off-by: Marco Elver
Signed-off-by: Alexander Potapenko
---
v5:
* New kfence_shutdown_cache(): we need to defer kfence_shutdown_cache()
to before the cache is actually freed. In case of SLAB_TYPESAFE_BY_RCU,
the obj
-by: Alexander Potapenko
Signed-off-by: Alexander Potapenko
Signed-off-by: Marco Elver
---
v5:
* Move generic page allocation code to core.c [suggested by Jann Horn].
* Remove comment about HAVE_ARCH_KFENCE_STATIC_POOL, since we no longer
support static pools.
* Force page granularity for the
On Thu, 29 Oct 2020 at 18:44, Johannes Berg wrote:
> On Thu, 2020-10-29 at 17:36 +, Aleksandr Nogikh wrote:
> > From: Aleksandr Nogikh
> >
> > Add KCOV remote annotations to ieee80211_iface_work() and
> > ieee80211_rx_list(). This will enable coverage-guided fuzzing of
> > mac80211 code that
On Fri, 30 Oct 2020 at 03:50, Jann Horn wrote:
>
> On Thu, Oct 29, 2020 at 2:17 PM Marco Elver wrote:
> > Add KFENCE test suite, testing various error detection scenarios. Makes
> > use of KUnit for test organization. Since KFENCE's interface to obtain
> > error re
On Fri, 30 Oct 2020 at 03:49, Jann Horn wrote:
> On Thu, Oct 29, 2020 at 2:16 PM Marco Elver wrote:
> > This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a
> > low-overhead sampling-based memory safety error detector of heap
> > use-after-free, inv
On Fri, 30 Oct 2020 at 03:49, Jann Horn wrote:
> On Thu, Oct 29, 2020 at 2:17 PM Marco Elver wrote:
> > Add architecture specific implementation details for KFENCE and enable
> > KFENCE for the x86 architecture. In particular, this implements the
> > required interface i
On Fri, 30 Oct 2020 at 03:50, Jann Horn wrote:
>
> On Thu, Oct 29, 2020 at 2:17 PM Marco Elver wrote:
> > We make KFENCE compatible with KASAN for testing KFENCE itself. In
> > particular, KASAN helps to catch any potential corruptions to KFENCE
> > state, or other c
On Thu, 22 Oct 2020 at 15:19, Andrey Konovalov wrote:
>
> TODO: no meaningful description here yet, please see the cover letter
> for this RFC series.
>
> Signed-off-by: Andrey Konovalov
> Link:
> https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4
> ---
> m
On Fri, 30 Oct 2020 at 16:09, Jann Horn wrote:
>
> On Fri, Oct 30, 2020 at 2:46 PM Marco Elver wrote:
> > On Fri, 30 Oct 2020 at 03:50, Jann Horn wrote:
> > > On Thu, Oct 29, 2020 at 2:17 PM Marco Elver wrote:
> > > > We make KFENCE compatible with KA
On Fri, 30 Oct 2020 at 03:49, Jann Horn wrote:
> On Thu, Oct 29, 2020 at 2:17 PM Marco Elver wrote:
> > Inserts KFENCE hooks into the SLAB allocator.
> [...]
> > diff --git a/mm/slab.c b/mm/slab.c
> [...]
> > @@ -3416,6 +3427,11 @@ static void cache_flusharray(str
On Fri, 30 Oct 2020 at 16:47, Mark Rutland wrote:
>
> On Thu, Oct 29, 2020 at 02:16:43PM +0100, Marco Elver wrote:
> > Add architecture specific implementation details for KFENCE and enable
> > KFENCE for the arm64 architecture. In particular, this implements the
> &g
On Fri, 30 Oct 2020 at 03:49, Jann Horn wrote:
> On Thu, Oct 29, 2020 at 2:17 PM Marco Elver wrote:
> > This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a
> > low-overhead sampling-based memory safety error detector of heap
> > use-after-free, inv
601 - 700 of 1024 matches
Mail list logo