public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: Matt Helsley <matthltc@us.ibm.com>
Cc: Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jean-Pierre Dion <jean-pierre.dion@bull.net>,
	Guillaume Thouvenin <guillaume.thouvenin@bull.net>,
	Badari Pulavarty <pbadari@us.ibm.com>,
	Ram Pai <linuxram@us.ibm.com>,
	CKRM-Tech <ckrm-tech@lists.sourceforge.net>,
	Erich Focht <efocht@hpce.nec.com>,
	elsa-devel <elsa-devel@lists.sourceforge.net>,
	Gerrit Huizenga <gh@us.ibm.com>, Adrian Bunk <bunk@stusta.de>,
	"Chandra S. Seetharaman" <sekharan@us.ibm.com>,
	Jay Lan <jlan@engr.sgi.com>, Erik Jacobson <erikj@sgi.com>,
	Jack Steiner <steiner@sgi.com>
Subject: Re: [ckrm-tech] Re: [PATCH] Process Events Connector
Date: Sat, 29 Oct 2005 14:19:43 +0400	[thread overview]
Message-ID: <20051029101943.GA29874@2ka.mipt.ru> (raw)
In-Reply-To: <1130547438.10680.872.camel@stark>

On Fri, Oct 28, 2005 at 05:57:18PM -0700, Matt Helsley (matthltc@us.ibm.com) wrote:
> On Fri, 2005-10-28 at 16:56 -0700, Matt Helsley wrote:
> > OK, I wasn't as thorough as I had hoped re: 64-bit kernel/32-bit
> > userspace. The uid_t and gid_t types appear to present a problem to the
> > following:
> > 
> > User  <-> Kernel
> > i386  <-> x86_64/IA64
> > sparc <-> sparc64
> > s390  <-> s390x
> > 
> > :(
> > 
> > 	I'll look at this some more and see if I need to resubmit. Until then
> > I'll hold off on my request for inclusion in -mm.
> > 
> > Cheers,
> > 	-Matt Helsley
> 
> 	Userspace can include sys/types.h -- in which case uid_t and gid_t
> match -- or linux/types.h -- in which case they are not guaranteed to
> match. To further complicate things translation is not possible because
> the connector broadcasts the events to multiple 'listener's. A mix of 32
> and 64-bit userspace programs could be listening; guaranteeing
> incompatibility if the structure layouts do not match.
> 
> 	This patch addresses the problem by fixing the size to the largest size
> found in the kernel (and likely the largest size needed). This preserves
> the total size of the event structure while ensuring that the event
> structure layouts match.
> 
> 	Are there better alternative solutions?

Do not know about is it better or not, but you can use
a bit in connector header flags to specify if kernelspace has
64 or 32 bit ABI, so your userspace application could use it's own 
__gid_t/__uid_t which match the kernel.
Since connector header has always the same size, you will not have
problems except usage of own, probably non-standard, types.

> Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
> 
> ---
> 
> Index: linux-2.6.14/include/linux/cn_proc.h
> ===================================================================
> --- linux-2.6.14.orig/include/linux/cn_proc.h
> +++ linux-2.6.14/include/linux/cn_proc.h
> @@ -84,16 +84,16 @@ struct proc_event {
>  
>  		struct id_proc_event {
>  			pid_t process_pid;
>  			pid_t process_tgid;
>  			union {
> -				uid_t ruid; /* current->uid */
> -				gid_t rgid; /* current->gid */
> +				__u32 ruid; /* task uid */
> +				__u32 rgid; /* task gid */
>  			};
>  			union {
> -				uid_t euid;
> -				gid_t egid;
> +				__u32 euid;
> +				__u32 egid;
>  			};
>  		} id;
>  
>  		struct exit_proc_event {
>  			pid_t process_pid;
> 

-- 
	Evgeniy Polyakov

      reply	other threads:[~2005-10-29 10:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-28  8:55 [PATCH] Process Events Connector Matt Helsley
2005-10-28  9:19 ` Arjan van de Ven
2005-10-28 10:03   ` Matt Helsley
2005-10-28 23:19 ` Matt Helsley
2005-10-28 23:56   ` Matt Helsley
2005-10-29  0:57     ` [ckrm-tech] " Matt Helsley
2005-10-29 10:19       ` Evgeniy Polyakov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051029101943.GA29874@2ka.mipt.ru \
    --to=johnpol@2ka.mipt.ru \
    --cc=akpm@osdl.org \
    --cc=bunk@stusta.de \
    --cc=ckrm-tech@lists.sourceforge.net \
    --cc=efocht@hpce.nec.com \
    --cc=elsa-devel@lists.sourceforge.net \
    --cc=erikj@sgi.com \
    --cc=gh@us.ibm.com \
    --cc=guillaume.thouvenin@bull.net \
    --cc=jean-pierre.dion@bull.net \
    --cc=jlan@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=matthltc@us.ibm.com \
    --cc=pbadari@us.ibm.com \
    --cc=sekharan@us.ibm.com \
    --cc=steiner@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox