[PATCH v10 02/17] x86_64: add KASan support

2015-01-29 Thread Andrey Ryabinin
function call (__phys_addr) __phys_addr is instrumented, so __asan_load could be called before shadow area initialized. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- Documentation/x86/x86_64/mm.txt | 2 + arch/x86/Kconfig | 1 + arch/x86/boot/Makefile

[PATCH v10 13/17] mm: vmalloc: add flag preventing guard hole allocation

2015-01-29 Thread Andrey Ryabinin
. Add a new vm_struct flag 'VM_NO_GUARD' indicating that vm area doesn't have a guard hole. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- include/linux/vmalloc.h | 9 +++-- mm/vmalloc.c| 6 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include

[PATCH v10 06/17] mm: slub: introduce metadata_access_enable()/metadata_access_disable()

2015-01-29 Thread Andrey Ryabinin
Wrap access to object's metadata in external functions with metadata_access_enable()/metadata_access_disable() function calls. This hooks separates payload accesses from metadata accesses which might be useful for different checkers (e.g. KASan). Signed-off-by: Andrey Ryabinin a.ryabi

[PATCH v10 05/17] mm: slub: share object_err function

2015-01-29 Thread Andrey Ryabinin
Remove static and add function declarations to linux/slub_def.h so it could be used by kernel address sanitizer. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- include/linux/slub_def.h | 3 +++ mm/slub.c| 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff

[PATCH v10 15/17] kernel: add support for .init_array.* constructors

2015-01-29 Thread Andrey Ryabinin
KASan uses constructors for initializing redzones for global variables. Actually KASan doesn't need priorities for constructors, so they were removed from GCC 5.0, but GCC 4.9.2 still generates constructors with priorities. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- include/asm

[PATCH v10 03/17] mm: page_alloc: add kasan hooks on alloc and free paths

2015-01-29 Thread Andrey Ryabinin
Add kernel address sanitizer hooks to mark allocated page's addresses as accessible in corresponding shadow region. Mark freed pages as inaccessible. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- include/linux/kasan.h | 6 ++ mm/compaction.c | 2 ++ mm/kasan/kasan.c

[PATCH v10 04/17] mm: slub: introduce virt_to_obj function.

2015-01-29 Thread Andrey Ryabinin
virt_to_obj takes kmem_cache address, address of slab page, address x pointing somewhere inside slab object, and returns address of the begging of object. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Acked-by: Christoph Lameter c...@linux.com --- include/linux/slub_def.h | 5 + 1

Re: [PATCH v10 06/17] mm: slub: introduce metadata_access_enable()/metadata_access_disable()

2015-01-30 Thread Andrey Ryabinin
2015-01-31 0:42 GMT+03:00 Andrew Morton a...@linux-foundation.org: On Fri, 30 Jan 2015 20:05:13 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: --- a/mm/slub.c +++ b/mm/slub.c @@ -467,13 +467,23 @@ static int slub_debug; static char *slub_debug_slabs; static int

Re: [PATCH v10 17/17] kasan: enable instrumentation of global variables

