Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000213 [1003.1(2008)/Issue 7] System Interfaces Editorial Enhancement Request 2010-01-14 23:24 2013-04-16 13:06
Reporter EdSchouten View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Ed Schouten
Organization The FreeBSD Project
User Reference
Section endutxent
Page Number n/a
Line Number n/a
Interp Status ---
Final Accepted Text Note: 0000378
Summary 0000213: Definition of pututxline() is slightly too restrictive to allow flexible implementations
Description We at The FreeBSD Project very recently migrated to utmpx for storing user accounting information. We entirely removed the existing utmp interface, because it would be very impractical for us to support both interfaces.

When implementing utmpx I noticed the following. The behaviour of pututxline() is specified as follows:

"If the process has appropriate privileges, the pututxline() function shall write out the structure into the user accounting database. It shall use getutxid() to search for a record that satisfies the request. If this search succeeds, then the entry shall be replaced. Otherwise, a new entry shall be made at the end of the user accounting database."

Now this definition comes with two problems:

- It basically disallows an implementation which does not use the same file descriptor for the reading and the writing interface of the database. It clearly says that getutxid() must be used to search for a record that satisfies the request, while one could easily imagine an implementation which does not do this. For example, Solaris and NetBSD may spawn a setuid application to perform logging when unprivileged. This process may use getutxid() internally, but the point is that its side-effects are not noticeable by the calling process.

- A more serious problem with this definition is that the usage of getutxid() would blow up the database. Say, a login service that uses utmpx uses random values for ut_id to reduce the likelihood of collisions. Then this would mean each login session will have a DEAD_PROCESS entry that will remain in the database indefinitely. We at FreeBSD use a slightly improved allocation algorithm. When writing a USER_PROCESS, LOGIN_PROCESS or INIT_PROCESS record, it searches the database for an entry which has the same value for ut_id. If none is found, it overwrites an arbitrary DEAD_PROCESS record. This means the database will never become bigger than the maximum amount of concurrent sessions.
Desired Action It would be nice if the entire paragraph would be rephrased to something along the lines of:

"If the process has appropriate privileges, the pututxline() function shall write out the structure into the user accounting database. It shall perform a lookup similar to getutxid() to search for a record that satisfies the request. If this search succeeds, then the entry shall be replaced. Otherwise, a new entry shall be added to the user accounting database, which may or may not replace other records."
Tags tc1-2008
Attached Files

- Relationships

-  Notes
(0000375)
EdSchouten (updater)
2010-01-17 21:17

Apart from that, I see a small contradiction in the specification:

According to the table, ut_line has no relevance for LOGIN_PROCESS, but the description of getutxline() clearly says: "The getutxline() function shall search forward from the current point in the database until it finds an entry of the type LOGIN_PROCESS or USER_PROCESS which also has a ut_line value matching that in the utmpx structure pointed to by line."
(0000378)
nick (manager)
2010-01-21 16:41
edited on: 2010-01-21 16:43

We considered this during the 2010-01-21 conference call.

We agree with Note: 0000375 and plan to address that issue by adding ut_line before ut_pid on line 25429.

We are concerned that the main change proposed for this issue would have observable effects on existing applications, and may lead to breaking such applications.

We are willing to remove the absolute requirement to implement pututxline with getutxid, but not to go as far as suggested. Proposed new wording:


      If the process has appropriate privileges, the pututxline( ) function shall write out the structure
      into the user accounting database. It shall search for a record as if by getutxid() that satisfies the
      request. If this search succeeds, then the entry shall be replaced. Otherwise, a new entry shall be
      made at the end of the user accounting database.


- Issue History
Date Modified Username Field Change
2010-01-14 23:24 EdSchouten New Issue
2010-01-14 23:24 EdSchouten Status New => Under Review
2010-01-14 23:24 EdSchouten Assigned To => ajosey
2010-01-14 23:24 EdSchouten Name => Ed Schouten
2010-01-14 23:24 EdSchouten Organization => The FreeBSD Project
2010-01-14 23:24 EdSchouten Section => endutxent
2010-01-14 23:24 EdSchouten Page Number => n/a
2010-01-14 23:24 EdSchouten Line Number => n/a
2010-01-17 21:17 EdSchouten Note Added: 0000375
2010-01-21 16:41 nick Note Added: 0000378
2010-01-21 16:43 nick Note Edited: 0000378
2010-02-11 16:38 msbrown Interp Status => ---
2010-02-11 16:38 msbrown Final Accepted Text => Note: 0000378
2010-02-11 16:38 msbrown Status Under Review => Resolved
2010-02-11 16:38 msbrown Resolution Open => Accepted As Marked
2010-08-27 12:53 ajosey Tag Attached: tc1-2008
2013-04-16 13:06 ajosey Status Resolved => Closed


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker