From: Qian Cai <cai@lca.pw>
To: Yury Norov <ynorov@marvell.com>
Cc: Andrey Konovalov <andreyknvl@google.com>,
linux-kernel@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: "lib: rework bitmap_parse()" triggers invalid access errors
Date: Thu, 30 May 2019 15:01:08 -0400 [thread overview]
Message-ID: <1559242868.6132.35.camel@lca.pw> (raw)
The linux-next commit "lib: rework bitmap_parse" triggers errors below during
boot on both arm64 and powerpc with KASAN_SW_TAGS or SLUB_DEBUG enabled.
Reverted the commit and its dependency (lib: opencode in_str()) fixed the issue.
[ 67.056867][ T3737] BUG kmalloc-16 (Tainted: G B ): Redzone
overwritten
[ 67.056905][ T3737] -------------------------------------------------------
----------------------
[ 67.056905][ T3737]
[ 67.056946][ T3737] INFO: 0x00000000bd269811-0x0000000039a2fb86. First byte
0x0 instead of 0xcc
[ 67.056989][ T3737] INFO: Allocated in alloc_cpumask_var_node+0x38/0x80 age=0
cpu=62 pid=3737
[ 67.057029][ T3737] __slab_alloc+0x34/0x60
[ 67.057052][ T3737] __kmalloc_node+0x1a8/0x860
[ 67.057086][ T3737] alloc_cpumask_var_node+0x38/0x80
[ 67.057133][ T3737] write_irq_affinity.isra.0+0x84/0x1e0
[ 67.057178][ T3737] proc_reg_write+0x90/0x130
[ 67.057224][ T3737] __vfs_write+0x3c/0x70
[ 67.057261][ T3737] vfs_write+0xd8/0x210
[ 67.057292][ T3737] ksys_write+0x7c/0x140
[ 67.057325][ T3737] system_call+0x5c/0x70
[ 67.057355][ T3737] INFO: Freed in free_cpumask_var+0x18/0x30 age=0 cpu=62
pid=3737
[ 67.057392][ T3737] free_cpumask_var+0x18/0x30
[ 67.057427][ T3737] write_irq_affinity.isra.0+0x130/0x1e0
[ 67.057464][ T3737] proc_reg_write+0x90/0x130
[ 67.057525][ T3737] __vfs_write+0x3c/0x70
[ 67.057558][ T3737] vfs_write+0xd8/0x210
[ 67.057607][ T3737] ksys_write+0x7c/0x140
[ 67.057643][ T3737] system_call+0x5c/0x70
[ 67.057692][ T3737] INFO: Slab 0x00000000786814bb objects=186 used=49
fp=0x0000000019431596 flags=0x3fffc000000201
[ 67.057810][ T3737] INFO: Object 0x000000005c0b6a3a @offset=25352
fp=0x00000000a42ffc35
[ 67.057810][ T3737]
[ 67.057922][ T3737] Redzone 00000000d929958b: cc cc cc cc cc cc cc
cc ........
[ 67.058024][ T3737] Object 000000005c0b6a3a: 00 00 00 00 00 00 00 04 00 00 00
00 00 00 00 00 ................
[ 67.058171][ T3737] Redzone 00000000bd269811: 00 00 00 00 00 00 00
00 ........
[ 67.058283][ T3737] Padding 00000000b327be67: 5a 5a 5a 5a 5a 5a 5a
5a ZZZZZZZZ
[ 67.058383][ T3737] CPU: 62 PID: 3737 Comm: irqbalance Tainted:
G B 5.2.0-rc2-next-20190530 #13
[ 67.058508][ T3737] Call Trace:
[ 67.058531][ T3737] [c000001c4738f930] [c00000000089045c]
dump_stack+0xb0/0xf4 (unreliable)
[ 67.058653][ T3737] [c000001c4738f970] [c0000000003dd368]
print_trailer+0x23c/0x264
[ 67.058751][ T3737] [c000001c4738fa00] [c0000000003cd7d8]
check_bytes_and_report+0x138/0x160
[ 67.058846][ T3737] [c000001c4738faa0] [c0000000003cfb9c]
check_object+0x2ac/0x3e0
[ 67.058914][ T3737] [c000001c4738fb10] [c0000000003d646c]
free_debug_processing+0x1ec/0x680
[ 67.059009][ T3737] [c000001c4738fc00] [c0000000003d6c54]
__slab_free+0x354/0x6d0
[ 67.059113][ T3737] [c000001c4738fcc0] [c00000000088fda8]
free_cpumask_var+0x18/0x30
[ 67.059205][ T3737] [c000001c4738fce0] [c0000000001c3fc0]
write_irq_affinity.isra.0+0x130/0x1e0
[ 67.059324][ T3737] [c000001c4738fd30] [c00000000050c6b0]
proc_reg_write+0x90/0x130
[ 67.059415][ T3737] [c000001c4738fd60] [c0000000004475ac]
__vfs_write+0x3c/0x70
[ 67.059498][ T3737] [c000001c4738fd80] [c00000000044b0a8]
vfs_write+0xd8/0x210
[ 67.059581][ T3737] [c000001c4738fdd0] [c00000000044b44c]
ksys_write+0x7c/0x140
[ 67.059692][ T3737] [c000001c4738fe20] [c00000000000b108]
system_call+0x5c/0x70
[ 67.059781][ T3737] FIX kmalloc-16: Restoring 0x00000000bd269811-
0x0000000039a2fb86=0xcc
[ 67.059781][ T3737]
[ 67.059922][ T3737] FIX kmalloc-16: Object at 0x000000005c0b6a3a not freed
185.039693][ T3647] BUG: KASAN: invalid-access in bitmap_parse+0x20c/0x2d8
[ 185.039701][ T3647] Write of size 8 at addr 33ff809501263f20 by task
irqbalance/3647
[ 185.039710][ T3647] Pointer tag: [33], memory tag: [fe]
[ 185.056475][ T3647]
[ 185.056486][ T3647] CPU: 218 PID: 3647 Comm: irqbalance Tainted:
G W 5.2.0-rc2-next-20190530+ #5
[ 185.056491][ T3647] Hardware name: HPE Apollo
70 /C01_APACHE_MB , BIOS L50_5.13_1.0.9 03/01/2019
[ 185.056498][ T3647] Call trace:
[ 185.079885][ T3647] dump_backtrace+0x0/0x268
[ 185.079896][ T3647] show_stack+0x20/0x2c
[ 185.092149][ T3647] dump_stack+0xb4/0x108
[ 185.092162][ T3647] print_address_description+0x7c/0x330
[ 185.092172][ T3647] __kasan_report+0x194/0x1dc
[ 185.116236][ T3647] kasan_report+0x10/0x18
[ 185.116243][ T3647] __hwasan_store8_noabort+0x74/0x7c
[ 185.116248][ T3647] bitmap_parse+0x20c/0x2d8
[ 185.116254][ T3647] bitmap_parse_user+0x40/0x64
[ 185.116268][ T3647] write_irq_affinity+0x118/0x1a8
[ 185.135032][ T3647] irq_affinity_proc_write+0x34/0x44
[ 185.135040][ T3647] proc_reg_write+0xf4/0x130
[ 185.135057][ T3647] __vfs_write+0x88/0x33c
[ 185.135067][ T3647] vfs_write+0x118/0x208
[ 185.144546][ T3647] ksys_write+0xa0/0x110
[ 185.158794][ T3647] __arm64_sys_write+0x54/0x88
[ 185.158811][ T3647] el0_svc_handler+0x198/0x260
[ 185.158820][ T3647] el0_svc+0x8/0xc
[ 185.172464][ T3647]
[ 185.172469][ T3647] Allocated by task 3647:
[ 185.172476][ T3647] __kasan_kmalloc+0x114/0x1d0
[ 185.172481][ T3647] kasan_kmalloc+0x10/0x18
[ 185.172499][ T3647] __kmalloc_node+0x1e0/0x7cc
[ 185.192389][ T3647] alloc_cpumask_var_node+0x48/0x94
[ 185.192395][ T3647] alloc_cpumask_var+0x10/0x1c
[ 185.192400][ T3647] write_irq_affinity+0xa8/0x1a8
[ 185.192406][ T3647] irq_affinity_proc_write+0x34/0x44
[ 185.192415][ T3647] proc_reg_write+0xf4/0x130
[ 185.224744][ T3647] __vfs_write+0x88/0x33c
[ 185.224750][ T3647] vfs_write+0x118/0x208
[ 185.224756][ T3647] ksys_write+0xa0/0x110
[ 185.224766][ T3647] __arm64_sys_write+0x54/0x88
[ 185.258392][ T3647] el0_svc_handler+0x198/0x260
[ 185.258398][ T3647] el0_svc+0x8/0xc
[ 185.258401][ T3647]
[ 185.258405][ T3647] Freed by task 3647:
[ 185.258411][ T3647] __kasan_slab_free+0x154/0x228
[ 185.258417][ T3647] kasan_slab_free+0xc/0x18
[ 185.258422][ T3647] kfree+0x268/0xb70
[ 185.258428][ T3647] free_cpumask_var+0xc/0x14
[ 185.258446][ T3647] write_irq_affinity+0x19c/0x1a8
[ 185.273666][ T3647] irq_affinity_proc_write+0x34/0x44
[ 185.273675][ T3647] proc_reg_write+0xf4/0x130
[ 185.288620][ T3647] __vfs_write+0x88/0x33c
[ 185.288626][ T3647] vfs_write+0x118/0x208
[ 185.288632][ T3647] ksys_write+0xa0/0x110
[ 185.288645][ T3647] __arm64_sys_write+0x54/0x88
[ 185.303075][ T3647] el0_svc_handler+0x198/0x260
[ 185.303081][ T3647] el0_svc+0x8/0xc
[ 185.303084][ T3647]
[ 185.303091][ T3647] The buggy address belongs to the object at
ffff809501263f00
[ 185.303091][ T3647] which belongs to the cache kmalloc-128 of size 128
[ 185.303103][ T3647] The buggy address is located 32 bytes inside of
[ 185.303103][ T3647] 128-byte region [ffff809501263f00, ffff809501263f80)
[ 185.331347][ T3647] The buggy address belongs to the page:
[ 185.331356][ T3647] page:ffff7fe025404980 refcount:1 mapcount:0
mapping:7fff800800010480 index:0xaff809501267d80
[ 185.331365][ T3647] flags: 0x17ffffffc000200(slab)
[ 185.331377][ T3647] raw: 017ffffffc000200 ffff7fe025997308 e5ff808b7d00fd40
7fff800800010480
[ 185.350500][ T3647] raw: 19ff80950126aa80 0000000000660059 00000001ffffffff
0000000000000000
[ 185.350505][ T3647] page dumped because: kasan: bad access detected
[ 185.350514][ T3647] page allocated via order 0, migratetype Unmovable,
gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY)
[ 185.350535][ T3647] prep_new_page+0x2ec/0x388
[ 185.364704][ T3647] get_page_from_freelist+0x2530/0x27fc
[ 185.364711][ T3647] __alloc_pages_nodemask+0x360/0x1c60
[ 185.364719][ T3647] new_slab+0x108/0x9d4
[ 185.364725][ T3647] ___slab_alloc+0x57c/0x9e4
[ 185.364735][ T3647] __kmalloc_node+0x734/0x7cc
[ 185.382050][ T3647] alloc_rt_sched_group+0x17c/0x258
[ 185.382070][ T3647] sched_create_group+0x54/0x9c
[ 185.382090][ T3647] sched_autogroup_create_attach+0x40/0x1f0
[ 185.494511][ T3647] ksys_setsid+0x158/0x15c
[ 185.494517][ T3647] __arm64_sys_setsid+0x10/0x1c
[ 185.494524][ T3647] el0_svc_handler+0x198/0x260
[ 185.494529][ T3647] el0_svc+0x8/0xc
[ 185.494532][ T3647]
[ 185.494536][ T3647] Memory state around the buggy address:
[ 185.494549][ T3647] ffff809501263d00: fe fe fe fe fe fe fe fe fe fe fe fe fe
fe fe fe
[ 185.514973][ T3647] ffff809501263e00: fe fe fe fe fe fe fe fe fe fe fe fe fe
fe fe fe
[ 185.514979][ T3647] >ffff809501263f00: 33 33 fe fe fe fe fe fe fe fe fe fe fe
fe fe fe
[ 185.514982][ T3647] ^
[ 185.514988][ T3647] ffff809501264000: fe fe fe fe fe fe fe fe fe fe fe fe fe
fe fe fe
[ 185.514997][ T3647] ffff809501264100: fe fe fe fe fe fe fe fe 36 36 36 36 36
36 36 36
next reply other threads:[~2019-05-30 19:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-30 19:01 Qian Cai [this message]
2019-06-04 18:23 ` "lib: rework bitmap_parse()" triggers invalid access errors Qian Cai
[not found] ` <BN6PR1801MB20655CFFEA0CEA242C088C25CB160@BN6PR1801MB2065.namprd18.prod.outlook.com>
2019-06-06 16:09 ` Qian Cai
2019-06-07 1:57 ` Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1559242868.6132.35.camel@lca.pw \
--to=cai@lca.pw \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@google.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ynorov@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).