OpenSolaris

Printable Version Enter a New Search
Bug ID 5070257
Synopsis uadmin(A_SHUTDOWN) can return with ualock held
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:syscall
Keywords oss-bite-size
Sponsor
Submitter
Responsible Engineer Colin Gordon
Reported Against s10_64
Duplicate Of
Introduced In solaris_9
Commit to Fix snv_67
Fixed In snv_67
Release Fixed solaris_nevada(snv_67)
Related Bugs 4370240 , 6576116
Submit Date 1-July-2004
Last Update Date 20-June-2007
Description
[dep, 30Jun2004]

  See comments.
[dp: Bite size bug with no description; fixing]

[dep, 30Jun2004]

  kadmin will take ualock on A_SHUTDOWN:

   104  int
   105  kadmin(int cmd, int fcn, void *mdep, cred_t *credp)
   106  {
   ...
   136      /*
   137       * Serialize these operations on ualock.  If it is held, just return
   138       * as if successful since the system will soon reset or remount.
   139       */
   140          if (cmd == A_SHUTDOWN || cmd == A_REBOOT || cmd == A_REMOUNT) {
   141                  if (!mutex_tryenter(&ualock))
   142                          return (0);
   143                  locked = 1;
   144          }

  which it normally drops before returning:

   296          if (locked)
   297                  mutex_exit(&ualock);
   298
   299          return (error);
   300  }

  However, there is one case where it returns immediately:

   146          switch (cmd) {
   147          case A_SHUTDOWN:
   148          {
   149                  proc_t *p = ttoproc(curthread);
   ...

   156                  if (ttoproc(curthread) != &p0) {
   157                          if ((error = exitlwps(0)) != 0)
   158                                  return (error);

  Since we take the lock with a tryenter, I believe the only side
  effect of this is that subsequent attempts to A_SHUTDOWN, A_REBOOT,
  or A_REMOUNT will fail.

  Incidentally, because of the potential failure in the shutdown case,
  the comment on lines 137-138 is incorrect.  Waiting on a cv might be
  preferable to the current locking scheme.
Work Around
N/A
Comments
N/A