Fwd: Potential out-of-bounds in ftrace_regex_release

2013-10-02 Thread Andrey Konovalov
Hi! I am working on AddressSanitizer -- a tool that detects use-after-free and out-of-bounds bugs (https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel). Below is one of the bug reports that I got while running trinity syscall fuzzer. Kernel is built on revision d8efd82eece89

Re: Fwd: Potential out-of-bounds in ftrace_regex_release

2013-10-02 Thread Andrey Konovalov
On Wed, Oct 2, 2013 at 10:57 PM, Dave Jones wrote: > And that's the cause. I wonder what was being opened. > Do you happen to have a trinity-child log for that thread ? Unfortunately not. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord

Re: Fwd: Potential out-of-bounds in ftrace_regex_release

2013-10-09 Thread Andrey Konovalov
I got one more report of a similar bug: AddressSanitizer: heap-buffer-overflow on address 8800205f0e40 Write of size 1 by thread T14005: [] ftrace_event_write+0xe2/0x130 ./kernel/trace/trace_events.c:583 [] vfs_write+0x127/0x2f0 ??:0 [] SyS_write+0x72/0xd0 ??:0 [] system_call_fastpath+0x16

[PATCH] kcov: properly check if we are in an interrupt

2016-09-23 Thread Andrey Konovalov
in_interrupt() returns a nonzero value when we are either in an interrupt or have bh disabled via local_bh_disable(). Since we are interested in only ignoring coverage from actual interrupts, do a proper check of whether we are really in an interrupt. Signed-off-by: Andrey Konovalov --- It would

Re: net/ipv6: GPF in rt6_ifdown

2017-06-21 Thread Andrey Konovalov
On Wed, Jun 21, 2017 at 2:08 PM, Andrey Konovalov wrote: > Hi, > > I've got the following error report while fuzzing the kernel with syzkaller. > > On commit 9705596d08ac87c18aee32cc97f2783b7d14624e (4.12-rc6+). > > It might be related to: > https://groups.googl

Re: net/ipv6: GPF in rt6_ifdown

2017-06-21 Thread Andrey Konovalov
On Wed, Jun 21, 2017 at 3:09 PM, Andrey Konovalov wrote: > On Wed, Jun 21, 2017 at 2:08 PM, Andrey Konovalov > wrote: >> Hi, >> >> I've got the following error report while fuzzing the kernel with syzkaller. >> >> On commit 9705596d08ac87c18aee32cc97f278

tty: possible deadlock in tty_buffer_flush

2017-05-29 Thread Andrey Konovalov
Hi, I've got the following error report while fuzzing the kernel with syzkaller. On commit 5ed02dbb497422bf225783f46e6eadd237d23d6b (4.12-rc3). == WARNING: possible circular locking dependency detected 4.12.0-rc3+ #369 Not tainted -

[PATCH] media: pvrusb2: properly check endpoint types

2017-11-02 Thread Andrey Konovalov
ff ff 48 8d b8 98 00 00 00 e8 ee 82 89 fe 45 89 e8 44 89 f1 4c 89 fa 48 89 c6 48 c7 c7 40 c0 ea 86 e8 30 1b dc fc <0f> ff e9 9b f7 ff ff e8 aa 95 25 fd e9 80 f7 ff ff e8 50 74 f3 ---[ end trace 6919030503719da6 ]--- Signed-off-by: Andrey Konovalov --- drivers/media/usb/pvrusb2/pvrusb2-hdw.

Re: [PATCH] media: pvrusb2: properly check endpoint types

2017-11-02 Thread Andrey Konovalov
On Thu, Nov 2, 2017 at 2:52 PM, Andrey Konovalov wrote: > As syzkaller detected, pvrusb2 driver submits bulk urb withount checking > the the endpoint type is actually blunk. Add a check. > > usb 1-1: BOGUS urb xfer, pipe 3 != type 1 > [ cut here ] > W

[PATCH] media: dib0700: fix invalid dvb_detach argument

2017-11-02 Thread Andrey Konovalov
24 48 89 c7 e8 48 ea ff ff bf 01 00 00 00 e8 de 20 e3 ff 65 8b 05 b7 2f c2 7e 85 c0 75 c9 e8 f9 0b c1 ff eb c2 <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 b8 00 00 RIP: symbol_put_addr+0x54/0x60 RSP: 88006a7ce210 ---[ end trace b75b357739e7e116 ]--- Signed-off-by: Andr

Re: usb/misc/ims-pcu: slab-out-of-bounds in ims_pcu_parse_cdc_data

2017-11-02 Thread Andrey Konovalov
On Sat, Oct 7, 2017 at 8:14 PM, Dmitry Torokhov wrote: > On Thu, Sep 28, 2017 at 01:35:51PM +0200, Andrey Konovalov wrote: >> Hi! >> >> I've got the following report while fuzzing the kernel with syzkaller. >> >> On commit dc972a67cc54585bd83ad811c4e9b6ab

Re: usb/misc/ims-pcu: slab-out-of-bounds in ims_pcu_parse_cdc_data

