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] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 09 Apr 2014 11:29:22 -0700
From:	John Stultz <john.stultz@...aro.org>
To:	KOSAKI Motohiro <kosaki.motohiro@...il.com>
CC:	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Android Kernel Team <kernel-team@...roid.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Robert Love <rlove@...gle.com>, Mel Gorman <mel@....ul.ie>,
	Hugh Dickins <hughd@...gle.com>, Dave Hansen <dave@...1.net>,
	Rik van Riel <riel@...hat.com>,
	Dmitry Adamushko <dmitry.adamushko@...il.com>,
	Neil Brown <neilb@...e.de>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Mike Hommey <mh@...ndium.org>, Taras Glek <tglek@...illa.com>,
	Jan Kara <jack@...e.cz>, Michel Lespinasse <walken@...gle.com>,
	Minchan Kim <minchan@...nel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: Re: [PATCH 2/5] vrange: Add purged page detection on setting memory
 non-volatile

On 03/23/2014 02:50 PM, KOSAKI Motohiro wrote:
> On Sun, Mar 23, 2014 at 1:26 PM, John Stultz <john.stultz@...aro.org> wrote:
>> On Sun, Mar 23, 2014 at 10:50 AM, KOSAKI Motohiro
>> <kosaki.motohiro@...il.com> wrote:
>>>> +/**
>>>> + * vrange_check_purged_pte - Checks ptes for purged pages
>>>> + *
>>>> + * Iterates over the ptes in the pmd checking if they have
>>>> + * purged swap entries.
>>>> + *
>>>> + * Sets the vrange_walker.pages_purged to 1 if any were purged.
>>>> + */
>>>> +static int vrange_check_purged_pte(pmd_t *pmd, unsigned long addr,
>>>> +                                       unsigned long end, struct mm_walk *walk)
>>>> +{
>>>> +       struct vrange_walker *vw = walk->private;
>>>> +       pte_t *pte;
>>>> +       spinlock_t *ptl;
>>>> +
>>>> +       if (pmd_trans_huge(*pmd))
>>>> +               return 0;
>>>> +       if (pmd_trans_unstable(pmd))
>>>> +               return 0;
>>>> +
>>>> +       pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
>>>> +       for (; addr != end; pte++, addr += PAGE_SIZE) {
>>>> +               if (!pte_present(*pte)) {
>>>> +                       swp_entry_t vrange_entry = pte_to_swp_entry(*pte);
>>>> +
>>>> +                       if (unlikely(is_vpurged_entry(vrange_entry))) {
>>>> +                               vw->page_was_purged = 1;
>>>> +                               break;
>>> This function only detect there is vpurge entry or not. But
>>> VRANGE_NONVOLATILE should remove all vpurge entries.
>>> Otherwise, non-volatiled range still makes SIGBUS.
>> So in the following patch (3/5), we only SIGBUS if the swap entry
>> is_vpurged_entry()  && the vma is still marked volatile, so this
>> shouldn't be an issue.
> When VOLATILE -> NON-VOLATILE -> VOLATILE transition happen,
> the page immediately marked "was purged"?
>
> I don't understand why vma check help.

Ok, you have a good point here. I've changed the code in my tree to
traverse all the ptes being unmarked and zap any psudo swp entries. This
is more expensive, but does provide simpler semantics for these corner
cases.

Thanks again for the great review!
-john



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