sps on Solaris 2.3?

sps on Solaris 2.3?

Post by Ernest K » Fri, 26 Aug 1994 22:55:05



Has anyone gotten sps (a ps like program) to compile for Solaris 2.3?
I'd appreciate any help I can get to compile.  If not, does anyone
know of a program like sps for Solaris 2.3?

-Ernie

 
 
 

sps on Solaris 2.3?

Post by Rob McMah » Sun, 28 Aug 1994 01:36:07



Quote:Kim) writes:
>Has anyone gotten sps (a ps like program) to compile for Solaris 2.3?  I'd
>appreciate any help I can get to compile.  If not, does anyone know of a
>program like sps for Solaris 2.3?

Funny you should mention it, I've just today got a version of sps working on
Solaris 2.  It doesn't try to interpret wait channels ... I think I'm going to
have to leave that to someone with more knowledge of the Solaris internals.
I also don't know how to find out the controlling process group for a given
tty device ... any offers ?  It's only been tested on SunOS 4.1.3 and SunOS
5.3, I may have broken it for other platforms, if so I'd like to hear about
it.

Anyway, it's in

ftp.csv.warwick.ac.uk:/pub/solaris/sps-sol2.tar.gz

Have fun, and let me know how it goes.

Cheers,

Rob
--
UUCP:   ...!mcsun!uknet!warwick!cudcv   PHONE:  +44 203 523037

Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England

 
 
 

sps on Solaris 2.3?

Post by Simon Lein » Thu, 08 Sep 1994 02:22:27


Davin> The only thing is that it needs to run setuid root, and "make
Davin> install" doesn't set that bit.  (It needs to be setuid root,
Davin> because Solaris makes the /proc filesystem readable only by
Davin> root, rather than by group sys, as would seem sane.  And
Davin> therefore /usr/bin/ps and /usr/ucb/ps are also setuid root.)

Your reasons are convincing, but installing "sps" as setuid root
creates a severe security problem, because sps has not been designed
to be setuid root.

On a most systems in their standard configuration (Solaris 2.3 in any
case), sps with setuid root privileges can be used to destroy the
contents of arbitrary files on the system.
--
Simon.

 
 
 

sps on Solaris 2.3?

Post by Rob McMah » Thu, 08 Sep 1994 22:45:39



Quote:Leinen) writes:
>... installing "sps" as setuid root creates a severe security problem,
>because sps has not been designed to be setuid root.