2017-11-02 Thread Andrey Konovalov
On Thu, Nov 2, 2017 at 5:25 PM, Dmitry Torokhov wrote: > Hi Andrey, > > On Thu, Nov 2, 2017 at 9:13 AM, Andrey Konovalov > wrote: >> On Sat, Oct 7, 2017 at 8:14 PM, Dmitry Torokhov >> wrote: >>> On Thu, Sep 28, 2017 at 01:35:51PM +0200, Andrey Konovalov wrote

[PATCH] net: usb: asix: fill null-ptr-deref in asix_suspend

2017-11-02 Thread Andrey Konovalov
+0x76/0xc0 RSP: 88006bbae718 ---[ end trace dfc4f5649284342c ]--- Signed-off-by: Andrey Konovalov --- drivers/net/usb/asix_devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index b2ff88e69a81..743416be84f3 100644

Re: [PATCH] Input: gtco - fix potential out-of-bound access

2017-10-24 Thread Andrey Konovalov
On Tue, Oct 24, 2017 at 7:28 AM, Dmitry Torokhov wrote: > parse_hid_report_descriptor() has a while (i < length) loop, which > only guarantees that there's at least 1 byte in the buffer, but the > loop body can read multiple bytes which causes out-of-bounds access. > &

Re: usb/media/dtt200u: use-after-free in __dvb_frontend_free

2017-10-24 Thread Andrey Konovalov
On Mon, Oct 23, 2017 at 8:58 PM, Matthias Schwarzott wrote: > Am 23.10.2017 um 16:41 schrieb Andrey Konovalov: >> Hi! >> >> I've got the following report while fuzzing the kernel with syzkaller. >> >> On commit 3e0cc09a3a2c40ec1ffb6b4e12da86e98feccb11 (4.14-r

Re: [RFT] media: dvb_frontend: Fix use-after-free in __dvb_frontend_free

2017-10-24 Thread Andrey Konovalov
contain the commit that seems to have caused the bug (ead666000a5fe34bdc82d61838e4df2d416ea15e). Thanks! > > Signed-off-by: Arvind Yadav > --- > This bug report by Andrey Konovalov (usb/media/dtt200u: use-after-free > in __dvb_frontend_free). > > drivers/media/dvb-core/d

usb/net/asix: kernel hang in asix_phy_reset

2017-10-24 Thread Andrey Konovalov
Hi! While fuzzing the kernel with syzkaller I've been getting kernel hangs within the asix driver. On commit 6cff0a118f23b98c604a3604ea9de11338e24fbe (4.14-rc6+). As far as I can tell the issue is that asix_phy_reset() doesn't enforce proper timeout. asix_phy_reset() calls asix_mdio_read() in a

Re: usb/net/asix: kernel hang in asix_phy_reset

2017-10-24 Thread Andrey Konovalov
On Tue, Oct 24, 2017 at 4:59 PM, Andrey Konovalov wrote: > Hi! > > While fuzzing the kernel with syzkaller I've been getting kernel hangs > within the asix driver. > > On commit 6cff0a118f23b98c604a3604ea9de11338e24fbe (4.14-rc6+). > > As far as I can tell the

Re: [PATCH] Input: gtco - fix potential out-of-bound access

2017-10-25 Thread Andrey Konovalov
On Tue, Oct 24, 2017 at 6:39 PM, Dmitry Torokhov wrote: > On Tue, Oct 24, 2017 at 01:04:03PM +0200, Andrey Konovalov wrote: >> On Tue, Oct 24, 2017 at 7:28 AM, Dmitry Torokhov >> wrote: >> > parse_hid_report_descriptor() has a while (i < length) loop, which >>

usb/net/hfa384x: WARNING in submit_rx_urb/usb_submit_urb

2017-11-03 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 3a99df9a3d14cd866b5516f8cba515a3bfd554ab (4.14-rc7+). Looks like there's no check for the actual endpoint types. usb 1-1: BOGUS urb xfer, pipe 3 != type 1 [ cut here ] WARNING: CPU: 1 PI

usb/media/pvrusb2: WARNING in pvr2_i2c_core_done/sysfs_remove_group

2017-11-03 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 3a99df9a3d14cd866b5516f8cba515a3bfd554ab (4.14-rc7+). pvrusb2: Hardware description: OnAir Creator Hybrid USB tuner pvrusb2: Invalid write control endpoint ... pvrusb2: Invalid write control endpoint pvrusb2: Mo

usb/sound/usx2y: WARNING in usb_stream_start

2017-11-03 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 3a99df9a3d14cd866b5516f8cba515a3bfd554ab (4.14-rc7+). Looks like there's no check for the actual endpoint types. usb 1-1: BOGUS urb xfer, pipe 0 != type 3 [ cut here ] WARNING: CPU: 0 PI

net/media/em28xx: use-after-free in v4l2_fh_init

2017-11-03 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 3a99df9a3d14cd866b5516f8cba515a3bfd554ab (4.14-rc7+). em28xx 1-1:0.0: analog set to bulk mode. em28xx 1-1:0.0: Registering V4L2 extension usb 1-1: USB disconnect, device number 39 em28xx 1-1:0.0: Disconnecting e

usb/media/dw2102: null-ptr-deref in dvb_usb_adapter_frontend_init/tt_s2_4600_frontend_attach

