lkml.org 
[lkml]   [2012]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: + syscalls-x86-add-__nr_kcmp-syscall-v8.patch added to -mm tree
On Tue, Apr 10, 2012 at 03:39:53PM -0700, H. Peter Anvin wrote:
> On 04/10/2012 03:37 PM, Cyrill Gorcunov wrote:
> > + * bits even more (the oddity is important here, it allow
> > + * us to have meaningful production even if multiplicants
> > + * are big numbers).
>
> I would be more clear:
>
> "the odd multiplier guarantees that the product is unique ever after the
> high bits are truncated, since any odd number is relative prime to 2^n".
>

Yeah, updated, thanks. Andrew, fold it up please.

---
Subject: Add a comment on kcmp obfuscation method

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: "H. Peter Anvin" <hpa@zytor.com>
---
kernel/kcmp.c | 11 +++++++++++
1 file changed, 11 insertions(+)

Index: linux-2.6.git/kernel/kcmp.c
===================================================================
--- linux-2.6.git.orig/kernel/kcmp.c
+++ linux-2.6.git/kernel/kcmp.c
@@ -17,6 +17,17 @@
* reasons, still the comparison results should be suitable for
* sorting. Thus, we obfuscate kernel pointers values and compare
* the production instead.
+ *
+ * The obfuscation is done in two steps. First -- we use xor on
+ * kernel pointer with random value, which puts pointer into
+ * a new position in reordered space. Second -- we multiply
+ * the xor production with big odd random number to permute
+ * bits even more (the odd multiplier guarantees that the product
+ * is unique ever after the high bits are truncated, since any odd
+ * number is relative prime to 2^n).
+ *
+ * Note also the obfuscation itself is invisible to user-space
+ * and if needed it can be changed to any suitable scheme.
*/
static unsigned long cookies[KCMP_TYPES][2] __read_mostly;


\
 
 \ /
  Last update: 2012-04-11 00:51    [W:0.357 / U:0.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site