On Tue, Oct 26, 2010 at 1:16 AM, Garrett Cooper <[email protected]> wrote:
> On Tue, Oct 26, 2010 at 1:04 AM, Caspar Zhang <[email protected]> wrote:
>> Hi all,
>>
>> on s390x systems, a string like "MyKey" is not a valid argument
>> for keyctl syscall function, I substitute the string by number
>> to make keyctl testcase work on s390x systems.
>>
>> use "MyKey":
>>
>> keyctl01    1  TPASS  :  KEYCTL_GET_KEYRING_ID succeeded
>> keyctl01    2  TFAIL  :  KEYCTL_REVOKE got unexpected errno: 
>> errno=EINVAL(22): Invalid argument
>>
>> use a number:
>>
>> keyctl01    1  TPASS  :  KEYCTL_GET_KEYRING_ID succeeded
>> keyctl01    2  TPASS  :  KEYCTL_REVOKE got expected errno: errno=???(126): 
>> Required key not available
>>
>> Signed-off-by: Caspar Zhang <[email protected]>
>
>    Looks like a kernel bug to me:
> http://manpages.ubuntu.com/manpages/lucid/man3/keyctl_revoke.3.html .
> EINVAL isn't listed in the manpage.

    FWIW though, the testcase is sort of bogus anyhow by sending in a
pointer to a static char buffer instead of int32_t...

(see http://linux.die.net/man/3/keyctl_revoke )

include/linux/key.h:typedef int32_t key_serial_t;
include/linux/key.h:    key_serial_t            serial;         /* key serial 
number */
include/linux/key.h:extern struct key *key_lookup(key_serial_t id);
include/linux/key.h:static inline key_serial_t key_serial(struct key *key)
include/linux/lsm_audit.h:                      key_serial_t key;
include/linux/syscalls.h:                           key_serial_t destringid);
include/linux/syscalls.h:                               key_serial_t 
destringid);

    So there are two bugs here. The most futureproof way to fix this
is to do do linear probing with something like keyctl(KEYCTL_UNLINK,
i) until you find a value i that isn't already allocated; it might be
wise to linearly probe backwards from INT32_MAX.
Thanks,
-Garrett

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to