OK.  The problems I know of have been fixed.  Grab a new copy from
ftp.csv.warwick.ac.uk:/pub/solaris2/sps-sol2.tar.gz, or apply the following
patch (you'll get varying line numbers for main.c).

Cheers,

Rob

------------------------------------------------------------------------------
*** 2.1 1994/08/27 10:18:31
--- main.c      1994/09/07 13:27:40
***************
*** 108,113 ****
--- 110,116 ----
        if ( Flg.flg_i )
        {       /* -i flag for info file initialisation */
                /* sps probably running setgid so patch security hole now */
+               (void)setuid( getuid() ) ;
                (void)setgid( getgid() ) ;
                initialise() ;          
                exit( 0 ) ;
*** 2.1 1994/08/27 10:18:31
--- flagdecode.c        1994/09/07 11:21:30
***************
*** 73,78 ****
--- 73,82 ----
                                        continue ;
                                case 'k' :
                                case 'K' :
+                                       /* Get rid of privileges before
+                                          opening random files. */
+                                       (void) setuid(getuid());
+                                       (void) setgid(getgid());
                                        /* Use a disc file such as /vmcore
                                           rather than /dev/{k}mem for
                                           accessing kernel data. The next
------------------------------------------------------------------------------
--
UUCP:   ...!mcsun!uknet!warwick!cudcv   PHONE:  +44 203 523037

Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England

 
 
 

sps on Solaris 2.3?

Post by Hans van Staver » Thu, 08 Sep 1994 23:34:40



>*** 2.1     1994/08/27 10:18:31
>--- main.c  1994/09/07 13:27:40
>***************
>*** 108,113 ****
>--- 110,116 ----
>    if ( Flg.flg_i )
>    {       /* -i flag for info file initialisation */
>            /* sps probably running setgid so patch security hole now */
>+           (void)setuid( getuid() ) ;
>            (void)setgid( getgid() ) ;
>            initialise() ;          
>            exit( 0 ) ;

I may be showing my age, but there was definitely a time when the setgid and setuid
had to be in the other order. After a setuid you couldn't do a setgid anymore, because
a setgid was only allowed for root, and after the setuid you weren't anymore.

If you are not sure, please check this out.

--
Hans van Staveren          URL: http://www.cs.vu.nl/users/staff/sater/home.html

They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety                         -- Benjamin Franklin

 
 
 

sps on Solaris 2.3?

Post by Davin Mil » Mon, 29 Aug 1994 02:27:59



Quote:

>Funny you should mention it, I've just today got a version of sps working on
>Solaris 2.  It doesn't try to interpret wait channels ... I think I'm going to
>have to leave that to someone with more knowledge of the Solaris internals.
>I also don't know how to find out the controlling process group for a given
>tty device ... any offers ?  It's only been tested on SunOS 4.1.3 and SunOS
>5.3, I may have broken it for other platforms, if so I'd like to hear about
>it.

>Anyway, it's in

>ftp.csv.warwick.ac.uk:/pub/solaris/sps-sol2.tar.gz

>Have fun, and let me know how it goes.

It's actually in ftp.csv.warwick.ac.uk:/pub/solaris2/sps-sol2.tar.gz
but it seems wonderful!  

The only thing is that it needs to run setuid root, and "make install"
doesn't set that bit.  (It needs to be setuid root, because Solaris makes
the /proc filesystem readable only by root, rather than by group sys, as
would seem sane.  And therefore /usr/bin/ps and /usr/ucb/ps are also setuid
root.)

Thanks for the work - we've been waiting and hoping that someone would port
it.

Davin.
-------------------------------------------------------------------------------


               Fax:       (716) 645-3464

 
 
 

sps on Solaris 2.3?

Post by Richard Mathe » Sun, 25 Sep 1994 04:54:35




>>Funny you should mention it, I've just today got a version of sps working on
>>Solaris 2...
>It's actually in ftp.csv.warwick.ac.uk:/pub/solaris2/sps-sol2.tar.gz
>but it seems wonderful!  

I have modified this so that it now also works for Solaris 2.4.  I only
tested this on x86, but I see no reason why it would not also work on
SPARC.  I also didn't do a whole lot to really test it.

The changes needed are:

Add -DSOLARIS24 to your makefile.

Change filecount.c and sps.h as follows:

*** sps-sol2/filecount.c        Sat Aug 27 03:18:31 1994
--- ./filecount.c       Fri Sep 23 12:46:27 1994
***************
*** 12,18 ****
--- 12,22 ----
        register int            count ;
        extern union userstate  User ;
  #ifdef        SVR4
+ #ifdef        SOLARIS24
+       struct uf_entry         *f;
+ #else /* !SOLARIS24 */
        struct ufchunk          chunk, *ufp;
+ #endif        /* !SOLARIS24 */
  #else /* !SVR4 */
        register struct file    **f ;
  #endif        /* SVR4 */
***************
*** 66,71 ****
--- 70,86 ----
  # else SUNOS41
        count = 0 ;
  #ifdef        SVR4
+ #ifdef        SOLARIS24
+       if ((i = User.u_us.u_nofiles) > 0) {
+               f = (struct uf_entry *) getcore(i * sizeof(*f));
+               if (getkmem((long)User.u_us.u_flist, (void *)f, i * sizeof(*f))
+               != i * sizeof(*f))
+                       return 0;
+               while (i--)
+                       if (f++->uf_ofile)
+                               count++;
+       }
+ #else /* !SOLARIS24 */
        ufp = &User.u_us.u_flist;
        do {
            for (i = 0; i < NFPCHUNK; i++) {
***************
*** 75,80 ****
--- 90,96 ----
        } while ((ufp = ufp->uf_next) != 0 &&
                 getkmem((long)ufp, (void *)&chunk, sizeof(chunk)) == sizeof(chunk) &&
                 (ufp = &chunk));
+ #endif        /* !SOLARIS24 */
  #else /* !SVR4 */
        for ( i = 0, f = User.u_us.u_ofile ; i < NOFILE ; i++ )
                if ( *f++ )

*** sps-sol2/sps.h      Wed Sep  7 10:07:59 1994
--- ./sps.h     Fri Sep 23 12:31:49 1994
***************
*** 14,19 ****
--- 14,22 ----
  #include <sys/types.h>
  #include <sys/procfs.h>
  #define _KMEMUSER
+ #if   defined(i386) && defined(SOLARIS24)
+ #define       _SYS_PSW_H      /* hack to not use struct flags definition in psw.h */
+ #endif        /* i386 && SOLARIS24 */
  #include <sys/user.h>
  #else /* !SVR4 */
  # ifdef SUNOS40

 
 
 

sps on Solaris 2.3?

Post by Rob McMah » Tue, 27 Sep 1994 17:40:33



Quote:(Richard Mathews) writes:
>>It's actually in ftp.csv.warwick.ac.uk:/pub/solaris2/sps-sol2.tar.gz
>>but it seems wonderful!  

>I have modified this so that it now also works for Solaris 2.4.  I only
>tested this on x86, but I see no reason why it would not also work on SPARC.

Thanks!  I've merged this into my sources, created a `Makefile.sun.5.4' and
tested it on SPARC 2.4.  All seems well.

Cheers,

Rob
--
UUCP:   ...!mcsun!uknet!warwick!cudcv   PHONE:  +44 203 523037

Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England

 
 
 

sps on Solaris 2.3?

Post by Rob McMah » Wed, 28 Sep 1994 17:11:03



>Thanks!  I've merged this into my sources, created a `Makefile.sun.5.4' and
>tested it on SPARC 2.4.  All seems well.

Oops.  I accidentally included the new Makefile.sun.5.4 as Makefile.sun.5.3 in
the release version, which would give compile errors with filecount.c on SunOS
5.3.  Fixed.

Rob
--
UUCP:   ...!mcsun!uknet!warwick!cudcv   PHONE:  +44 203 523037

Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England

 
 
 

1. wanted: sps for Solaris 2.3

I see this question asked every once in a while, but so far I've never
seen it answered in the affirmative, so I guess it's time to ask it
again: has anyone succeeded in porting sps to Solaris 2.3?
--
 Matt Landau                Technical Director, Application Toolkits

 Waiting for a flash of enlightenment in all this blood and thunder.

2. signals -

3. sps and top for Solaris 2.3 ???

4. INN Problems

5. seeking latest 'sps' source for Solaris 2.3

6. Info about AMD K6 sig11 bug

7. HELP: Solaris 2.3 <---> Solaris 2.3 PPP link problems

8. SLIP is not [C]SLIP -- help?

9. HELP: Solaris 2.3 <---> Solaris 2.3 PPP link Problems

10. Help with Pageview under 2.3 (Re: Display Postscript X Solaris 2.3)

11. SLIP for Solaris 2.3: slip-solaris-3

12. Solaris 2.4 vs. Solaris 2.3

13. Solaris 2.3, Sparc 5 to Solaris 2.5, Ultra 170E upgrade