2017-11-03 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 3a99df9a3d14cd866b5516f8cba515a3bfd554ab (4.14-rc7+). The report is a little confusing, as the top stack frame is not actually present. As far as my debugging showed, the NULL pointer that's being executed actua

Re: usb/sound/usx2y: WARNING in usb_stream_start

2017-11-06 Thread Andrey Konovalov
On Mon, Nov 6, 2017 at 10:56 AM, Takashi Iwai wrote: > On Fri, 03 Nov 2017 20:52:49 +0100, > Takashi Iwai wrote: >> >> On Fri, 03 Nov 2017 15:44:59 +0100, >> Andrey Konovalov wrote: >> > >> > Hi! >> > >> > I've got the following re

[PATCH v2] net: usb: asix: fill null-ptr-deref in asix_suspend

2017-11-06 Thread Andrey Konovalov
4d 8b 6d 08 4d 85 ed 74 0b e8 26 2b 51 fd 4c RIP: asix_suspend+0x76/0xc0 RSP: 88006bbae718 ---[ end trace dfc4f5649284342c ]--- Signed-off-by: Andrey Konovalov --- Changes in v2: - added asix_resume() fix --- drivers/net/usb/asix_devices.c | 4 ++-- 1 file changed, 2 insertions(+), 2 dele

Re: [PATCH] net: usb: asix: fill null-ptr-deref in asix_suspend

2017-11-06 Thread Andrey Konovalov
On Mon, Nov 6, 2017 at 10:49 AM, Oliver Neukum wrote: > Am Donnerstag, den 02.11.2017, 21:26 +0100 schrieb Andrey Konovalov: >> When asix_suspend() is called dev->driver_priv might not have been >> assigned a value, so we need to check that it's not NULL. >> >&

usb/media/uvc: slab-out-of-bounds in uvc_probe

2017-11-06 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 39dae59d66acd86d1de24294bd2f343fd5e7a625 (4.14-rc8). It seems that type == UVC_ITT_CAMERA | 0x8000, that's why the (type == UVC_ITT_CAMERA) check fails and (UVC_ENTITY_TYPE(term) == UVC_ITT_CAMERA) passes, so le

usb/media/tm6000: use-after-free in tm6000_read_write_usb

2017-11-06 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 39dae59d66acd86d1de24294bd2f343fd5e7a625 (4.14-rc8). usb 1-1: USB disconnect, device number 11 tm6000: disconnecting tm6000 #0 xc2028 0-0061: destroying instance =

usb/net/qmi_wwan: divide error in qmi_wwan_probe/usbnet_probe

2017-11-06 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 39dae59d66acd86d1de24294bd2f343fd5e7a625 (4.14-rc8). qmi_wwan 1-1:0.4: cdc-wdm0: USB WDM device divide error: [#1] PREEMPT SMP KASAN Modules linked in: CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 4.14.0-rc

usb/media/technisat: slab-out-of-bounds in technisat_usb2_rc_query

2017-11-06 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 39dae59d66acd86d1de24294bd2f343fd5e7a625 (4.14-rc8). It seems that there's no check of the received buffer length in technisat_usb2_get_ir(). == B

Re: usb/net/qmi_wwan: divide error in qmi_wwan_probe/usbnet_probe

2017-11-06 Thread Andrey Konovalov
On Mon, Nov 6, 2017 at 3:06 PM, Bjørn Mork wrote: > Andrey Konovalov writes: > >> Hi! >> >> I've got the following report while fuzzing the kernel with syzkaller. > > Thanks. It would have helped a lot of you said *what* you were fuzzing, > though But

Re: [PATCH] net: usb: asix: fill null-ptr-deref in asix_suspend

2017-11-06 Thread Andrey Konovalov
On Mon, Nov 6, 2017 at 4:20 PM, Oliver Neukum wrote: > Am Montag, den 06.11.2017, 13:30 +0100 schrieb Andrey Konovalov: >> On Mon, Nov 6, 2017 at 10:49 AM, Oliver Neukum wrote: >> > >> > >> > 2. Will a device work after that? The appropriate fix may be to wa

usb/core: slab-out-of-bounds in usb_get_bos_descriptor

2017-10-18 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit 3e0cc09a3a2c40ec1ffb6b4e12da86e98feccb11 (4.14-rc5+). Looks like usb_get_bos_descriptor() doesn't check that buffer has enough space for usb_dev_cap_header, which causes out-of-bounds accesses.

Re: usb/core: slab-out-of-bounds in usb_get_bos_descriptor

2017-10-18 Thread Andrey Konovalov
On Wed, Oct 18, 2017 at 5:25 PM, Alan Stern wrote: > On Wed, 18 Oct 2017, Andrey Konovalov wrote: > >> Hi! >> >> I've got the following report while fuzzing the kernel with syzkaller. >> >> On commit 3e0cc09a3a2c40ec1ffb6b4e12da86e98feccb11 (4.14-rc5+)

Re: usb/serial/visor: slab-out-of-bounds in palm_os_3_probe

2017-10-19 Thread Andrey Konovalov
On Wed, Oct 4, 2017 at 4:40 PM, Greg Kroah-Hartman wrote: > On Tue, Oct 03, 2017 at 11:29:40AM +0200, Johan Hovold wrote: >> On Fri, Sep 29, 2017 at 10:37:55AM +0200, Greg Kroah-Hartman wrote: >> > On Thu, Sep 28, 2017 at 07:57:46PM +0200, Andrey Konovalov wrote: >> > &

Re: [PATCH v5 04/23] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead

2015-10-06 Thread Andrey Konovalov
Hi Yury, With this patch set 4.3 kernel fails to build with both arch/arm64/configs/defconfig, and with arch/arm64/configs/defconfig plus CONFIG_AARCH32_EL0=y and CONFIG_ARM64_ILP32=y. See the details below. Thanks, Andrey On 09/30/2015 01:14 AM, Yury Norov wrote: From: Andrew Pinski Signe

Re: [PATCH v5 10/23] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat)

