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:   Mon, 9 Sep 2019 12:06:53 +0200
From:   Gerd Hoffmann <kraxel@...hat.com>
To:     Daniel Vetter <daniel@...ll.ch>
Cc:     dri-devel <dri-devel@...ts.freedesktop.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 05/17] drm: add mmap() to drm_gem_object_funcs

  Hi,

> > +               vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
> > +               vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
> > +               vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
> > +       }
> 
> Totally unrelated discussion around HMM lead me to a bit a chase, and
> realizing that we probably want a
> 
>     WARN_ON(!(vma->vm_flags & VM_SPECIAL));
> 
> here, to make sure drivers set at least one of the "this is a special
> vma, don't try to treat it like pagecache/anon memory". Just to be on
> the safe side. Maybe we also want to keep the entire vma->vm_flags
> assignment in the common code, but at least the WARN_ON would be a
> good check I think. Maybe also check for VM_DONTEXPAND while at it

Hmm.  VM_SPECIAL is this:

  #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP)

Requiring VM_DONTEXPAND makes sense for sure.  Dunno about the other
ones.  For drm_gem_vram_helper VM_IO + VM_PFNMAP are needed.

But we also have drm_gem_shmem_helper which backs objects with normal
pages.  In fact drm_gem_shmem_mmap does this:

	/* VM_PFNMAP was set by drm_gem_mmap() */
	vma->vm_flags &= ~VM_PFNMAP;
	vma->vm_flags |= VM_MIXEDMAP;

include/linux/mm.h isn't very helpful in explaining how VM_MIXEDMAP
should be used, only saying can be both "struct page" and pfnmap, so I'm
not sure why VM_MIXEDMAP is set here, it should always be "struct page"
for shmem, no?

cheers,
  Gerd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