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]
Date:	Fri, 10 Apr 2009 16:12:24 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] unbreak alpha percpu

asm-generic/percpu.h is *NOT* included by every asm/percpu.h out there.
Namely, alpha can't use it since it needs the var name in
SHIFT_PERCPU_PTR - &per_cpu_var(var) won't do at all.  So adding stuff
to asm-generic/percpu.h and expecting it to be picked by everything
is not going to work.

Frankly, I'd rather have SHIFT_PERCPU_PTR() calling conventions changed,
but for now the patch below will do.

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
diff --git a/arch/alpha/include/asm/percpu.h b/arch/alpha/include/asm/percpu.h
index 3495e8e..fffec74 100644
--- a/arch/alpha/include/asm/percpu.h
+++ b/arch/alpha/include/asm/percpu.h
@@ -75,4 +75,30 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
 
 #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu_var(name)
 
+# define percpu_read(var)						\
+  ({									\
+	typeof(per_cpu_var(var)) __tmp_var__;				\
+	__tmp_var__ = get_cpu_var(var);					\
+	put_cpu_var(var);						\
+	__tmp_var__;							\
+  })
+
+#define __percpu_generic_to_op(var, val, op)				\
+do {									\
+	get_cpu_var(var) op val;					\
+	put_cpu_var(var);						\
+} while (0)
+
+# define percpu_write(var, val)		__percpu_generic_to_op(var, (val), =)
+
+# define percpu_add(var, val)		__percpu_generic_to_op(var, (val), +=)
+
+# define percpu_sub(var, val)		__percpu_generic_to_op(var, (val), -=)
+
+# define percpu_and(var, val)		__percpu_generic_to_op(var, (val), &=)
+
+# define percpu_or(var, val)		__percpu_generic_to_op(var, (val), |=)
+
+# define percpu_xor(var, val)		__percpu_generic_to_op(var, (val), ^=)
+
 #endif /* __ALPHA_PERCPU_H */
--
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