mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Process Accounting 32bit UID/GID support
@ 2002-04-03 22:36 Mike A. Harris
  0 siblings, 0 replies; 2+ messages in thread
From: Mike A. Harris @ 2002-04-03 22:36 UTC (permalink / raw)
  To: marcelo; +Cc: linux-kernel

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

(Apologies to anyone getting this as a dupe, my first mail 
 bounced)

After receiving a handful of bug reports about process accounting
not working properly with 32bit UID/GID's, and investigating the
problem, I discovered the reason was that it just was not 
implemented yet.  After briefly discussing this with Alan and 
Arjan, I've created support for this feature, while maintaining 
full binary backward compatibility with existing tools.

I've also hacked the userland acct package (psacct in Red Hat
Linux) to support the new feature as well, while also remaining
backward compatible with kernels that do not have the new 32bit 
UID/GID patch.

Marcelo, could you add this to the 2.4.x queue?

TIA

-- 
Mike A. Harris                  Shipping/mailing address:
OS Systems Engineer             190 Pittsburgh Ave., Sault Ste. Marie,
XFree86 maintainer              Ontario, Canada, P6C 5B3
Red Hat Inc.
http://www.redhat.com           ftp://people.redhat.com/mharris

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

--- ./kernel/acct.c.psacct-32bit-uid-gid	Mon Apr  1 12:43:33 2002
+++ ./kernel/acct.c	Wed Apr  3 10:17:43 2002
@@ -8,6 +8,9 @@
  *  Some code based on ideas and code from:
  *  Thomas K. Dyas <tdyas@eden.rutgers.edu>
  *
+ *  April 2, 2002 - Mike A. Harris <mharris@redhat.com>
+ *  - added 32bit UID/GID support
+ *
  *  This file implements BSD-style process accounting. Whenever any
  *  process exits, an accounting record of type "struct acct" is
  *  written to the file specified with the acct() system call. It is
@@ -298,8 +301,10 @@
 	ac.ac_etime = encode_comp_t(jiffies - current->start_time);
 	ac.ac_utime = encode_comp_t(current->times.tms_utime);
 	ac.ac_stime = encode_comp_t(current->times.tms_stime);
-	ac.ac_uid = current->uid;
-	ac.ac_gid = current->gid;
+	ac.ac_uid = high2lowuid(current->uid);
+	ac.ac_gid = high2lowgid(current->gid);
+	ac.ac_uid32 = current->uid;
+	ac.ac_gid32 = current->gid;
 	ac.ac_tty = (current->tty) ? kdev_t_to_nr(current->tty->device) : 0;
 
 	ac.ac_flag = 0;
--- ./include/linux/acct.h.psacct-32bit-uid-gid	Mon Apr  1 12:39:28 2002
+++ ./include/linux/acct.h	Wed Apr  3 10:18:40 2002
@@ -3,6 +3,9 @@
  *
  *  Author: Marco van Wieringen (mvw@planets.elm.net)
  *
+ *
+ *  April 2, 2002 - Mike A. Harris <mharris@redhat.com>
+ *  - added 32bit UID/GID support
  *  This header file contains the definitions needed to implement
  *  BSD-style process accounting. The kernel accounting code and all
  *  user-level programs that try to do something useful with the
@@ -56,7 +59,9 @@
 	comp_t		ac_swaps;		/* Accounting Number of Swaps */
 	__u32		ac_exitcode;		/* Accounting Exitcode */
 	char		ac_comm[ACCT_COMM + 1];	/* Accounting Command Name */
-	char		ac_pad[10];		/* Accounting Padding Bytes */
+	__u32		ac_uid32;		/* Accounting Real 32bit User ID */
+	__u32		ac_gid32;		/* Accounting Real 32bit Group ID */
+	char		ac_pad[2];		/* Accounting Padding Bytes */
 };
 
 /*

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

* Re: [PATCH] Process Accounting 32bit UID/GID support
@ 2002-04-04 15:17 Christopher Allen Wing
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Allen Wing @ 2002-04-04 15:17 UTC (permalink / raw)
  To: mharris; +Cc: linux-kernel

Mike:

Are you sure you want to do this:

-	char		ac_pad[10];		/* Accounting Padding Bytes */
+	__u32		ac_uid32;		/* Accounting Real 32bit User ID */
+	__u32		ac_gid32;		/* Accounting Real 32bit Group ID */
+	char		ac_pad[2];		/* Accounting Padding Bytes */



This changes the size of the accounting structure because the new fields
are padded to 4 byte alignment.

Support for process accounting was part of my original patches for 32 bit
UIDs, but it never got picked up. I think that at the time there was an
expectation that accounting was going to be replaced entirely with new
code (SGI accounting stuff?)


Here's an updated version of my patch:

	http://www.engin.umich.edu/caen/systems/Linux/code/misc/acct/linux-2.4.17-acct-uid32.patch


Thanks,

Chris Wing
wingc@engin.umich.edu


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

end of thread, other threads:[~2002-04-04 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-03 22:36 [PATCH] Process Accounting 32bit UID/GID support Mike A. Harris
2002-04-04 15:17 Christopher Allen Wing

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

all inboxes | Powered by JetHome®