2015-10-06 Thread Andrey Konovalov
Hi Yury, With this patch set 4.3 kernel fails to build with arch/arm64/configs/defconfig plus CONFIG_AARCH32_EL0=y and CONFIG_ARM64_ILP32=y giving the following three errors (the 3d one is warning actually): -8<- 13:21:16 In file included from ../arch/arm64/kernel/process.c:48:0: 13:21

Re: [PATCH v5 03/23] arm64: rename COMPAT to AARCH32_EL0 in Kconfig

2015-10-06 Thread Andrey Konovalov
On 09/30/2015 01:14 AM, Yury Norov wrote: From: Andrew Pinski Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Yury Norov diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 07d1811..d1dc605 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -6

Potential use-after-free in shrink_page_list

2015-10-07 Thread Andrey Konovalov
Hi! While fuzzing the kernel (4.3-rc4) with KASAN and Trinity I got the following report: == BUG: KASan: use after free in shrink_page_list+0x93a/0xf10 at addr 88003487da80 Read of size 8 by task kswapd0/622 =

Fwd: Data race in __inode_add_bytes

2015-08-31 Thread Andrey Konovalov
Hi! We are working on a dynamic data race detector for the Linux kernel, KernelThreadSanitizer (ktsan): https://github.com/google/ktsan/wiki We got a report while running ktsan on 4.2: == ThreadSanitizer: data-race in __inode_add_by

Fwd: Use-after-free in page_cache_async_readahead

2015-09-07 Thread Andrey Konovalov
On Thu, Sep 3, 2015 at 1:49 PM, Andrey Konovalov wrote: > On Wed, Sep 2, 2015 at 9:40 PM, Tejun Heo wrote: >> Hello, Andrey. > > Hello Tejun, > >> On Wed, Sep 02, 2015 at 01:08:52PM +0200, Andrey Konovalov wrote: >>> While running KASAN on 4.2 with T

Re: Multiple potential races on vma->vm_flags

2015-10-15 Thread Andrey Konovalov
On Wed, Oct 14, 2015 at 12:33 AM, Hugh Dickins wrote: > I think I've found the answer to that at last: we were indeed > all looking in the wrong direction. Your ktsan tree shows > > static __always_inline int atomic_add_negative(int i, atomic_t *v) > { > #ifndef CONFIG_KTSAN > GEN_BINARY_

Use-after-free in page_cache_async_readahead

2015-09-02 Thread Andrey Konovalov
Hi! While running KASAN on 4.2 with Trinity I got the following report: == BUG: KASan: use after free in page_cache_async_readahead+0x2cb/0x3f0 at addr 880034bf6690 Read of size 8 by task sshd/2571 ===

Re: Use-after-free in page_cache_async_readahead

2015-09-03 Thread Andrey Konovalov
On Wed, Sep 2, 2015 at 9:40 PM, Tejun Heo wrote: > Hello, Andrey. Hello Tejun, > On Wed, Sep 02, 2015 at 01:08:52PM +0200, Andrey Konovalov wrote: >> While running KASAN on 4.2 with Trinity I got the foll

[PATCH 5/7] kasan: various fixes in documentation

2015-09-03 Thread Andrey Konovalov
Signed-off-by: Andrey Konovalov --- Documentation/kasan.txt | 43 ++- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/Documentation/kasan.txt b/Documentation/kasan.txt index 0d32355..d2f4c8f 100644 --- a/Documentation/kasan.txt +++ b

[PATCH 7/7] kasan: update reference to kasan prototype repo

2015-09-03 Thread Andrey Konovalov
Update the reference to the kasan prototype repository on github, since it was renamed. Signed-off-by: Andrey Konovalov --- mm/kasan/kasan.c | 2 +- mm/kasan/report.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 61c9620

[PATCH 4/7] kasan: update log messages

2015-09-03 Thread Andrey Konovalov
We decided to use KASAN as the short name of the tool and KernelAddressSanitizer as the full one. Update log messages according to that. Signed-off-by: Andrey Konovalov --- arch/x86/mm/kasan_init_64.c | 2 +- mm/kasan/kasan.c| 2 +- mm/kasan/report.c | 4 ++-- 3 files

[PATCH 2/7] kasan: update reported bug types for kernel memory accesses

