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-next>] [day] [month] [year] [list]
Message-ID: <20090209215849.5a788261@daedalus.pq.iki.fi>
Date:	Mon, 9 Feb 2009 21:58:49 +0200
From:	Pekka Paalanen <pq@....fi>
To:	linux-kernel@...r.kernel.org
Cc:	Ingo Molnar <mingo@...e.hu>,
	"Vegard Nossum" <vegard.nossum@...il.com>,
	Stuart Bennett <stuart@...edesktop.org>
Subject: testing pmdval/pteval page presence bit

Hi all,

This question is related to mmiotrace which toggles the page presence
bit to trigger page faults on ioremapped regions. Page faults are used
to trace MMIO reads and writes of proprietary drivers.

I understood that large pages use pmd's instead of pte's. If there is a
union like this:

+	union {
+		pmdval_t pmdval;
+		pteval_t pteval;
+	} saved;	/* stored value prior to arming */

and it is being assigned the proper content, as in the following:

+static int clear_page_present(struct kmmio_fault_page *f, bool clear)
 {
 	pteval_t pteval;
 	pmdval_t pmdval;
 	unsigned int level;
 	pmd_t *pmd;
+	pte_t *pte = lookup_address(f->page, &level);
 
 	if (!pte) {
+		pr_err("kmmio: no pte for page 0x%08lx\n", f->page);
 		return -1;
 	}
 
 	switch (level) {
 	case PG_LEVEL_2M:
 		pmd = (pmd_t *)pte;
+		if (clear) {
+			f->saved.pmdval = pmd_val(*pmd);
+			pmdval = f->saved.pmdval & ~_PAGE_PRESENT;
+		} else
+			pmdval = f->saved.pmdval;
 		set_pmd(pmd, __pmd(pmdval));
 		break;
 
 	case PG_LEVEL_4K:
+		if (clear) {
+			f->saved.pteval = pte_val(*pte);
+			pteval = f->saved.pteval & ~_PAGE_PRESENT;
+		} else
+			pteval = f->saved.pteval;
 		set_pte_atomic(pte, __pte(pteval));
 		break;


Then regardless of was it pmdval or pteval being set, the test

	if (!(faultpage->saved.pteval & _PAGE_PRESENT))

should be ok. But is it?
Can large page (pmd) presence be handled just like a normal page (pte)?


Thanks.

-- 
Pekka Paalanen
http://www.iki.fi/pq/
--
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