View Issue Details

IDProjectCategoryView StatusLast Update
00003451003.1(2008)/Issue 7System Interfacespublic2013-04-16 13:06
Reportereblake Assigned Toajosey  
PrioritynormalSeverityObjectionTypeOmission
Status ClosedResolutionAccepted As Marked 
NameEric Blake
OrganizationRed Hat
User Referenceebb.semop
Sectionsemop
Page Number1840
Line Number58792
Interp StatusApproved
Final Accepted Text0000345:0000615
Summary0000345: semop must update sem_otime
DescriptionHistorically, the sem_otime field associated with a semaphore tracks semop()
actions, and the sem_ctime field tracks particular semctl() actions. The
standard implies this is the case on lines 12708-12709 [XBD <sem.h>], but does
not actually require it.

In particular, this behavior must be enforced to avoid a data race, where
one process creates a semaphore set and another obtains and acts on the set
before the first can initialize the semaphore values.
Desired ActionAt both line 58514 [XSH semctl SETVAL] and line 58526 [SETALL], add a sentence
before "Requires alter permission":

Also, the sem_ctime variable of the semid_ds structure associated with semid
shall be set to the current time.

After line 58541 [semctl IPC_SET], add a sentence:

The sem_ctime variable shall be set to the current time.

At line 58796 [semop DESCRIPTION], add a sentence:

Also, the sem_otime variable of the semid_ds structure associated with semid
shall be set to the current time.
Tagstc1-2008

Relationships

related to 0000335 Closedajosey semget() and semop() examples do not initialize semval 

Activities

eblake

2010-11-11 16:14

manager   bugnote:0000615

Last edited: 2010-11-11 17:10

Interpretation response
-----------------------
The standard clearly states that timestamps shall be updated, and conforming implementations must conform to this.

Rationale:

The description of IPC_STAT says:

    Place the current value of each member of the semid_ds data
    structure associated with semid into the structure pointed to by
    arg.buf, where arg is the fourth argument to semctl(). The
    contents of this structure are defined in <sys/sem.h>.

and the definition of semid_ds in <sys/sem.h> includes these
members:

    time_t sem_otime Last semop() time.
    time_t sem_ctime Last time changed by semctl().

Together these constitute a clear requirement for semctl() IPC_STAT
to set the sem_otime member of arg.buf to the last time a semop()
operation was performed on the semaphore, and to set the sem_ctime
member of arg.buf to the last time the semaphore was changed by a
semctl() call.

However, the following edits will make it clear to the reader, as
well as clarify that timestamps are truncated rather than rounded
if the current time has more precision than time_t.

Notes to the Editor (not part of this interpretation)
-------------------

At line 17067 (XSH 2.7.1 IPC General Description), add a new
paragraph:

In addition to the ipc_perm structure, each associated data structure
includes several time_t fields for recording timestamps of particular
operations. When an operation is described as setting a timestamp to
the current time, that particular timestamp member of the associated
data structure shall be set to the largest time_t value which is not
greater than the current time.

At line 44077 [XSH msgctl IPC_SET], add:

Also, the msg_ctime timestamp shall be set to the current time, as
described in <ref to XSH 2.7.1>.

At line 44145 [XSH msgget], change "set equal to the current time" to
"set to the current time, as described in <ref to XSH 2.7.1>".

At line 44230 [XSH msgrcv], change "set equal to the current time" to
"set to the current time, as described in <ref to XSH 2.7.1>".

At line 44329 [XSH msgsnd], change "set equal to the current time" to
"set to the current time, as described in <ref to XSH 2.7.1>".

At both line 58514 [XSH semctl SETVAL] and line 58526 [SETALL], add a
sentence before "Requires alter permission":

Also, the sem_ctime timestamp shall be set to the current time, as
described in <ref to XSH 2.7.1>.

After line 58541 [semctl IPC_SET], add a sentence:

The sem_ctime timestamp shall be set to the current time, as described
in <ref to XSH 2.7.1>.

At line 58796 [semop DESCRIPTION], add a sentence:

Also, the sem_otime timestamp shall be set to the current time, as
described in <ref to XSH 2.7.1>.

At line 60590 [shmat RETURN VALUE], add a sentence:

Also, the shm_atime timestamp shall be set to the current time, as
described in <ref to XSH 2.7.1>.

At line 60648 [shmctl IPC_SET], add:

Also, the shm_ctime timestamp shall be set to the current time, as
described in <ref to XSH 2.7.1>.

At line 60710 [shmdt RETURN VALUE], add a sentence:

Also, the shm_dtime timestamp shall be set to the current time, as
described in <ref to XSH 2.7.1>.

At line 60760 [shmget], change "set equal to the current time" to
"set to the current time, as described in <ref to XSH 2.7.1>".

ajosey

2010-12-16 16:13

manager   bugnote:0000637

Comments are due on this interpretation by January 16 2011

Issue History

Date Modified Username Field Change
2010-10-28 23:31 eblake New Issue
2010-10-28 23:32 eblake Status New => Under Review
2010-10-28 23:32 eblake Assigned To => ajosey
2010-10-28 23:32 eblake Name => Eric Blake
2010-10-28 23:32 eblake Organization => Red Hat
2010-10-28 23:32 eblake User Reference => ebb.semop
2010-10-28 23:32 eblake Section => semop
2010-10-28 23:32 eblake Page Number => 1840
2010-10-28 23:33 eblake Line Number => 58792
2010-10-28 23:33 eblake Interp Status => ---
2010-10-28 23:41 eblake Relationship added related to 0000335
2010-11-11 16:14 eblake Note Added: 0000615
2010-11-11 16:57 eblake Note Edited: 0000615
2010-11-11 17:01 eblake Note Edited: 0000615
2010-11-11 17:09 eblake Note Edited: 0000615
2010-11-11 17:10 eblake Note Edited: 0000615
2010-11-11 17:13 geoffclare Interp Status --- => Pending
2010-11-11 17:13 geoffclare Final Accepted Text => 0000345:0000615
2010-11-11 17:13 geoffclare Status Under Review => Interpretation Required
2010-11-11 17:13 geoffclare Resolution Open => Accepted As Marked
2010-11-11 17:17 geoffclare Tag Attached: tc1-2008
2010-12-16 16:13 ajosey Interp Status Pending => Proposed
2010-12-16 16:13 ajosey Note Added: 0000637
2011-01-18 12:30 ajosey Interp Status Proposed => Approved
2013-04-16 13:06 ajosey Status Interpretation Required => Closed