2015-09-03 Thread Andrey Konovalov
Update the names of the bad access types to better reflect the type of the access that happended and make these error types "literals" that can be used for classification and deduplication in scripts. Signed-off-by: Andrey Konovalov --- mm/kasan/report.c | 18 +++--- 1 fi

[PATCH 1/7] kasan: update reported bug types for not user nor kernel memory accesses

2015-09-03 Thread Andrey Konovalov
this change. For userspace ASan we have a bunch of systems that analyze error types for the purpose of classification and deduplication. Sooner of later we will write them to KASAN as well. Then clearly and explicitly stated error types will bring value. Signed-off-by: Andrey Konovalov --- mm/

[PATCH 6/7] kasan: move KASAN_SANITIZE in arch/x86/boot/Makefile

2015-09-03 Thread Andrey Konovalov
Move KASAN_SANITIZE in arch/x86/boot/Makefile above the comment related to SVGA_MODE, since the comment refers to 'the next line'. Signed-off-by: Andrey Konovalov --- arch/x86/boot/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/Makefile

[PATCH 0/7] kasan: various fixes

2015-09-03 Thread Andrey Konovalov
. 2. Making references to the tool name consistent. We decided to use KASAN as the short name of the tool since a lot of people already use it, and KernelAddressSanitizer as the full name to be consistent with the userspace AddressSantizer. Andrey Konovalov (7): kasan: update reported bug types

[PATCH 3/7] kasan: accurately determine the type of the bad access

2015-09-03 Thread Andrey Konovalov
Makes KASAN accurately determine the type of the bad access. If the shadow byte value is in the [0, KASAN_SHADOW_SCALE_SIZE) range we can look at the next shadow byte to determine the type of the access. Signed-off-by: Andrey Konovalov --- mm/kasan/report.c | 17 ++--- 1 file

Data race in ext4_writepages

2015-09-03 Thread Andrey Konovalov
Hi! We are working on a dynamic data race detector for the Linux kernel, KernelThreadSanitizer (ktsan): https://github.com/google/ktsan/wiki We got a report while running ktsan on 4.2: == ThreadSanitizer: data-race in ext4_writepage

Re: [PATCH v5 00/23] ILP32 for ARM64

