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>] [day] [month] [year] [list]
Message-ID: <162afe714f8.b3d0e35172666.3338804793531720120@fjellstrom.ca>
Date:   Tue, 10 Apr 2018 08:12:59 -0600
From:   Thomas Fjellstrom <thomas@...llstrom.ca>
To:     "linux-kernel" <linux-kernel@...r.kernel.org>
Subject: Methods to intercept accesses to mmaped page from userspace, or
 pretend to be mmio range

Hi,

I'm working on a little driver that wants to pretend to be a section of mmio so it can intercept accesses, or intercept accesses to a page after it's been mmaped in by a user space program. So far I haven't found a method that works.

I had been trying to allocate a page, and in the fault handler try and mark the page as readonly, and attempt to check for that in the next fault but as soon as the page is accessed its just assigned now, and there's no more faults (obviously). Other methods include trying ptrace but that seems not accessible from kernel modules, and inserting a uprobe on the instruction after the current one in the fault handler so I can remark the page as readonly but that requires some "clever" platform specific code to parse instructions which I'd prefer not to have to do. I don't really care about intercepting reads, but it might be something I care about at some point. At the very least I'd like to trap all writes, do some magic and then let the access proceede (or emulate it). I looked at providing my own pci bus and device, but I'm not sure that'd actually work.

For some background, I'm trying to emulate the /dev/gpiomem char device from the raspberry pi that lets userspace programs mmap in the gpio registers on the bcm283x SoC.

Is there any way to do what I want to do in a kernel module?

Thanks,

-- 
Thomas Fjellstrom
thomas@...llstrom.ca



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