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]
Message-ID: <CALN0BAvfgby97e69mMd+94pcn6AOPL=VPNesfu_W4_9rhkHZxw@mail.gmail.com>
Date:	Tue, 20 May 2014 23:56:37 -0400
From:	Kenny Simpson <theonetruekenny@...il.com>
To:	"Kirill A. Shutemov" <kirill@...temov.name>
Cc:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Michal Hocko <mhocko@...e.cz>, linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Dave Jones <davej@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Armin Rigo <arigo@...es.org>
Subject: Re: remap_file_pages() use

I might need a gentle nudge with a clue stick...
checking against latest git tree it looks as though most common
filesystem types do support remap_file_pages.

I just wrote a simple test case and it worked on my 3.13-based ubuntu
14.04 system on an ext4 filesystem.

thanks,
-Kenny

Here was my simple test case: (it doesn't have error handling, but the
case passed, and running under strace shows all system calls as
passing as well)

#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>

// make a 16-page file, map page 17 over the first page, write to the
aliasing page, assert that it is seen on the first page

int main()
{
  unlink("foo");
  int fd = open("foo", O_CREAT | O_RDWR, 0755);
  ftruncate(fd, 16*4096);
  void* ptr = mmap(0, 17*4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  char* cptr = (char*) ptr;

  // remap the last page over the first
  remap_file_pages(cptr + 16*4096/*addr*/, 4096/*size*/,
           0/*prot*/, 0/*pgoff*/, 0/*flags*/);

  cptr[16*4096] = 'a';
  return cptr[0] != 'a'; // if this aliases, this will be 'a'
}


On Tue, May 20, 2014 at 9:53 PM, Kenny Simpson
<theonetruekenny@...il.com> wrote:
> ouch... hope they don't try to run that code on anything newer then :(
>  Will let them know.
>
> -Kenny
>
>
> On Mon, May 19, 2014 at 5:24 PM, Kirill A. Shutemov
> <kirill@...temov.name> wrote:
>> On Mon, May 19, 2014 at 01:34:05PM -0400, Kenny Simpson wrote:
>>> For the other cases I had used the remapping to have more of a sliding
>>> window over a disk-backed file where I also was using aliasing to
>>> eliminate the corner cases of hitting the end of a window and needing
>>> to split records due to crossing boundaries, etc..
>>
>> Disk backed files are not supported by remap_file_pages() since 2007.
>> See commit 3ee6dafc677a.
>>
>> --
>>  Kirill A. Shutemov
--
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