lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 28 Jan 2016 05:49:11 +0000
From:	Naoya Horiguchi <n-horiguchi@...jp.nec.com>
To:	Vlastimil Babka <vbabka@...e.cz>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	Chen Gong <gong.chen@...ux.intel.com>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"Naoya Horiguchi" <nao.horiguchi@...il.com>,
	Linux API <linux-api@...r.kernel.org>,
	"linux-man@...r.kernel.org" <linux-man@...r.kernel.org>,
	Michael Kerrisk <mtk.manpages@...il.com>
Subject: Re: [PATCH v1] mm/madvise: pass return code of memory_failure() to
 userspace

On Wed, Jan 27, 2016 at 02:59:11PM +0100, Vlastimil Babka wrote:
> [CC += linux-api, linux-man]
> 
> On 01/22/2016 09:27 AM, Naoya Horiguchi wrote:
> > Currently the return value of memory_failure() is not passed to userspace, which
> > is inconvenient for test programs that want to know the result of error handling.
> > So let's return it to the caller as we already do in MADV_SOFT_OFFLINE case.
> > 
> > Signed-off-by: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
> > ---
> >  mm/madvise.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git v4.4-mmotm-2016-01-20-16-10/mm/madvise.c v4.4-mmotm-2016-01-20-16-10_patched/mm/madvise.c
> > index f56825b..6a77114 100644
> > --- v4.4-mmotm-2016-01-20-16-10/mm/madvise.c
> > +++ v4.4-mmotm-2016-01-20-16-10_patched/mm/madvise.c
> > @@ -555,8 +555,9 @@ static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end)
> >  		}
> >  		pr_info("Injecting memory failure for page %#lx at %#lx\n",
> >  		       page_to_pfn(p), start);
> > -		/* Ignore return value for now */
> > -		memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED);
> > +		ret = memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED);
> > +		if (ret)
> > +			return ret;
> 
> Can you explain what madvise can newly return for MADV_HWPOISON in which
> situations, for the purposes of updated man page?

OK, this patch newly allows madvise(MADV_HWPOISON) to return EBUSY when
error handling failed due to 2 major reasons:
 - the target page is a page type which memory error handler doesn't support
   (like slab pages, kernel-reserved pages)
 - the memory error handler failed to isolate the target page (for example,
   due to failure in unmapping)

And for man page purpose, errnos of MADV_SOFT_OFFLINE is not documented either.
So let me refer to 2 possible error code from madvise(MADV_SOFT_OFFLINE):
 - EBUSY: failed to isolate from lru list,
 - EIO: failed to migrate the target page to another page.

Thanks,
Naoya Horiguchi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