From: Randy Dunlap <rdunlap@infradead.org> To: Mikulas Patocka <mpatocka@redhat.com>, Michal Hocko <mhocko@kernel.org> Cc: Matthew Wilcox <willy@infradead.org>, David Miller <davem@davemloft.net>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, eric.dumazet@gmail.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, dm-devel@redhat.com, Vlastimil Babka <vbabka@suse.cz> Subject: Re: [PATCH v4] fault-injection: introduce kvmalloc fallback options Date: Wed, 25 Apr 2018 13:20:39 -0700 [thread overview] Message-ID: <1114eda5-9b1f-4db8-2090-556b4a37c532@infradead.org> (raw) In-Reply-To: <alpine.LRH.2.02.1804251556060.30569@file01.intranet.prod.int.rdu2.redhat.com> On 04/25/2018 01:02 PM, Mikulas Patocka wrote: > > > From: Mikulas Patocka <mpatocka@redhat.com> > Subject: [PATCH v4] fault-injection: introduce kvmalloc fallback options > > This patch introduces a fault-injection option "kvmalloc_fallback". This > option makes kvmalloc randomly fall back to vmalloc. > > Unfortunatelly, some kernel code has bugs - it uses kvmalloc and then Unfortunately, > uses DMA-API on the returned memory or frees it with kfree. Such bugs were > found in the virtio-net driver, dm-integrity or RHEL7 powerpc-specific > code. This options helps to test for these bugs. > > The patch introduces a config option FAIL_KVMALLOC_FALLBACK_PROBABILITY. > It can be enabled in distribution debug kernels, so that kvmalloc abuse > can be tested by the users. The default can be overriden with overridden > "kvmalloc_fallback" parameter or in /sys/kernel/debug/kvmalloc_fallback/. > > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> > > --- > Documentation/fault-injection/fault-injection.txt | 7 +++++ > include/linux/fault-inject.h | 9 +++--- > kernel/futex.c | 2 - > lib/Kconfig.debug | 15 +++++++++++ > mm/failslab.c | 2 - > mm/page_alloc.c | 2 - > mm/util.c | 30 ++++++++++++++++++++++ > 7 files changed, 60 insertions(+), 7 deletions(-) > > Index: linux-2.6/Documentation/fault-injection/fault-injection.txt > =================================================================== > --- linux-2.6.orig/Documentation/fault-injection/fault-injection.txt 2018-04-16 21:08:34.000000000 +0200 > +++ linux-2.6/Documentation/fault-injection/fault-injection.txt 2018-04-25 21:36:36.000000000 +0200 > @@ -15,6 +15,12 @@ o fail_page_alloc > > injects page allocation failures. (alloc_pages(), get_free_pages(), ...) > > +o kvmalloc_faillback kvmalloc_fallback > + > + makes the function kvmalloc randonly fall back to vmalloc. This could be used randomly > + to detects bugs such as using DMA-API on the result of kvmalloc or freeing > + the result of kvmalloc with free. > + > o fail_futex > > injects futex deadlock and uaddr fault errors. > @@ -167,6 +173,7 @@ use the boot option: > > failslab= > fail_page_alloc= > + kvmalloc_faillback= kvmalloc_fallback= > fail_make_request= > fail_futex= > mmc_core.fail_request=<interval>,<probability>,<space>,<times> > Index: linux-2.6/lib/Kconfig.debug > =================================================================== > --- linux-2.6.orig/lib/Kconfig.debug 2018-04-25 15:56:16.000000000 +0200 > +++ linux-2.6/lib/Kconfig.debug 2018-04-25 21:39:45.000000000 +0200 > @@ -1527,6 +1527,21 @@ config FAIL_PAGE_ALLOC > help > Provide fault-injection capability for alloc_pages(). > > +config FAIL_KVMALLOC_FALLBACK_PROBABILITY > + int "Default kvmalloc fallback probability" > + depends on FAULT_INJECTION > + range 0 100 > + default "0" > + help > + This option will make kvmalloc randomly fall back to vmalloc. > + Normally, kvmalloc falls back to vmalloc only rarely, if memory > + is fragmented. > + > + This option helps to detect hard-to-reproduce driver bugs, for > + example using DMA API on the result of kvmalloc. > + > + The default may be overriden with the kvmalloc_faillback parameter. overridden kvmalloc_fallback > + > config FAIL_MAKE_REQUEST > bool "Fault-injection capability for disk IO" > depends on FAULT_INJECTION && BLOCK -- ~Randy
WARNING: multiple messages have this Message-ID (diff)
From: Randy Dunlap <rdunlap@infradead.org> To: Mikulas Patocka <mpatocka@redhat.com>, Michal Hocko <mhocko@kernel.org> Cc: dm-devel@redhat.com, eric.dumazet@gmail.com, mst@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew Wilcox <willy@infradead.org>, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, edumazet@google.com, Andrew Morton <akpm@linux-foundation.org>, David Miller <davem@davemloft.net>, Vlastimil Babka <vbabka@suse.cz> Subject: Re: [PATCH v4] fault-injection: introduce kvmalloc fallback options Date: Wed, 25 Apr 2018 13:20:39 -0700 [thread overview] Message-ID: <1114eda5-9b1f-4db8-2090-556b4a37c532@infradead.org> (raw) In-Reply-To: <alpine.LRH.2.02.1804251556060.30569@file01.intranet.prod.int.rdu2.redhat.com> On 04/25/2018 01:02 PM, Mikulas Patocka wrote: > > > From: Mikulas Patocka <mpatocka@redhat.com> > Subject: [PATCH v4] fault-injection: introduce kvmalloc fallback options > > This patch introduces a fault-injection option "kvmalloc_fallback". This > option makes kvmalloc randomly fall back to vmalloc. > > Unfortunatelly, some kernel code has bugs - it uses kvmalloc and then Unfortunately, > uses DMA-API on the returned memory or frees it with kfree. Such bugs were > found in the virtio-net driver, dm-integrity or RHEL7 powerpc-specific > code. This options helps to test for these bugs. > > The patch introduces a config option FAIL_KVMALLOC_FALLBACK_PROBABILITY. > It can be enabled in distribution debug kernels, so that kvmalloc abuse > can be tested by the users. The default can be overriden with overridden > "kvmalloc_fallback" parameter or in /sys/kernel/debug/kvmalloc_fallback/. > > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> > > --- > Documentation/fault-injection/fault-injection.txt | 7 +++++ > include/linux/fault-inject.h | 9 +++--- > kernel/futex.c | 2 - > lib/Kconfig.debug | 15 +++++++++++ > mm/failslab.c | 2 - > mm/page_alloc.c | 2 - > mm/util.c | 30 ++++++++++++++++++++++ > 7 files changed, 60 insertions(+), 7 deletions(-) > > Index: linux-2.6/Documentation/fault-injection/fault-injection.txt > =================================================================== > --- linux-2.6.orig/Documentation/fault-injection/fault-injection.txt 2018-04-16 21:08:34.000000000 +0200 > +++ linux-2.6/Documentation/fault-injection/fault-injection.txt 2018-04-25 21:36:36.000000000 +0200 > @@ -15,6 +15,12 @@ o fail_page_alloc > > injects page allocation failures. (alloc_pages(), get_free_pages(), ...) > > +o kvmalloc_faillback kvmalloc_fallback > + > + makes the function kvmalloc randonly fall back to vmalloc. This could be used randomly > + to detects bugs such as using DMA-API on the result of kvmalloc or freeing > + the result of kvmalloc with free. > + > o fail_futex > > injects futex deadlock and uaddr fault errors. > @@ -167,6 +173,7 @@ use the boot option: > > failslab= > fail_page_alloc= > + kvmalloc_faillback= kvmalloc_fallback= > fail_make_request= > fail_futex= > mmc_core.fail_request=<interval>,<probability>,<space>,<times> > Index: linux-2.6/lib/Kconfig.debug > =================================================================== > --- linux-2.6.orig/lib/Kconfig.debug 2018-04-25 15:56:16.000000000 +0200 > +++ linux-2.6/lib/Kconfig.debug 2018-04-25 21:39:45.000000000 +0200 > @@ -1527,6 +1527,21 @@ config FAIL_PAGE_ALLOC > help > Provide fault-injection capability for alloc_pages(). > > +config FAIL_KVMALLOC_FALLBACK_PROBABILITY > + int "Default kvmalloc fallback probability" > + depends on FAULT_INJECTION > + range 0 100 > + default "0" > + help > + This option will make kvmalloc randomly fall back to vmalloc. > + Normally, kvmalloc falls back to vmalloc only rarely, if memory > + is fragmented. > + > + This option helps to detect hard-to-reproduce driver bugs, for > + example using DMA API on the result of kvmalloc. > + > + The default may be overriden with the kvmalloc_faillback parameter. overridden kvmalloc_fallback > + > config FAIL_MAKE_REQUEST > bool "Fault-injection capability for disk IO" > depends on FAULT_INJECTION && BLOCK -- ~Randy
next prev parent reply other threads:[~2018-04-25 20:20 UTC|newest] Thread overview: 218+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-18 14:34 [PATCH] net: don't use kvzalloc for DMA memory Mikulas Patocka 2018-04-18 16:05 ` Eric Dumazet 2018-04-18 16:44 ` Mikulas Patocka 2018-04-18 16:44 ` Mikulas Patocka 2018-04-18 16:51 ` Eric Dumazet 2018-04-18 16:51 ` Eric Dumazet 2018-04-18 17:47 ` David Miller 2018-04-18 17:47 ` David Miller 2018-04-18 17:55 ` Mikulas Patocka 2018-04-18 17:55 ` Mikulas Patocka 2018-04-18 18:00 ` Michael S. Tsirkin 2018-04-18 18:00 ` Michael S. Tsirkin 2018-04-18 17:49 ` Mikulas Patocka 2018-04-18 17:49 ` Mikulas Patocka 2018-04-18 16:51 ` Eric Dumazet 2018-04-18 17:46 ` David Miller 2018-04-18 17:53 ` Mikulas Patocka 2018-04-19 16:12 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM Mikulas Patocka 2018-04-19 16:12 ` Mikulas Patocka 2018-04-19 16:25 ` Eric Dumazet 2018-04-19 16:25 ` Eric Dumazet 2018-04-19 16:28 ` Mikulas Patocka 2018-04-19 16:28 ` Mikulas Patocka 2018-04-19 16:43 ` Michael S. Tsirkin 2018-04-19 21:27 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG Mikulas Patocka 2018-04-19 21:27 ` Mikulas Patocka 2018-04-19 16:43 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM Michael S. Tsirkin 2018-04-19 18:28 ` Vlastimil Babka 2018-04-19 18:28 ` Vlastimil Babka 2018-04-19 19:47 ` Andrew Morton 2018-04-19 19:47 ` Andrew Morton 2018-04-19 21:19 ` Mikulas Patocka 2018-04-19 21:19 ` Mikulas Patocka 2018-04-19 23:22 ` Andrew Morton 2018-04-19 23:22 ` Andrew Morton 2018-04-20 12:16 ` Mikulas Patocka 2018-04-20 12:16 ` Mikulas Patocka 2018-04-20 11:47 ` Matthew Wilcox 2018-04-20 11:47 ` Matthew Wilcox 2018-04-20 12:20 ` Mikulas Patocka 2018-04-23 15:25 ` Michael S. Tsirkin 2018-04-23 15:25 ` Michael S. Tsirkin 2018-04-20 12:20 ` Mikulas Patocka 2018-04-20 13:08 ` Michal Hocko 2018-04-20 13:08 ` Michal Hocko 2018-04-20 13:41 ` Matthew Wilcox 2018-04-20 13:41 ` Matthew Wilcox 2018-04-20 13:49 ` Michal Hocko 2018-04-20 13:49 ` Michal Hocko 2018-04-20 20:56 ` Mikulas Patocka 2018-04-20 20:56 ` Mikulas Patocka 2018-04-20 20:54 ` Mikulas Patocka 2018-04-20 21:02 ` Matthew Wilcox 2018-04-20 21:02 ` Matthew Wilcox 2018-04-20 21:21 ` Mikulas Patocka 2018-04-21 14:47 ` Matthew Wilcox 2018-04-22 13:03 ` Michal Hocko 2018-04-22 13:03 ` Michal Hocko 2018-04-23 14:24 ` Mikulas Patocka 2018-04-23 15:10 ` Michal Hocko 2018-04-23 15:10 ` Michal Hocko 2018-04-23 23:20 ` Mikulas Patocka 2018-04-23 23:20 ` Mikulas Patocka 2018-04-23 14:24 ` Mikulas Patocka 2018-04-23 14:06 ` Mikulas Patocka 2018-04-23 14:06 ` Mikulas Patocka 2018-04-23 15:15 ` Michal Hocko 2018-04-23 15:15 ` Michal Hocko 2018-04-24 0:06 ` [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG Mikulas Patocka 2018-04-24 0:06 ` Mikulas Patocka 2018-04-24 2:47 ` David Rientjes 2018-04-24 11:04 ` Mikulas Patocka 2018-04-24 11:04 ` Mikulas Patocka 2018-04-24 3:46 ` Matthew Wilcox 2018-04-24 3:46 ` Matthew Wilcox 2018-04-24 12:29 ` Mikulas Patocka 2018-04-24 12:29 ` Mikulas Patocka 2018-04-24 17:16 ` Matthew Wilcox 2018-04-24 18:41 ` Mikulas Patocka 2018-04-24 18:41 ` Mikulas Patocka 2018-05-15 1:13 ` Joonsoo Kim 2018-05-15 1:13 ` Joonsoo Kim 2018-04-24 17:16 ` Matthew Wilcox 2018-04-24 12:51 ` Michal Hocko 2018-04-24 12:51 ` Michal Hocko 2018-04-24 15:50 ` Mikulas Patocka 2018-04-24 16:29 ` Michal Hocko 2018-04-24 17:00 ` Mikulas Patocka 2018-04-24 17:00 ` Mikulas Patocka 2018-04-24 17:03 ` Michal Hocko 2018-04-24 17:03 ` Michal Hocko 2018-04-24 17:28 ` Mikulas Patocka 2018-04-24 17:38 ` Michal Hocko 2018-04-24 17:38 ` Michal Hocko 2018-04-25 20:02 ` [PATCH] fault-injection: reorder config entries Mikulas Patocka 2018-04-25 20:02 ` Mikulas Patocka 2018-04-26 3:21 ` Randy Dunlap 2018-04-26 3:21 ` Randy Dunlap 2018-04-25 20:02 ` [PATCH v4] fault-injection: introduce kvmalloc fallback options Mikulas Patocka 2018-04-25 20:02 ` Mikulas Patocka 2018-04-25 20:20 ` Randy Dunlap [this message] 2018-04-25 20:20 ` Randy Dunlap 2018-04-25 20:57 ` [PATCH v5] " Mikulas Patocka 2018-04-25 20:57 ` Mikulas Patocka 2018-04-25 21:11 ` Randy Dunlap 2018-04-25 21:11 ` Randy Dunlap 2018-04-25 21:18 ` David Rientjes 2018-04-25 21:22 ` Mikulas Patocka 2018-04-25 21:22 ` Mikulas Patocka 2018-04-25 22:17 ` [dm-devel] " James Bottomley 2018-04-25 22:17 ` James Bottomley 2018-04-25 22:42 ` Mikulas Patocka 2018-04-25 22:42 ` Mikulas Patocka 2018-04-25 22:49 ` David Rientjes 2018-04-25 22:56 ` Mikulas Patocka 2018-04-25 22:56 ` Mikulas Patocka 2018-04-26 12:58 ` Michal Hocko 2018-04-26 12:58 ` Michal Hocko 2018-04-26 14:28 ` Mikulas Patocka 2018-04-26 14:28 ` Mikulas Patocka 2018-04-26 14:45 ` [dm-devel] " James Bottomley 2018-04-26 14:45 ` James Bottomley 2018-04-26 15:05 ` Mikulas Patocka 2018-04-26 15:05 ` Mikulas Patocka 2018-04-26 15:24 ` James Bottomley 2018-04-26 15:24 ` James Bottomley 2018-04-26 15:44 ` Mikulas Patocka 2018-04-26 15:44 ` Mikulas Patocka 2018-04-26 15:44 ` Mikulas Patocka 2018-04-26 15:59 ` Michael S. Tsirkin 2018-04-26 15:59 ` Michael S. Tsirkin 2018-04-26 16:07 ` Mikulas Patocka 2018-04-26 16:07 ` Mikulas Patocka 2018-04-26 18:49 ` Michael S. Tsirkin 2018-04-26 18:54 ` Mikulas Patocka 2018-04-26 18:54 ` Mikulas Patocka 2018-04-26 19:14 ` Michael S. Tsirkin 2018-04-26 19:14 ` Michael S. Tsirkin 2018-04-26 19:36 ` Mikulas Patocka 2018-04-26 19:36 ` Mikulas Patocka 2018-04-26 19:45 ` Michael S. Tsirkin 2018-04-26 19:45 ` Michael S. Tsirkin 2018-04-26 20:05 ` Mikulas Patocka 2018-04-26 20:05 ` Mikulas Patocka 2018-04-26 18:49 ` Michael S. Tsirkin 2018-04-26 16:07 ` Mikulas Patocka 2018-04-26 18:58 ` Mikulas Patocka 2018-04-26 18:58 ` Mikulas Patocka 2018-04-26 19:05 ` Michael S. Tsirkin 2018-04-26 19:05 ` Michael S. Tsirkin 2018-04-26 15:59 ` Michael S. Tsirkin 2018-04-26 15:55 ` Mikulas Patocka 2018-04-26 15:55 ` Mikulas Patocka 2018-04-26 15:05 ` Mikulas Patocka 2018-04-26 14:28 ` Mikulas Patocka 2018-04-25 22:42 ` Mikulas Patocka 2018-04-25 23:00 ` Mikulas Patocka 2018-04-25 23:00 ` Mikulas Patocka 2018-04-25 23:00 ` Mikulas Patocka 2018-04-25 23:08 ` James Bottomley 2018-04-25 23:08 ` James Bottomley 2018-04-26 14:55 ` Mikulas Patocka 2018-04-26 14:55 ` Mikulas Patocka 2018-04-26 14:55 ` Mikulas Patocka 2018-04-26 14:55 ` Mikulas Patocka 2018-04-26 15:22 ` Mikulas Patocka 2018-04-26 15:22 ` Mikulas Patocka 2018-04-26 15:22 ` Mikulas Patocka 2018-04-26 18:58 ` John Stoffel 2018-04-26 21:50 ` Mikulas Patocka 2018-04-26 21:50 ` Mikulas Patocka 2018-04-26 22:21 ` Michael S. Tsirkin 2018-04-26 22:52 ` Mikulas Patocka 2018-04-26 22:52 ` Mikulas Patocka 2018-04-27 8:25 ` Michal Hocko 2018-04-27 8:25 ` Michal Hocko 2018-04-27 10:20 ` Mikulas Patocka 2018-04-27 10:20 ` Mikulas Patocka 2018-04-27 23:20 ` Mikulas Patocka 2018-04-27 23:20 ` Mikulas Patocka 2018-04-26 22:21 ` Michael S. Tsirkin 2018-04-30 18:27 ` John Stoffel 2018-04-30 21:07 ` Mikulas Patocka 2018-05-02 13:38 ` John Stoffel 2018-05-03 17:40 ` Mikulas Patocka 2018-05-03 17:40 ` Mikulas Patocka 2018-04-30 21:07 ` Mikulas Patocka 2018-04-24 17:28 ` [PATCH v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG Mikulas Patocka 2018-04-24 16:29 ` Michal Hocko 2018-04-24 15:50 ` Mikulas Patocka 2018-04-24 0:25 ` [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM Mikulas Patocka 2018-04-24 13:31 ` Michal Hocko 2018-04-24 13:31 ` Michal Hocko 2018-04-24 15:30 ` Mikulas Patocka 2018-04-24 15:30 ` Mikulas Patocka 2018-04-24 16:12 ` Michal Hocko 2018-04-24 16:12 ` Michal Hocko 2018-04-24 16:29 ` Michal Hocko 2018-04-24 16:29 ` Michal Hocko 2018-04-24 16:33 ` Mikulas Patocka 2018-04-24 16:33 ` Mikulas Patocka 2018-05-02 0:36 ` Andrew Morton 2018-05-02 0:36 ` Andrew Morton 2018-05-02 13:33 ` Mike Snitzer 2018-05-02 13:40 ` [dm-devel] " John Stoffel 2018-05-02 13:33 ` Mike Snitzer 2018-05-03 17:32 ` [PATCH] " Mikulas Patocka 2018-05-03 17:32 ` Mikulas Patocka 2018-04-24 0:25 ` Mikulas Patocka 2018-04-21 14:47 ` Matthew Wilcox 2018-04-20 21:21 ` Mikulas Patocka 2018-04-20 20:54 ` Mikulas Patocka 2018-04-18 17:53 ` [PATCH] net: don't use kvzalloc for DMA memory Mikulas Patocka 2018-04-18 17:46 ` David Miller 2018-04-18 17:45 ` David Miller 2018-04-18 17:55 ` Michael S. Tsirkin 2018-04-18 20:38 ` Eric Dumazet 2018-04-19 4:00 ` Michael S. Tsirkin
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=1114eda5-9b1f-4db8-2090-556b4a37c532@infradead.org \ --to=rdunlap@infradead.org \ --cc=akpm@linux-foundation.org \ --cc=davem@davemloft.net \ --cc=dm-devel@redhat.com \ --cc=edumazet@google.com \ --cc=eric.dumazet@gmail.com \ --cc=jasowang@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mhocko@kernel.org \ --cc=mpatocka@redhat.com \ --cc=mst@redhat.com \ --cc=netdev@vger.kernel.org \ --cc=vbabka@suse.cz \ --cc=virtualization@lists.linux-foundation.org \ --cc=willy@infradead.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.