2015-10-01 Thread Andrey Konovalov
On 10/01/2015 02:36 PM, Mark Brown wrote: On Thu, Oct 01, 2015 at 12:19:31PM +0100, Catalin Marinas wrote: On Wed, Sep 30, 2015 at 05:41:03PM +0100, Mark Brown wrote: Indeed. On that subject there was some discussion at Linaro Connect last week about work (being done outside Linaro, not sure

[PATCH v5 10/10] selftests, arm64: add a selftest for passing tagged pointers to kernel

2018-08-06 Thread Andrey Konovalov
This patch adds a simple test, that calls the uname syscall with a tagged user pointer as an argument. Without the kernel accepting tagged user pointers the test fails with EFAULT. Signed-off-by: Andrey Konovalov --- tools/testing/selftests/arm64/.gitignore | 1 + tools/testing/selftests

[PATCH v5 02/10] uaccess: add untagged_addr definition for other arches

2018-08-06 Thread Andrey Konovalov
arm64. Signed-off-by: Andrey Konovalov --- include/linux/uaccess.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index efe79c1cdd47..c045b4eff95e 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -13,6 +13,10

[PATCH v5 08/10] usb, arm64: untag user addresses in devio

2018-08-06 Thread Andrey Konovalov
tagged, we might compare tagged and untagged addresses during the search. Untag the provided addresses before searching. Signed-off-by: Andrey Konovalov --- drivers/usb/core/devio.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/devio.c b/drivers/usb

[PATCH v5 05/10] lib, arm64: untag addrs passed to strncpy_from_user and strnlen_user

2018-08-06 Thread Andrey Konovalov
strncpy_from_user and strnlen_user accept user addresses as arguments, and do not go through the same path as copy_from_user and others, so here we need to handle the case of tagged user addresses separately. Untag user pointers passed to these functions. Signed-off-by: Andrey Konovalov

[PATCH v5 09/10] arm64: update Documentation/arm64/tagged-pointers.txt

2018-08-06 Thread Andrey Konovalov
Add a note that work on passing tagged user pointers to the kernel via syscalls has started, but might not be complete yet. Signed-off-by: Andrey Konovalov --- Documentation/arm64/tagged-pointers.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/arm64

[PATCH v5 04/10] mm, arm64: untag user addresses in mm/gup.c

2018-08-06 Thread Andrey Konovalov
for vma lookup. Signed-off-by: Andrey Konovalov --- mm/gup.c | 4 1 file changed, 4 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index fc5f98069f4e..ebb87fb56709 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -666,6 +666,8 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct

Re: [PATCH] kasan: add __asan_report_loadN/storeN_noabort callbacks

2018-01-23 Thread Andrey Konovalov
On Tue, Jan 23, 2018 at 11:44 AM, Andrey Ryabinin wrote: > On 01/19/2018 08:44 PM, Andrey Konovalov wrote: >> Instead of __asan_report_load_n_noabort and __asan_report_store_n_noabort >> callbacks Clang emits differently named __asan_report_loadN_noabort and >> __asan_

Re: [PATCH v2] kasan: don't emit builtin calls when sanitization is off

2018-01-23 Thread Andrey Konovalov
On Tue, Jan 23, 2018 at 3:20 AM, Andrew Morton wrote: > On Fri, 19 Jan 2018 18:58:12 +0100 Andrey Konovalov > wrote: > >> With KASAN enabled the kernel has two different memset() functions, one >> with KASAN checks (memset) and one without (__memset). KASAN uses some >&

Re: [PATCH v2] kasan: don't emit builtin calls when sanitization is off

2018-01-23 Thread Andrey Konovalov
On Tue, Jan 23, 2018 at 10:24 AM, Andrey Ryabinin wrote: > > > On 01/19/2018 08:58 PM, Andrey Konovalov wrote: >> With KASAN enabled the kernel has two different memset() functions, one >> with KASAN checks (memset) and one without (__memset). KASAN uses some >> mac

[PATCH 0/2] kasan: a few cleanups

2018-01-11 Thread Andrey Konovalov
Clean up usage of KASAN_SHADOW_SCALE_SHIFT and fix prototype author email address. Andrey Konovalov (2): kasan: fix prototype author email address kasan: clean up KASAN_SHADOW_SCALE_SHIFT usage arch/arm64/include/asm/kasan.h | 3 ++- arch/arm64/include/asm/memory.h | 3 ++- arch/arm64/mm

[PATCH 2/2] kasan: clean up KASAN_SHADOW_SCALE_SHIFT usage

2018-01-11 Thread Andrey Konovalov
Right now the fact that KASAN uses a single shadow byte for 8 bytes of memory is scattered all over the code. This change defines KASAN_SHADOW_SCALE_SHIFT early in asm include files and makes use of this constant where necessary. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm

[PATCH 1/2] kasan: fix prototype author email address

2018-01-11 Thread Andrey Konovalov
Use the new one. Signed-off-by: Andrey Konovalov --- mm/kasan/kasan.c | 2 +- mm/kasan/report.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 405bba487df5..cb4065f31f7f 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c

[PATCH v2 0/2] kasan: a few cleanups

2018-01-12 Thread Andrey Konovalov
Clean up usage of KASAN_SHADOW_SCALE_SHIFT and fix prototype author email address. Changes in v2: - fix comments as well. Andrey Konovalov (2): kasan: fix prototype author email address kasan: clean up KASAN_SHADOW_SCALE_SHIFT usage arch/arm64/include/asm/kasan.h | 17

Re: [PATCH 2/2] kasan: clean up KASAN_SHADOW_SCALE_SHIFT usage

2018-01-12 Thread Andrey Konovalov
On Thu, Jan 11, 2018 at 10:59 PM, Andrey Ryabinin wrote: > > > On 01/11/2018 06:29 PM, Andrey Konovalov wrote: > >> diff --git a/arch/arm64/include/asm/kasan.h b/arch/arm64/include/asm/kasan.h >> index e266f80e45b7..811643fe7640 100644 >> --- a/arch/arm64/include/a

[PATCH v2 2/2] kasan: clean up KASAN_SHADOW_SCALE_SHIFT usage

2018-01-12 Thread Andrey Konovalov
Right now the fact that KASAN uses a single shadow byte for 8 bytes of memory is scattered all over the code. This change defines KASAN_SHADOW_SCALE_SHIFT early in asm include files and makes use of this constant where necessary. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm

[PATCH v2 1/2] kasan: fix prototype author email address

2018-01-12 Thread Andrey Konovalov
Use the new one. Signed-off-by: Andrey Konovalov --- mm/kasan/kasan.c | 2 +- mm/kasan/report.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 405bba487df5..cb4065f31f7f 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c

Re: WARNING in refcount_inc (2)

2018-02-01 Thread Andrey Konovalov
On Wed, Jan 31, 2018 at 8:27 AM, Eric Biggers wrote: > > Also Dmitry, syzbot seems to be grouping together unrelated bugs under the > refcount_t WARNINGs; maybe those should be on a blacklist? Not a blacklist, we need a proper way of extracting the offending caller like it's done for reports from

[PATCH] kasan: don't emit builtin calls when sanitization is off

2018-01-19 Thread Andrey Konovalov
flag for files with KASAN_SANITIZE := n marker. Signed-off-by: Andrey Konovalov --- This patch should be applied on top of the v4 "kasan: support alloca, LLVM" patchset from Paul Lawrence. Makefile | 3 ++- scripts/Makefile.kasan | 3 +++ scripts/Makefile.lib | 2 +

[PATCH] kasan: add __asan_report_loadN/storeN_noabort callbacks

2018-01-19 Thread Andrey Konovalov
__asan_report_loadN/storeN_noabort. Signed-off-by: Andrey Konovalov --- mm/kasan/report.c | 12 1 file changed, 12 insertions(+) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index eff12e040498..caf4c9e948c6 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -450,3 +450,15

[PATCH v2] kasan: don't emit builtin calls when sanitization is off

2018-01-19 Thread Andrey Konovalov
flag for files with KASAN_SANITIZE := n marker. Signed-off-by: Andrey Konovalov --- Changed in v2: - dropped cc-option for -fno-builtin Makefile | 3 ++- scripts/Makefile.kasan | 3 +++ scripts/Makefile.lib | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a

Re: [PATCH] kasan: don't emit builtin calls when sanitization is off

2018-01-19 Thread Andrey Konovalov
On Fri, Jan 19, 2018 at 4:57 PM, Andrey Ryabinin wrote: > > > On 01/19/2018 05:54 PM, Andrey Konovalov wrote: > >> diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan >> index dbbd4382f15a..db473309f136 100644 >> --- a/scripts/Makefile.kasan >> +++

Re: [PATCH v2] kasan: don't emit builtin calls when sanitization is off

2018-01-22 Thread Andrey Konovalov
On Fri, Jan 19, 2018 at 8:06 PM, Nick Desaulniers wrote: > Hmm... I had mentioned this patch to some coworkers who have much more > knowledge about LLVM than me. They had concern that LLVM needs memset > to be defined, and that there were discussions on the llvm mailing > list about this. > > I'm

Re: [PATCH] kasan, slub: fix handling of kasan_slab_free hook

2018-03-06 Thread Andrey Konovalov
On Fri, Mar 2, 2018 at 1:10 PM, Andrey Ryabinin wrote: > On 02/23/2018 06:53 PM, Andrey Konovalov wrote: >> The kasan_slab_free hook's return value denotes whether the reuse of a >> slab object must be delayed (e.g. when the object is put into memory >> qurantine).

Re: [PATCH] kasan, slub: fix handling of kasan_slab_free hook

2018-03-06 Thread Andrey Konovalov
On Tue, Mar 6, 2018 at 6:42 PM, Andrey Konovalov wrote: > On Fri, Mar 2, 2018 at 1:10 PM, Andrey Ryabinin > wrote: >> On 02/23/2018 06:53 PM, Andrey Konovalov wrote: >>> The kasan_slab_free hook's return value denotes whether the reuse of a >>> slab object mu

[PATCH v2] kasan, slub: fix handling of kasan_slab_free hook

2018-03-06 Thread Andrey Konovalov
es this by: 1. taking into account the return value of kasan_slab_free for each of the objects, that are being freed; 2. reconstructing the freelist of objects to exclude the ones, whose reuse must be delayed. Signed-off-by: Andrey Konovalov --- Changes in v2: - Made slab_free_freelist_hook r

[PATCH] NFC: fix attrs checks in netlink interface

2018-04-12 Thread Andrey Konovalov
ff-by: Andrey Konovalov --- net/nfc/netlink.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index f018eafc2a0d..58adfb0c90f6 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c @@ -936,7 +936,8 @@ static int nfc_genl_deactivate_t

[PATCH] kasan: add no_sanitize attribute for clang builds

2018-04-12 Thread Andrey Konovalov
Signed-off-by: Andrey Konovalov --- include/linux/compiler-clang.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index ceb96ecab96e..5a1d8580febe 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compil

Re: arm64 kvm built with clang doesn't boot

2018-04-12 Thread Andrey Konovalov
On Fri, Mar 16, 2018 at 3:31 PM, Mark Rutland wrote: > On Fri, Mar 16, 2018 at 02:13:14PM +, Mark Rutland wrote: >> On Fri, Mar 16, 2018 at 02:49:00PM +0100, Andrey Konovalov wrote: >> > Hi! >> >> Hi, >> >> > I've recently tried to boot c

Re: [RFC PATCH 3/6] mm, arm64: untag user addresses in memory syscalls

2018-03-09 Thread Andrey Konovalov
On Fri, Mar 9, 2018 at 4:53 PM, Catalin Marinas wrote: > On Fri, Mar 09, 2018 at 03:02:01PM +0100, Andrey Konovalov wrote: >> Memory subsystem syscalls accept user addresses as arguments, but don't use >> copy_from_user and other similar functions, so we need to handle thi

Re: [RFC PATCH 2/6] arm64: untag user addresses in copy_from_user and others

2018-03-09 Thread Andrey Konovalov
On Fri, Mar 9, 2018 at 4:58 PM, Catalin Marinas wrote: > On Fri, Mar 09, 2018 at 03:03:09PM +, Mark Rutland wrote: >> On Fri, Mar 09, 2018 at 03:02:00PM +0100, Andrey Konovalov wrote: >> > copy_from_user (and a few other similar functions) are used to copy data >> >

Re: [RFC PATCH 0/6] arm64: untag user pointers passed to the kernel

2018-03-09 Thread Andrey Konovalov
On Fri, Mar 9, 2018 at 3:55 PM, Mark Rutland wrote: > Hi, > > [trimming Ccs] > > On Fri, Mar 09, 2018 at 03:01:58PM +0100, Andrey Konovalov wrote: >> arm64 has a feature called Top Byte Ignore, which allows to embed pointer >> tags into the top byte of each pointer.

Re: [RFC PATCH 3/6] mm, arm64: untag user addresses in memory syscalls

2018-03-14 Thread Andrey Konovalov
On Fri, Mar 9, 2018 at 6:42 PM, Evgenii Stepanov wrote: > On Fri, Mar 9, 2018 at 9:31 AM, Andrey Konovalov > wrote: >> On Fri, Mar 9, 2018 at 4:53 PM, Catalin Marinas >> wrote: >>> I'm not yet convinced these functions need to allow tagged pointers. >>&g

[PATCH v12 20/25] kasan, arm64: add brk handler for inline instrumentation

2018-11-27 Thread Andrey Konovalov
to the brk instructions (to extract information about the memory access that triggered the mismatch), reads the register values (x0 contains the guilty address) and reports the bug. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- arch/arm64/include

[PATCH v12 17/25] kasan: add bug reporting routines for tag-based mode

2018-11-27 Thread Andrey Konovalov
tag. 2. Tag-based KASAN reports all bugs with the "KASAN: invalid-access" header. Also simplify generic KASAN find_first_bad_addr. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- mm/kasan/generic_report.c | 16 --- mm/kas

[PATCH v12 16/25] kasan: split out generic_report.c from report.c

2018-11-27 Thread Andrey Konovalov
This patch moves generic KASAN specific error reporting routines to generic_report.c without any functional changes, leaving common error reporting code in report.c to be later reused by tag-based KASAN. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov

[PATCH v12 03/25] kasan: move common generic and tag-based code to common.c

2018-11-27 Thread Andrey Konovalov
Tag-based KASAN reuses a significant part of the generic KASAN code, so move the common parts to common.c without any functional changes. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- mm/kasan/Makefile | 5 +- mm/kasan/common.c | 603

[PATCH v12 02/25] kasan, slub: handle pointer tags in early_kmem_cache_node_alloc

2018-11-27 Thread Andrey Konovalov
is assigned by kasan_kmalloc. Signed-off-by: Andrey Konovalov --- mm/slub.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index fdd4a86aa882..8561a32910dd 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3364,16 +3364,16 @@ static void

[PATCH v12 11/25] kasan, arm64: untag address in _virt_addr_is_linear

2018-11-27 Thread Andrey Konovalov
virt_addr_is_linear (which is used by virt_addr_valid) assumes that the top byte of the address is 0xff, which isn't always the case with tag-based KASAN. This patch resets the tag in this macro. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov ---

[PATCH v12 07/25] kasan: rename kasan_zero_page to kasan_early_shadow_page

2018-11-27 Thread Andrey Konovalov
With tag based KASAN mode the early shadow value is 0xff and not 0x00, so this patch renames kasan_zero_(page|pte|pmd|pud|p4d) to kasan_early_shadow_(page|pte|pmd|pud|p4d) to avoid confusion. Suggested-by: Mark Rutland Signed-off-by: Andrey Konovalov --- arch/arm64/mm/kasan_init.c | 43

[PATCH v12 04/25] kasan: rename source files to reflect the new naming scheme

2018-11-27 Thread Andrey Konovalov
We now have two KASAN modes: generic KASAN and tag-based KASAN. Rename kasan.c to generic.c to reflect that. Also rename kasan_init.c to init.c as it contains initialization code for both KASAN modes. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov

[PATCH v12 05/25] kasan: add CONFIG_KASAN_GENERIC and CONFIG_KASAN_SW_TAGS

2018-11-27 Thread Andrey Konovalov
commit adds the CONFIG_KASAN_SW_TAGS config option, this option is not selectable, as it depends on HAVE_ARCH_KASAN_SW_TAGS, which we will enable once all the infrastracture code has been added. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- include/linux

[PATCH v12 00/25] kasan: add software tag-based mode for arm64

2018-11-27 Thread Andrey Konovalov
on in KHWASAN brk handler. - Added a comment about the -recover flag. - Some minor cleanups and fixes. - Rebased onto 3215b9d5 (4.16-rc6+). - Tested on real hardware (Odroid C2 board). - Added better benchmarks. [1] https://lkml.org/lkml/2018/7/18/765 [2] https://lkml.org/lkml/2018/4/19/775

[PATCH v11 22/24] kasan: add __must_check annotations to kasan hooks

2018-11-19 Thread Andrey Konovalov
This patch adds __must_check annotations to kasan hooks that return a pointer to make sure that a tagged pointer always gets propagated. Suggested-by: Andrey Ryabinin Signed-off-by: Andrey Konovalov --- include/linux/kasan.h | 16 ++-- mm/kasan/common.c | 14 -- 2

[PATCH v11 17/24] kasan: add bug reporting routines for tag-based mode

2018-11-19 Thread Andrey Konovalov
tag. 2. Tag-based KASAN reports all bugs with the "KASAN: invalid-access" header. Also simplify generic KASAN find_first_bad_addr. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- mm/kasan/generic_report.c | 16 --- mm/kas

[PATCH v11 20/24] kasan, arm64: add brk handler for inline instrumentation

2018-11-19 Thread Andrey Konovalov
to the brk instructions (to extract information about the memory access that triggered the mismatch), reads the register values (x0 contains the guilty address) and reports the bug. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- arch/arm64/include

  1   2   3   4   5   6   7   8   9   10   >