public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.6.x BSD Process Accounting w/High UID
@ 2004-03-04 18:04 Arthur Corliss
  2004-03-04 19:51 ` Rik van Riel
  0 siblings, 1 reply; 19+ messages in thread
From: Arthur Corliss @ 2004-03-04 18:04 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Linus Torvalds

[-- Attachment #1: Type: TEXT/PLAIN, Size: 334 bytes --]

Greetings:

The patch only changes two lines which redefine the ac_uid/ac_gid fields as
uid_t/gid_t respectively.  Fixes accounting for high uid/gids.

	--Arthur Corliss
	  Bolverk's Lair -- http://arthur.corlissfamily.org/
	  Digital Mages -- http://www.digitalmages.com/
	  "Live Free or Die, the Only Way to Live" -- NH State Motto

[-- Attachment #2: Type: TEXT/PLAIN, Size: 837 bytes --]

--- linux-2.6.3/include/linux/acct.h    2004-02-17 18:57:18.000000000 -0900
+++ linux/include/linux/acct.h  2004-03-04 08:47:48.000000000 -0900
@@ -41,8 +41,8 @@
  *     No binary format break with 2.0 - but when we hit 32bit uid we'll
  *     have to bite one
  */
-       __u16           ac_uid;                 /* Accounting Real User ID */
-       __u16           ac_gid;                 /* Accounting Real Group ID */
+       uid_t           ac_uid;                 /* Accounting Real User ID */
+       gid_t           ac_gid;                 /* Accounting Real Group ID */
        __u16           ac_tty;                 /* Accounting Control Terminal */
        __u32           ac_btime;               /* Accounting Process Creation Time */
        comp_t          ac_utime;               /* Accounting User Time */

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH] 2.6.x BSD Process Accounting w/High UID
@ 2004-03-10  1:59 Albert Cahalan
  2004-03-10  9:08 ` Tim Schmielau
  0 siblings, 1 reply; 19+ messages in thread
From: Albert Cahalan @ 2004-03-10  1:59 UTC (permalink / raw)
  To: linux-kernel mailing list; +Cc: corliss, riel, tim, jerj

> We might, however, put the magic into the implicit padding
> of ac_flag (ugly, since this would require an arch dependant
> definition of stuct acct), or put it into the uppermost
> three bits of ac_flag itself

First of all, none of this matters much if the format
is given a sysctl. The old format is default for now,
and the new one is default (only?) in a couple years.
Sun appears to have done something like this.

When fixing it, note that a 5-bit binary exponent
with denormals would beat the current float format.

Regarding the existing struct though...

Let's take a close look at this. I think there are 2 bytes
of padding on all Linux ports, and another 2 available
on everything except maybe m68k and/or arm. (that is, ports
that will put a u32 on any u16 boundry) Here is the current
struct, compactly formatted with 64-bit blocking:

struct linux_acct {
        char   ac_flag;        // Flags
// 1 pad byte
        __u16  ac_uid;         // Real User ID    
        __u16  ac_gid;         // Real Group ID      
        __u16  ac_tty;         // Control Terminal

        __u32  ac_btime;       // Process Creation Time
        comp_t ac_utime;       // User Time     
        comp_t ac_stime;       // System Time

        comp_t ac_etime;       // Elapsed Time
        comp_t ac_mem;         // Average Memory Usage
        comp_t ac_io;          // Chars Transferred
        comp_t ac_rw;          // Blocks Read or Written

        comp_t ac_minflt;      // Minor Pagefaults   
        comp_t ac_majflt;      // Major Pagefaults  
        comp_t ac_swaps;       // Number of Swaps
// 2 pad bytes (except m68k or arm maybe?)

        __u32  ac_exitcode;    // Exitcode
// hppa might pad this
        char   ac_comm[17];    // Command Name    
// hppa might pad this
        char   ac_pad[10];     // Padding Bytes
// 1 pad byte (maybe 6 for hppa)
};

Just a sec... ARRRGH WHY DO PEOPLE LEAVE PADDING AND
GENERALLY MIS-ALIGN THINGS ALL THE TIME??????

So there you go. You have a pad byte after ac_flag
at a known location, and a pad byte after ac_pad that
might move a bit due to mis-alignments above it.



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2004-03-11  0:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-04 18:04 [PATCH] 2.6.x BSD Process Accounting w/High UID Arthur Corliss
2004-03-04 19:51 ` Rik van Riel
2004-03-04 20:39   ` Arthur Corliss
2004-03-04 21:54     ` Tim Schmielau
2004-03-04 22:33       ` Arthur Corliss
2004-03-07 17:45         ` [PATCH] " Tim Schmielau
2004-03-07 21:20           ` Tim Schmielau
2004-03-08  0:56           ` Arthur Corliss
2004-03-08  9:08             ` Tim Schmielau
2004-03-08  9:37               ` Arthur Corliss
2004-03-09 16:16         ` [PATCH] " Jeremy Jackson
2004-03-09 18:22           ` Tim Schmielau
  -- strict thread matches above, loose matches on Subject: below --
2004-03-10  1:59 Albert Cahalan
2004-03-10  9:08 ` Tim Schmielau
2004-03-10 16:41   ` Albert Cahalan
2004-03-10 17:28     ` Tim Schmielau
2004-03-10 17:47     ` Tim Schmielau
2004-03-10 22:09       ` Albert Cahalan
2004-03-11  0:55         ` Tim Schmielau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox