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]
Date:	Fri, 14 Dec 2007 17:52:52 +0100
From:	Markus Metzger <markus.t.metzger@...el.com>
To:	ak@...e.de, hpa@...or.com, linux-kernel@...r.kernel.org,
	mingo@...e.hu, tglx@...utronix.de
Cc:	markus.t.metzger@...el.com, markus.t.metzger@...il.com,
	suresh.b.siddha@...el.com, roland@...hat.com,
	akpm@...ux-foundation.org, mtk.manpages@...il.com
Subject: [patch 2/5] x86, ptrace: use jiffies for BTS timestamps

Replace sched_clock() with jiffies for BTS timestamps.

Signed-off-by: Markus Metzger <markus.t.metzger@...el.com>
---

Index: linux-2.6-x86/arch/x86/kernel/ptrace.c
===================================================================
--- linux-2.6-x86.orig/arch/x86/kernel/ptrace.c	2007-12-10 09:47:57.%N +0100
+++ linux-2.6-x86/arch/x86/kernel/ptrace.c	2007-12-10 10:11:37.%N +0100
@@ -616,7 +616,7 @@
 {
 	struct bts_struct rec = {
 		.qualifier = qualifier,
-		.variant.timestamp = sched_clock()
+		.variant.jiffies = jiffies
 	};
 
 	if (ptrace_bts_get_buffer_size(tsk) <= 0)
Index: linux-2.6-x86/include/asm-x86/ds.h
===================================================================
--- linux-2.6-x86.orig/include/asm-x86/ds.h	2007-12-10 09:47:57.%N +0100
+++ linux-2.6-x86/include/asm-x86/ds.h	2007-12-10 10:11:37.%N +0100
@@ -48,7 +48,7 @@
 		} lbr;
 		/* BTS_TASK_ARRIVES or
 		   BTS_TASK_DEPARTS */
-		unsigned long long timestamp;
+		unsigned long jiffies;
 	} variant;
 };
 
Index: linux-2.6-x86/arch/x86/kernel/ds.c
===================================================================
--- linux-2.6-x86.orig/arch/x86/kernel/ds.c	2007-12-10 09:13:55.%N +0100
+++ linux-2.6-x86/arch/x86/kernel/ds.c	2007-12-10 10:22:43.%N +0100
@@ -167,23 +167,13 @@
 {
 	(*(unsigned char *)(base + ds_cfg.info_type.offset)) = value;
 }
-/*
- * The info data might overlap with the info type on some architectures.
- * We therefore read and write the exact number of bytes.
- */
-static inline unsigned long long get_info_data(char *base)
-{
-	unsigned long long value = 0;
-	memcpy(&value,
-	       base + ds_cfg.info_data.offset,
-	       ds_cfg.info_data.size);
-	return value;
-}
-static inline void set_info_data(char *base, unsigned long long value)
-{
-	memcpy(base + ds_cfg.info_data.offset,
-	       &value,
-	       ds_cfg.info_data.size);
+static inline unsigned long get_info_data(char *base)
+{
+	return *(unsigned long *)(base + ds_cfg.info_data.offset);
+}
+static inline void set_info_data(char *base, unsigned long value)
+{
+	(*(unsigned long *)(base + ds_cfg.info_data.offset)) = value;
 }
 
 
@@ -282,8 +272,8 @@
 
 	memset(out, 0, sizeof(*out));
 	if (get_from_ip(bts) == BTS_ESCAPE_ADDRESS) {
-		out->qualifier         = get_info_type(bts);
-		out->variant.timestamp = get_info_data(bts);
+		out->qualifier       = get_info_type(bts);
+		out->variant.jiffies = get_info_data(bts);
 	} else {
 		out->qualifier = BTS_BRANCH;
 		out->variant.lbr.from_ip = get_from_ip(bts);
@@ -319,7 +309,7 @@
 	case BTS_TASK_DEPARTS:
 		set_from_ip(bts, BTS_ESCAPE_ADDRESS);
 		set_info_type(bts, in->qualifier);
-		set_info_data(bts, in->variant.timestamp);
+		set_info_data(bts, in->variant.jiffies);
 		break;
 
 	default:
@@ -350,7 +340,7 @@
 	.from_ip = { 0, 4 },
 	.to_ip = { 4, 4 },
 	.info_type = { 4, 1 },
-	.info_data = { 5, 7 },
+	.info_data = { 8, 4 },
 	.debugctl_mask = (1<<2)|(1<<3)
 };
 
@@ -364,7 +354,7 @@
 	.from_ip = { 0, 4 },
 	.to_ip = { 4, 4 },
 	.info_type = { 4, 1 },
-	.info_data = { 5, 7 },
+	.info_data = { 8, 4 },
 	.debugctl_mask = (1<<6)|(1<<7)
 };
 #endif /* _i386_ */
@@ -379,7 +369,7 @@
 	.from_ip = { 0, 8 },
 	.to_ip = { 8, 8 },
 	.info_type = { 8, 1 },
-	.info_data = { 9, 7 },
+	.info_data = { 16, 8 },
 	.debugctl_mask = (1<<6)|(1<<7)|(1<<9)
 };
 
---------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 Ust.-IdNr.
VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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