Re: + syscalls-x86-add-__nr_kcmp-syscall-v8.patch added to -mm tree

Valdis.Kletnieks
2012-04-11T00:03:43Z

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]

On Mon, 09 Apr 2012 15:10:27 -0700, Andrew Morton said:
> Back on to kcmp.

I've totally forgotten what my original comment(s) on this patch were.. :)

> +/*
> + * 0 - equal, i.e. v1 = v2
> + * 1 - less than, i.e. v1 < v2
> + * 2 - greater than, i.e. v1 > v2
> + * 3 - not equal but ordering unavailable (reserved for future)
> + */
> +static int kcmp_ptr(void *v1, void *v2, enum kcmp_type type)
> +{
> + long ret;
> +
> + ret = kptr_obfuscate((long)v1, type) - kptr_obfuscate((long)v2, type);

I'm not able to convince myself that "less than" and "greater than" mean
anything - do we have a good proof that for all v1 and v2, the obfuscated
pointers have the same ordering as the original pointers?

Hmm... consider the simplified example v1 = 5 and v2= 16., and cookies[0] is
also 16. Then obfus(v1) == 21, and obfus(v2) == 0, and the ordering is
different. So I'm thinking 0 and 3 are the only sane return values?

Or do I need more caffeine?

[-- Attachment #2: Type: application/pgp-signature, Size: 865 bytes --]