From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754161Ab2A0Tlp (ORCPT ); Fri, 27 Jan 2012 14:41:45 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:34575 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752631Ab2A0Tlo (ORCPT ); Fri, 27 Jan 2012 14:41:44 -0500 Date: Fri, 27 Jan 2012 23:37:26 +0400 From: Vasiliy Kulikov To: Cyrill Gorcunov Cc: LKML , Andrew Morton , "Eric W. Biederman" , Pavel Emelyanov , KOSAKI Motohiro , Pavel Emelyanov , Andrey Vagin , KOSAKI Motohiro , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Glauber Costa , Andi Kleen , Tejun Heo , Matt Helsley , Pekka Enberg , Eric Dumazet , Alexey Dobriyan , Valdis.Kletnieks@vt.edu Subject: Re: [RFC c/r 2/4] [RFC] syscalls, x86: Add __NR_kcmp syscall v7 Message-ID: <20120127193726.GA13190@albatros> References: <20120127175342.273260614@openvz.org> <20120127175939.795551339@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120127175939.795551339@openvz.org> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Cyrill, On Fri, Jan 27, 2012 at 21:53 +0400, Cyrill Gorcunov wrote: > +/* > + * We don't expose real in-memory order of objects for security > + * reasons, still the comparision results should be suitable for > + * sorting. Thus, we obfuscate kernel pointers values (using random > + * cookies obtaned at early boot stage) and compare the production > + * instead. > + */ > +static unsigned long cookies[KCMP_TYPES][2] __read_mostly; > + > +static long kptr_obfuscate(long v, int type) > +{ > + return (v ^ cookies[type][0]) * cookies[type][1]; AFACS, cookies is fully random value, is it possible that ((v1 ^ cookies[type][0]) * cookies[type][1] == (v2 ^ cookies[type][0]) * cookies[type][1]) && (v1 != v2) for too round cookies[type][1]? Thanks, -- Vasiliy Kulikov http://www.openwall.com - bringing security into open computing environments