Bug 9944 - ftok returning duplicate keys for different files on same device?
Summary: ftok returning duplicate keys for different files on same device?
Status: RESOLVED WONTFIX
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-12 13:39 UTC by Jim
Modified: 2014-07-01 20:38 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim 2009-03-12 13:39:53 UTC
I have encountered an issue using System V IPC and ftok.

I have two files in my /tmp/ dir with inodes 0x70007 and 0x1370007. When call
ftok on these two files I am obtaining the same 32 bit key_t value.

This results in collisions when two unique process using different files try to
obtain SysV IPC objects using ftok().

Should key_t be only a 32 integer? 

I can not find any documentation on 'standard' practice to recover from this
problem so I assume it just may be a bug?
Comment 1 Ulrich Drepper 2009-03-12 15:06:36 UTC
That's why those interfaces got replaced by something better.  There is no way
to avoid duplicates.
Comment 2 Jim 2009-03-12 15:31:26 UTC
My understanding is the ftok returns a 'key_t' ... i don't know the standard
very well ... but I assume it does not dictate an int32 be used for 'key_t'?