2015-01-30 Thread Andrey Ryabinin
2015-01-31 0:45 GMT+03:00 Andrew Morton a...@linux-foundation.org: On Fri, 30 Jan 2015 20:47:13 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: +struct kasan_global { + const void *beg;/* Address of the beginning of the global variable. */ + size_t size

Re: [PATCH v10 06/17] mm: slub: introduce metadata_access_enable()/metadata_access_disable()

2015-01-30 Thread Andrey Ryabinin
2015-01-31 2:16 GMT+03:00 Andrew Morton a...@linux-foundation.org: On Sat, 31 Jan 2015 03:11:55 +0400 Andrey Ryabinin ryabinin@gmail.com wrote: kasan_disable_local/kasan_enable_local are also undocumented doesn't help. Ok, How about this? /* * This hooks separate

Re: [PATCH v10 13/17] mm: vmalloc: add flag preventing guard hole allocation

2015-01-30 Thread Andrey Ryabinin
On 01/30/2015 02:12 AM, Andrew Morton wrote: On Thu, 29 Jan 2015 18:11:57 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: For instrumenting global variables KASan will shadow memory backing memory for modules. So on module loading we will need to allocate shadow memory and map

Re: [PATCH v10 17/17] kasan: enable instrumentation of global variables

2015-01-30 Thread Andrey Ryabinin
On 01/30/2015 02:13 AM, Andrew Morton wrote: On Thu, 29 Jan 2015 18:12:01 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: This feature let us to detect accesses out of bounds of global variables. global variables *within modules*, I think? More specificity needed here. Within

Re: [PATCH v10 16/17] module: fix types of device tables aliases

2015-01-30 Thread Andrey Ryabinin
On 01/30/2015 02:13 AM, Andrew Morton wrote: On Thu, 29 Jan 2015 18:12:00 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: MODULE_DEVICE_TABLE() macro used to create aliases to device tables. Normally alias should have the same type as aliased symbol. Device tables are arrays, so

Re: [PATCH v10 02/17] x86_64: add KASan support

2015-01-30 Thread Andrey Ryabinin
2015-01-31 0:37 GMT+03:00 Andrew Morton a...@linux-foundation.org: On Fri, 30 Jan 2015 19:15:42 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: --- a/lib/Kconfig.kasan +++ b/lib/Kconfig.kasan @@ -5,6 +5,7 @@ if HAVE_ARCH_KASAN config KASAN bool AddressSanitizer: runtime

Re: [PATCH v9 01/17] Add kernel address sanitizer infrastructure.

2015-01-23 Thread Andrey Ryabinin
On 01/23/2015 03:35 PM, Michal Marek wrote: On 2015-01-21 17:51, Andrey Ryabinin wrote: +ifdef CONFIG_KASAN_INLINE +call_threshold := 1 +else +call_threshold := 0 +endif Can you please move this to a Kconfig helper like you did with CONFIG_KASAN_SHADOW_OFFSET? Despite

Re: [PATCH v9 00/17] Kernel address sanitizer - runtime memory debugger.

2015-01-23 Thread Andrey Ryabinin
On 01/23/2015 12:46 AM, Sasha Levin wrote: Just to keep it going, here's a funny trace where kasan is catching issues in ubsan: :) Thanks, it turns out to be a GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64741 As a workaround you could put kasan_disable_local()/kasan_enable_local()

[PATCH] net/9p: use memcpy() instead of snprintf() in p9_mount_tag_show()

2015-01-27 Thread Andrey Ryabinin
-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- net/9p/trans_virtio.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index daa749c..9d64145 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -504,7 +504,10

[PATCH] smack: fix possible use after frees in task_security() callers

2015-01-13 Thread Andrey Ryabinin
fc fc fc fc fc fc fc fc fc == Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Cc: sta...@vger.kernel.org --- security/smack/smack.h | 10 ++ security/smack/smack_lsm.c | 24 +--- 2 files

Re: Build breakage for allmodconfig

2015-02-10 Thread Andrey Ryabinin
On 02/09/2015 09:12 PM, Lad, Prabhakar wrote: Hi Andrey, There is build breakage for allmodconfig with commit id kasan: enable instrumentation of global variables f39182cbcd0122ad2c943317b5f07eba91b2cfe5 on linux-next. scripts/kconfig/conf --silentoldconfig Kconfig

[PATCH] x86_64-add-kasan-support-fix

2015-02-10 Thread Andrey Ryabinin
: In function `kasan_init': (.init.text+0xe6ea): undefined reference to `vmemmap_populate' make: *** [vmlinux] Error 1 x86_64-specific part of KASAN depends on SPARSEMEM_VMEMMAP. Express this in Kconfig. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Reported-by: Jim Davis jim.ep

[PATCH] arm: fix integer overflow in ELF_ET_DYN_BASE

2015-03-20 Thread Andrey Ryabinin
/p/address-sanitizer/wiki/AddressSanitizerAlgorithm#Mapping Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Reported-by: Maria Guseva m.gus...@samsung.com Cc: sta...@vger.kernel.org --- arch/arm/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm

Re: [PATCH] arm: fix integer overflow in ELF_ET_DYN_BASE

2015-03-20 Thread Andrey Ryabinin
On 03/20/2015 02:31 PM, Yury Gribov wrote: On 03/20/2015 02:12 PM, Andrey Ryabinin wrote: Usually ELF_ET_DYN_BASE is 2/3 of TASK_SIZE. With 3G/1G user/kernel split this is not so, because 2*TASK_SIZE overflows 32 bits, so the actual value of ELF_ET_DYN_BASE is: (2 * TASK_SIZE / 3

Re: [PATCH] mm: kill kmemcheck

2015-03-11 Thread Andrey Ryabinin
own 'libsanitzer' in kernel. So I'm a little bit bitter about this, as you can see. :) -- Best regards, Andrey Ryabinin -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org

[PATCH 1/2] kasan, x86: move KASAN_SHADOW_OFFSET to the arch Kconfig

2015-03-24 Thread Andrey Ryabinin
KASAN_SHADOW_OFFSET is purely arch specific setting, so it should be in arch's Kconfig file. This simplifies porting KASan to other architectures and maintenance of it. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/x86/Kconfig | 4 lib/Kconfig.kasan | 4 2 files

[PATCH 2/2] arm64: add KASan support

2015-03-24 Thread Andrey Ryabinin
without kasan instrumentation (e.g. mm/slub.c). Original mem* function replaced (via #define) with prefixed variants to disable memory access checks for such files. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/arm64/Kconfig | 7 ++ arch/arm64/include/asm

[PATCH 0/2] KASan for arm64

2015-03-24 Thread Andrey Ryabinin
be done later. Andrey Ryabinin (2): kasan, x86: move KASAN_SHADOW_OFFSET to the arch Kconfig arm64: add KASan support arch/arm64/Kconfig | 7 ++ arch/arm64/include/asm/pgtable.h | 3 +- arch/arm64/include/asm/string.h | 16 +++ arch/arm64/include/asm

[PATCH] x86, UML: fix integer overflow in ELF_ET_DYN_BASE

2015-03-24 Thread Andrey Ryabinin
: (TASK_SIZE / 3 * 2) Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/x86/um/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h index 25a1022..0a656b7 100644 --- a/arch/x86/um/asm/elf.h +++ b/arch/x86/um/asm/elf.h

[PATCH] avr32: fix integer overflow in ELF_ET_DYN_BASE

2015-03-24 Thread Andrey Ryabinin
: (TASK_SIZE / 3 * 2) Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/avr32/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/avr32/include/asm/elf.h b/arch/avr32/include/asm/elf.h index d232888..0388ece 100644 --- a/arch/avr32/include/asm/elf.h

[PATCH] cris: fix integer overflow in ELF_ET_DYN_BASE

2015-03-24 Thread Andrey Ryabinin
: (TASK_SIZE / 3 * 2) Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/cris/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/cris/include/asm/elf.h b/arch/cris/include/asm/elf.h index 30ded8f..c2a394f 100644 --- a/arch/cris/include/asm/elf.h +++ b

Re: [patch v2 4/4] mm, mempool: poison elements backed by page allocator

2015-03-30 Thread Andrey Ryabinin
On 03/27/2015 01:50 AM, David Rientjes wrote: On Thu, 26 Mar 2015, Andrey Ryabinin wrote: +static void check_element(mempool_t *pool, void *element) +{ + /* Mempools backed by slab allocator */ + if (pool-free == mempool_free_slab || pool-free == mempool_kfree

Re: [patch v2 4/4] mm, mempool: poison elements backed by page allocator

2015-03-31 Thread Andrey Ryabinin
On 03/27/2015 01:50 AM, David Rientjes wrote: We don't have a need to set PAGE_EXT_DEBUG_POISON on these pages sitting in the reserved pool, nor do we have a need to do kmap_atomic() since it's already mapped and must be mapped to be on the reserved pool, which is handled by mempool_free().

Re: [patch v2 4/4] mm, mempool: poison elements backed by page allocator

2015-03-26 Thread Andrey Ryabinin
On 03/26/2015 12:55 AM, Andrew Morton wrote: On Tue, 24 Mar 2015 16:10:01 -0700 (PDT) David Rientjes rient...@google.com wrote: Elements backed by the slab allocator are poisoned when added to a mempool's reserved pool. It is also possible to poison elements backed by the page allocator

Re: [RFC] slub memory quarantine

2015-03-03 Thread Andrey Ryabinin
On 03/03/2015 12:10 PM, Dmitry Vyukov wrote: Please hold on with this. Dmitry Chernenkov is working on a quarantine that works with both slub and slab, does not cause spurious OOMs and does not depend on slub-debug which has unacceptable performance (acquires global lock). I think that it's a

Re: [Xen-devel] kasan_map_early_shadow() on Xen

2015-03-03 Thread Andrey Ryabinin
On 03/03/2015 05:16 PM, Konrad Rzeszutek Wilk wrote: On Tue, Mar 03, 2015 at 04:15:06PM +0300, Andrey Ryabinin wrote: On 03/03/2015 12:40 PM, Luis R. Rodriguez wrote: Andrey, I believe that on Xen we should disable kasan, would like confirmation I guess Xen guests won't work with kasan

Re: kasan_map_early_shadow() on Xen

2015-03-03 Thread Andrey Ryabinin
On 03/03/2015 12:40 PM, Luis R. Rodriguez wrote: Andrey, I believe that on Xen we should disable kasan, would like confirmation I guess Xen guests won't work with kasan because Xen guests doesn't setup shadow (kasan_map_early_shadow() is not called in xen guests). Disabling kasan for Xen in

Re: [PATCH] android: binder: fix binder mmap failures

2015-02-27 Thread Andrey Ryabinin
On 02/27/2015 08:26 PM, John Stultz wrote: On Fri, Feb 27, 2015 at 8:30 AM, Andrey Ryabinin a.ryabi...@samsung.com wrote: binder_update_page_range() initializes only addr and size fields in 'struct vm_struct tmp_area;' and passes it to map_vm_area(). Before 71394fe50146 (mm: vmalloc: add

[PATCH] android: binder: fix binder mmap failures

2015-02-27 Thread Andrey Ryabinin
flag preventing guard hole allocation) Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Reported-by: Amit Pundir amit.pun...@linaro.org --- drivers/android/binder.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c

[PATCH v2] android: binder: fix binder mmap failures

2015-02-27 Thread Andrey Ryabinin
flag preventing guard hole allocation) Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Reported-by: Amit Pundir amit.pun...@linaro.org --- Changes since v1: - fixed ret check after map_kernel_ranges_noflush(). drivers/android/binder.c | 10 +- 1 file changed, 5 insertions(+), 5

Re: [PATCH] kasan, module, vmalloc: rework shadow allocation for modules

2015-02-27 Thread Andrey Ryabinin
On 02/26/2015 04:30 AM, Rusty Russell wrote: Andrey Ryabinin a.ryabi...@samsung.com writes: On 02/25/2015 09:25 AM, Rusty Russell wrote: Andrey Ryabinin a.ryabi...@samsung.com writes: On 02/23/2015 11:26 AM, Rusty Russell wrote: Andrey Ryabinin a.ryabi...@samsung.com writes: On 02/20/2015 03

[PATCH 1/2] kasan, module, vmalloc: rework shadow allocation for modules

2015-02-27 Thread Andrey Ryabinin
before releasing vm area. At this point vfree()'d memory is not used anymore and yet not available for other allocations. New VM_KASAN flag used to indicate that vm area has dynamically allocated shadow memory so kasan frees shadow only if it was previously allocated. Signed-off-by: Andrey

[PATCH 2/2] kasan, module: move MODULE_ALIGN macro into linux/moduleloader.h

2015-02-27 Thread Andrey Ryabinin
include/linux/moduleloader.h is more suitable place for this macro. Also change alignment to PAGE_SIZE for CONFIG_KASAN=n as such alignment already assumed in several places. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Cc: Dmitry Vyukov dvyu...@google.com Cc: Rusty Russell ru

Re: [Xen-devel] kasan_map_early_shadow() on Xen

2015-03-04 Thread Andrey Ryabinin
On 03/03/2015 07:02 PM, Konrad Rzeszutek Wilk wrote: On Tue, Mar 03, 2015 at 06:38:20PM +0300, Andrey Ryabinin wrote: On 03/03/2015 05:16 PM, Konrad Rzeszutek Wilk wrote: On Tue, Mar 03, 2015 at 04:15:06PM +0300, Andrey Ryabinin wrote: On 03/03/2015 12:40 PM, Luis R. Rodriguez wrote: Andrey

[RFC] slub memory quarantine

2015-03-03 Thread Andrey Ryabinin
Hi. One of the main problems in detecting use after free bugs is memory reuse. Freed could be quickly reallocated. Neither KASan nor slub poisoning could detect use after free after reallocation. Memory quarantine is aimed to solve this problem by delaying as much as possible actual freeing of

Re: [PATCH] kasan, module, vmalloc: rework shadow allocation for modules

2015-02-24 Thread Andrey Ryabinin
On 02/23/2015 11:26 AM, Rusty Russell wrote: Andrey Ryabinin a.ryabi...@samsung.com writes: On 02/20/2015 03:15 AM, Rusty Russell wrote: Andrey Ryabinin a.ryabi...@samsung.com writes: On 02/19/2015 02:10 AM, Rusty Russell wrote: This is not portable. Other archs don't use vmalloc, or don't

Re: [PATCH] kasan, module, vmalloc: rework shadow allocation for modules

2015-02-24 Thread Andrey Ryabinin
On 02/25/2015 09:25 AM, Rusty Russell wrote: Andrey Ryabinin a.ryabi...@samsung.com writes: On 02/23/2015 11:26 AM, Rusty Russell wrote: Andrey Ryabinin a.ryabi...@samsung.com writes: On 02/20/2015 03:15 AM, Rusty Russell wrote: Andrey Ryabinin a.ryabi...@samsung.com writes: On 02/19/2015 02

Re: [patch v2 4/4] mm, mempool: poison elements backed by page allocator

2015-03-26 Thread Andrey Ryabinin
2015-03-25 2:10 GMT+03:00 David Rientjes rient...@google.com: ... + +static void check_element(mempool_t *pool, void *element) +{ + /* Mempools backed by slab allocator */ + if (pool-free == mempool_free_slab || pool-free == mempool_kfree) + __check_element(pool,

Re: [PATCH] arm: fix integer overflow in ELF_ET_DYN_BASE

2015-03-26 Thread Andrey Ryabinin
On 03/26/2015 06:05 PM, Russell King - ARM Linux wrote: On Fri, Mar 20, 2015 at 02:12:52PM +0300, Andrey Ryabinin wrote: Usually ELF_ET_DYN_BASE is 2/3 of TASK_SIZE. With 3G/1G user/kernel split this is not so, because 2*TASK_SIZE overflows 32 bits, so the actual value of ELF_ET_DYN_BASE

Re: [x86_64/KASan] RIP: 0010:[ffffffff811ee644] [ffffffff811ee644] get_node_info

2015-03-23 Thread Andrey Ryabinin
On 03/23/2015 04:25 AM, Fengguang Wu wrote: Greetings, 0day kernel testing robot got the below dmesg and the first bad commit is Could you please send me your config ? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to

[PATCH] gcov: fix softlockups

2015-04-02 Thread Andrey Ryabinin
00 00 00 00 00 fc ff df 48 8d 04 17 48 ff 05 da f5 c2 0c 48 89 e5 5d c3 55 48 ff 05 f5 fe c2 0c 48 89 e5 5d c3 55 48 ff 05 f0 fe c2 [ 72.460068] Kernel panic - not syncing: softlockup: hung tasks Fix this by sticking cond_resched() in gcov_enable_events(). Signed-off-by: Andrey Ryabinin a.ryabi

[PATCH] mm, mempool: kasan: poison mempool elements

2015-04-03 Thread Andrey Ryabinin
-after-free of mempool's elements. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- include/linux/kasan.h | 2 ++ mm/kasan/kasan.c | 13 + mm/mempool.c | 23 +++ 3 files changed, 38 insertions(+) diff --git a/include/linux/kasan.h b/include

Re: [git pull] vfs part 2

2015-04-23 Thread Andrey Ryabinin
On 04/15/2015 09:14 PM, Al Viro wrote: 9p: switch p9_client_write() to passing it struct iov_iter * Hi Al, This change caused following: [ 91.637917] == [ 91.639252] BUG: KASan: out of bounds on stack in

[PATCH] arm64: Implement 1-,2- byte smp_load_acquire and smp_store_release

2015-04-20 Thread Andrey Ryabinin
smp_load_acquire() to load 2-bytes csd-flags. That crashes arm64 kernel during the boot. Implement 1,2 byte cases in arm64's smp_load_acquire() and smp_store_release() to fix this. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/arm64/include/asm/barrier.h | 16 1

Re: [PATCH] kasan: Remove duplicate definition of the macro KASAN_FREE_PAGE

2015-04-22 Thread Andrey Ryabinin
On 04/22/2015 09:23 AM, Wang Long wrote: This patch just remove duplicate definition of the macro KASAN_FREE_PAGE in mm/kasan/kasan.h Signed-off-by: Wang Long long.wangl...@huawei.com Acked-by: Andrey Ryabinin a.ryabi...@samsung.com --- mm/kasan/kasan.h | 1 - 1 file changed, 1 deletion

Re: [PATCH 2/2] arm64: add KASan support

2015-04-20 Thread Andrey Ryabinin
On 04/17/2015 09:39 PM, David Keitel wrote: On 04/15/2015 11:04 AM, Andrey Ryabinin wrote: I've pushed the most fresh thing that I have in git: git://github.com/aryabinin/linux.git kasan/arm64v1 It's the same patches with two simple but important fixes on top of it. Thanks, the two

Re: [PATCH v2] kasan: Show gcc version requirements in Kconfig and Documentation

2015-05-07 Thread Andrey Ryabinin
2015-05-07 18:51 GMT+03:00 Jonathan Corbet cor...@lwn.net: On Fri, 17 Apr 2015 19:10:57 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: From: Joe Perches j...@perches.com The documentation shows a need for gcc 4.9.2, but it's really =. The Kconfig entries don't show require versions

[PATCH v2 5/5] arm64: add KASan support

2015-05-15 Thread Andrey Ryabinin
without kasan instrumentation (e.g. mm/slub.c). Original mem* function replaced (via #define) with prefixed variants to disable memory access checks for such files. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/arm64/Kconfig | 7 ++ arch/arm64/include/asm/kasan.h

[PATCH v2 4/5] kasan, x86: move populate_zero_shadow() out of arch directory

2015-05-15 Thread Andrey Ryabinin
populate_zero_shadow() is cross-platform now. Rename it to kasan_populate_zero_shadow() and move to the generic code. No functional changes here. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/x86/include/asm/kasan.h | 10 ++-- arch/x86/mm/kasan_init_64.c | 137

[PATCH v2 2/5] x86: kasan: fix types in kasan page tables declarations

2015-05-15 Thread Andrey Ryabinin
Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/x86/include/asm/kasan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/kasan.h b/arch/x86/include/asm/kasan.h index 8b22422..b766c55 100644 --- a/arch/x86/include/asm/kasan.h +++ b/arch

[PATCH v2 0/5] KASan for arm64

2015-05-15 Thread Andrey Ryabinin
, including: add missing arm64/include/asm/kasan.h add tlb flush after changing ttbr1 - Add code comments. Andrey Ryabinin (5): kasan, x86: move KASAN_SHADOW_OFFSET to the arch Kconfig x86: kasan: fix types in kasan page tables declarations x86: kasan: generalize

[PATCH v2 1/5] kasan, x86: move KASAN_SHADOW_OFFSET to the arch Kconfig

2015-05-15 Thread Andrey Ryabinin
KASAN_SHADOW_OFFSET is purely arch specific setting, so it should be in arch's Kconfig file. This simplifies porting KASan to other architectures and maintenance of it. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/x86/Kconfig | 4 lib/Kconfig.kasan | 4 2 files

[PATCH v2 3/5] x86: kasan: generalize populate_zero_shadow() code

2015-05-15 Thread Andrey Ryabinin
memblock allocator directly instead of vmemmap_alloc_block() Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/x86/mm/kasan_init_64.c | 115 +++- 1 file changed, 72 insertions(+), 43 deletions(-) diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86

Re: [PATCH v2 1/5] kasan, x86: move KASAN_SHADOW_OFFSET to the arch Kconfig

2015-05-18 Thread Andrey Ryabinin
On 05/16/2015 02:27 PM, Paul Bolle wrote: On Fri, 2015-05-15 at 16:59 +0300, Andrey Ryabinin wrote: --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig +config KASAN_SHADOW_OFFSET +hex +default 0xdc00 This sets CONFIG_KASAN_SHADOW_OFFSET for _all_ X86 configurations

Re: [PATCH 2/2] arm64: add KASan support

2015-04-15 Thread Andrey Ryabinin
On 04/15/2015 05:37 AM, David Keitel wrote: + pgd = __pgd(__pa(kasan_zero_pmd) | PAGE_KERNEL); +#else + pgd = __pgd(__pa(kasan_zero_pte) | PAGE_KERNEL); +#endif + + for (i = pgd_index(start); start end; i++) { + set_pgd(pgdp[i], pgd); + start += PGDIR_SIZE; + } +}

Re: [PATCH] kasan: Show gcc version requirements in Kconfig and Documentation

2015-04-17 Thread Andrey Ryabinin
On 04/17/2015 07:44 AM, Joe Perches wrote: The documentation shows a need for gcc 4.9.2, but it's really =. The Kconfig entries don't show require versions so add them. Correct a latter/later typo too. Signed-off-by: Joe Perches j...@perches.com --- (dropping Ingo from cc's) On

Re: [PATCH 07/18 v3] tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values

2015-04-17 Thread Andrey Ryabinin
On 04/17/2015 06:59 AM, Sasha Levin wrote: On 04/16/2015 11:21 PM, Steven Rostedt wrote: On Wed, 15 Apr 2015 20:58:31 -0400 Sasha Levin sasha.le...@oracle.com wrote: On 04/15/2015 10:05 AM, Steven Rostedt wrote: On Wed, 15 Apr 2015 09:22:37 -0400 Sasha Levin sasha.le...@oracle.com wrote:

Re: [PATCH 07/18 v3] tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values

2015-04-17 Thread Andrey Ryabinin
On 04/17/2015 04:51 PM, Steven Rostedt wrote: On Fri, 17 Apr 2015 09:29:02 -0400 Steven Rostedt rost...@goodmis.org wrote: On Fri, 17 Apr 2015 10:44:42 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: And kasan is not needed to debug this further. Just stick WARN_ON(ptr call

[PATCH v2] kasan: Show gcc version requirements in Kconfig and Documentation

2015-04-17 Thread Andrey Ryabinin
. Signed-off-by: Joe Perches j...@perches.com Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- Documentation/kasan.txt | 8 +--- lib/Kconfig.kasan | 8 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Documentation/kasan.txt b/Documentation/kasan.txt index

Re: [PATCH] mm, mempool: kasan: poison mempool elements

2015-04-06 Thread Andrey Ryabinin
On 04/04/2015 01:07 AM, Andrew Morton wrote: On Fri, 03 Apr 2015 17:47:47 +0300 Andrey Ryabinin a.ryabi...@samsung.com wrote: Mempools keep allocated objects in reserved for situations when ordinary allocation may not be possible to satisfy. These objects shouldn't be accessed before

[PATCH] kasan: Makefile: shut up warnings if CONFIG_COMPILE_TEST=y

2015-04-08 Thread Andrey Ryabinin
It might be annoying to constantly see this: scripts/Makefile.kasan:16: Cannot use CONFIG_KASAN: -fsanitize=kernel-address is not supported by compiler while performing allmodconfig/allyesconfig build tests. Disable this warning if CONFIG_COMPILE_TEST=y. Signed-off-by: Andrey Ryabinin

Re: [PATCH] kasan: Makefile: shut up warnings if CONFIG_COMPILE_TEST=y

2015-04-09 Thread Andrey Ryabinin
On 04/09/2015 02:06 PM, Paul Bolle wrote: On Wed, 2015-04-08 at 18:38 +0300, Andrey Ryabinin wrote: It might be annoying to constantly see this: scripts/Makefile.kasan:16: Cannot use CONFIG_KASAN: -fsanitize=kernel-address is not supported by compiler while performing allmodconfig

Re: [PATCH 2/2] arm64: add KASan support

2015-04-03 Thread Andrey Ryabinin
On 04/01/2015 03:28 PM, Catalin Marinas wrote: Hi Andrey, Hi Catalin, On Tue, Mar 24, 2015 at 05:49:04PM +0300, Andrey Ryabinin wrote: diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 4085df1..10bbd71 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -41,6 +41,7

Re: [PATCH v4 1/1] x86_64: fix KASan shadow region page tables

2015-06-03 Thread Andrey Ryabinin
. -- From: Andrey Ryabinin a.ryabi...@samsung.com Subject: [PATCH] x86_64: remove not needed clear_page for init_level4_page Commit 8170e6bed465 (x86, 64bit: Use a #PF handler to materialize early mappings on demand) introduced clear_page(init_level4_pgt); call in x86_64_start_kernel(). However

Re: [PATCH v4 1/1] x86_64: fix KASan shadow region page tables

2015-06-03 Thread Andrey Ryabinin
On 06/03/2015 05:10 PM, Alexander Popov wrote: Hello Ingo and Andrey. Should I make a patch series containing Andrey's patch and the 5'th version of my patch or just include changes from Andrey's patch into mine? These patches contain logically separate changes, so please don't fold them

Re: [PATCH v6 1/1] x86_64: fix KASan shadow region page tables

2015-06-18 Thread Andrey Ryabinin
, it shouldn't crash. I see on problem which should be fixed by patch below. Could you please try it? --- From: Andrey Ryabinin a.ryabi...@samsung.com Subject: [PATCH] x86_64: kasan: flush tlbs after switching cr3 load_cr3() doesn't cause tlb_flush if PGE enabled. This may cause tons of false positive reports

Re: [PATCH 3/3] x86_64: kasan: add message about kasan being initialized

2015-06-22 Thread Andrey Ryabinin
On 06/20/2015 04:18 PM, Ingo Molnar wrote: Please call it 'kasan' or 'KASAN', and also explain it in the message and prefix it properly with the subsystem name (kasan), so something like: pr_info(kasan: Kernel Address SANitizer (KASAN) initialized\n); Other kasan messages should

Re: [git pull] vfs part 2

2015-06-22 Thread Andrey Ryabinin
On 06/22/2015 12:12 AM, Al Viro wrote: On Thu, Apr 23, 2015 at 01:16:15PM +0300, Andrey Ryabinin wrote: This change caused following: This could happen when p9pdu_readf() changes 'count' to some value iov_iter_count(from): p9_client_write(): ... int count = iov_iter_count

Re: [PATCH v6 1/1] x86_64: fix KASan shadow region page tables

2015-06-18 Thread Andrey Ryabinin
On 06/18/2015 05:55 PM, Borislav Petkov wrote: On Thu, Jun 18, 2015 at 03:22:25PM +0300, Andrey Ryabinin wrote: Whatever compiler you use, it shouldn't crash. I see on problem which should be fixed by patch below. Could you please try it? Just did. No change. So this is a separate issue

Re: [PATCH v6 1/1] x86_64: fix KASan shadow region page tables

2015-06-19 Thread Andrey Ryabinin
On 06/19/2015 03:06 PM, Borislav Petkov wrote: On Fri, Jun 19, 2015 at 02:49:19PM +0300, Andrey Ryabinin wrote: I guess that AMD cpus is more strict (unlike Intel) about violation of reserved/unused bits in page table entries. Please, try with this patch. With that the guest boots. Great

Re: [PATCH v6 1/1] x86_64: fix KASan shadow region page tables

2015-06-19 Thread Andrey Ryabinin
On 06/19/2015 05:00 PM, Ingo Molnar wrote: That's a way too obscure mechanism just to determine whether the right kernel config was booted. Please add a printk(), ok? Sure, will do. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in Please read the FAQ at

Re: [PATCH v6 1/1] x86_64: fix KASan shadow region page tables

2015-06-19 Thread Andrey Ryabinin
On 06/18/2015 07:38 PM, Borislav Petkov wrote: On Thu, Jun 18, 2015 at 07:05:04PM +0300, Andrey Ryabinin wrote: What qemu version do you use and how you run it (qemu's command line options)? Here it is: -cpu Opteron_G5 I guess that AMD cpus is more strict (unlike Intel) about violation

Re: [PATCH v2 5/5] arm64: add KASan support

2015-06-17 Thread Andrey Ryabinin
2015-06-13 18:25 GMT+03:00 Linus Walleij linus.wall...@linaro.org: On Fri, Jun 12, 2015 at 8:14 PM, Andrey Ryabinin ryabinin@gmail.com wrote: 2015-06-11 16:39 GMT+03:00 Linus Walleij linus.wall...@linaro.org: On Fri, May 15, 2015 at 3:59 PM, Andrey Ryabinin a.ryabi...@samsung.com

Re: [PATCH v5 1/2] x86_64: remove not needed clear_page for init_level4_page

2015-06-16 Thread Andrey Ryabinin
On 06/16/2015 02:34 PM, Borislav Petkov wrote: On Tue, Jun 16, 2015 at 01:16:32PM +0200, Borislav Petkov wrote: Now my hunch is that those entries get overwritten later but I wouldn't want to debug any strange bugs from leftovers in init_level4_pgt so having the clear_page() is actually a good

Re: [PATCH v5 2/2] x86_64: fix KASan shadow region page tables

2015-06-12 Thread Andrey Ryabinin
tables in kasan_early_init() using __pa_nodebug() which considers phys_base. Signed-off-by: Alexander Popov alpo...@ptsecurity.com Acked-by: Andrey Ryabinin a.ryabi...@samsung.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord

Re: [PATCH v2 5/5] arm64: add KASan support

2015-06-12 Thread Andrey Ryabinin
2015-06-11 16:39 GMT+03:00 Linus Walleij linus.wall...@linaro.org: On Fri, May 15, 2015 at 3:59 PM, Andrey Ryabinin a.ryabi...@samsung.com wrote: This patch adds arch specific code for kernel address sanitizer (see Documentation/kasan.txt). I looked closer at this again ... I am trying

Re: [PATCH v2 1/1] x86_64: fix KASan shadow region page tables

2015-05-29 Thread Andrey Ryabinin
On 05/29/2015 04:46 PM, Alexander Popov wrote: KASan shadow region page tables can't be filled statically because physical addresses in these page tables depend on phys_base. Initialize KASan shadow region page tables in kasan_early_init(). Signed-off-by: Alexander Popov

Re: [PATCH v3 1/1] x86_64: fix KASan shadow region page tables

2015-05-29 Thread Andrey Ryabinin
alpo...@ptsecurity.com Acked-by: Andrey Ryabinin a.ryabi...@samsung.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http

Re: [git pull] vfs part 2

2015-07-01 Thread Andrey Ryabinin
On 07/01/2015 11:27 AM, Al Viro wrote: Could you check if 3.19 was getting anything similar? I.e. in p9_client_write() there add if (count rsize) printk(KERN_ERR bogus RWRITE: %d - %d\n, rsize, count); just before p9_debug(P9_DEBUG_9P, RWRITE count %d\n,

Re: [git pull] vfs part 2

2015-07-01 Thread Andrey Ryabinin
On 07/01/2015 11:55 AM, Al Viro wrote: On Wed, Jul 01, 2015 at 11:41:04AM +0300, Andrey Ryabinin wrote: On 07/01/2015 11:27 AM, Al Viro wrote: Could you check if 3.19 was getting anything similar? I.e. in p9_client_write() there add if (count rsize) printk(KERN_ERR bogus

Re: [PATCH 1/5] x86_64: fix kasan shadow region page tables

2015-07-01 Thread Andrey Ryabinin
On 07/01/2015 12:07 PM, Ingo Molnar wrote: * Andrey Ryabinin a.ryabi...@samsung.com wrote: diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 5a46681..f129a9a 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -161,11 +161,12 @@ asmlinkage

[PATCH 4/5] x86_64: kasan: add message about kasan being initialized

2015-06-30 Thread Andrey Ryabinin
Print informational message to tell user that kernel runs with kasan enabled. Add kasan: prefix to all messages in kasan_init_64.c Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/x86/mm/kasan_init_64.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/mm

[PATCH 5/5] x86_64: kasan: move KASAN_SHADOW_OFFSET to the arch Kconfig

2015-06-30 Thread Andrey Ryabinin
KASAN_SHADOW_OFFSET is purely arch specific setting, so it should be in arch's Kconfig file. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Cc: Paul Bolle pebo...@tiscali.nl --- arch/x86/Kconfig | 5 + lib/Kconfig.kasan | 4 2 files changed, 5 insertions(+), 4 deletions(-) diff

[PATCH 3/5] x86_64: kasan: fix boot crash on AMD processors

2015-06-30 Thread Andrey Ryabinin
cause any troubles on Intel cpus, while on AMDs it cause kernel crash on boot. Use _KERNPG_TABLE bits for pgds/puds/pmds to fix this. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Reported-by: Borislav Petkov b...@alien8.de Cc: sta...@vger.kernel.org # 4.0 --- arch/x86/mm/kasan_init_64.c

[PATCH 2/5] x86_64: kasan: flush tlbs after switching cr3

2015-06-30 Thread Andrey Ryabinin
load_cr3() doesn't cause tlb_flush if PGE enabled. This may cause tons of false positive reports spamming kernel to death. To fix this __flush_tlb_all() should be called explicitly after cr3 changed. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Cc: sta...@vger.kernel.org # 4.0 --- arch

[PATCH 1/5] x86_64: fix kasan shadow region page tables

2015-06-30 Thread Andrey Ryabinin
stopped bringing much profit to the code readability. Otherwise describing all the new order dependencies would be too verbose. Signed-off-by: Alexander Popov alpo...@ptsecurity.com Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Cc: sta...@vger.kernel.org # 4.0 --- arch/x86/include/asm/kasan.h

[PATCH RESEND 0/5] x86_64 kasan fixes

2015-06-30 Thread Andrey Ryabinin
and with stable tag. Plus trivial patch that moves config option into a proper place. Alexander Popov (1): x86_64: fix kasan shadow region page tables Andrey Ryabinin (4): x86_64: kasan: flush tlbs after switching cr3 x86_64: kasan: fix boot crash on AMD processors x86_64: kasan: add message about

Re: [git pull] vfs part 2

2015-07-01 Thread Andrey Ryabinin
On 07/01/2015 09:27 AM, Al Viro wrote: On Mon, Jun 22, 2015 at 03:02:11PM +0300, Andrey Ryabinin wrote: On 06/22/2015 12:12 AM, Al Viro wrote: On Thu, Apr 23, 2015 at 01:16:15PM +0300, Andrey Ryabinin wrote: This change caused following: This could happen when p9pdu_readf() changes 'count

Re: running out of tags in 9P (was Re: [git pull] vfs part 2)

2015-07-02 Thread Andrey Ryabinin
On 07/02/2015 10:59 AM, Al Viro wrote: On Thu, Jul 02, 2015 at 10:50:05AM +0300, Andrey Ryabinin wrote: and see if it triggers. I'm not sure if failing with ENOMEM is the right response (another variant is to sleep there until the pile gets cleaned or until we get killed), and WARN_ON_ONCE

Re: running out of tags in 9P (was Re: [git pull] vfs part 2)

2015-07-02 Thread Andrey Ryabinin
[repeating, since my previous email didn't reach mailing lists] 2015-07-02 7:10 GMT+03:00 Al Viro v...@zeniv.linux.org.uk: It should be easy to confirm - in p9_client_prepare_req() add if (WARN_ON_ONCE(tag != (u16)tag)) { p9_idpool_put(tag, c-tagpool);

[PATCH v2 6/6] x86_64: kasan: move KASAN_SHADOW_OFFSET to the arch Kconfig

2015-07-02 Thread Andrey Ryabinin
KASAN_SHADOW_OFFSET is purely arch specific setting, so it should be in arch's Kconfig file. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com Cc: Paul Bolle pebo...@tiscali.nl --- arch/x86/Kconfig | 5 + lib/Kconfig.kasan | 4 2 files changed, 5 insertions(+), 4 deletions(-) diff

[PATCH v2 5/6] x86_64: kasan: add message about kasan being initialized

2015-07-02 Thread Andrey Ryabinin
Print informational message to tell user that kernel runs with kasan enabled. Add kasan: prefix to all messages in kasan_init_64. Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com --- arch/x86/mm/kasan_init_64.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/mm

<    3   4   5   6   7   8   9   10   11   12   >