lkml.org 
[lkml]   [2005]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [ckrm-tech] Re: [PATCH] Process Events Connector
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-10-29 12:34    [W:2.177 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site