All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Kuvyrkov <maxim@codesourcery.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>, linux-m68k@vger.kernel.org
Subject: Re: [PATCH] Fix siginfo._uid bug
Date: Wed, 23 Dec 2009 22:47:50 +0300	[thread overview]
Message-ID: <4B3273E6.8030407@codesourcery.com> (raw)
In-Reply-To: <10f740e80912231037ua8724f4s8965b5c5b255ddfd@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 903 bytes --]

On 12/23/09 9:37 PM, Geert Uytterhoeven wrote:
> On Tue, Nov 24, 2009 at 14:01, Geert Uytterhoeven<geert@linux-m68k.org>  wrote:
>> On Thu, Nov 19, 2009 at 20:47, Maxim Kuvyrkov<maxim@codesourcery.com>  wrote:
...
>>> The question is which solution should we adopt.  The patch I posted fixes
>>> all current problems with have on our hands.  Andreas suggested to move to
>>> the generic layout of `struct siginfo' which will make future problems less
>>> likely, but this approach may need additional investigation.
>>
>> If moving to the generic layout decreases the probability of future problems,
>> it's the way to go.
>
> Do we have a patch somewhere?

Here it is, the patch is rather simple.

I'm swamped at the moment, so I'll appreciate if someone verifies that 
the kernel runs fine with this patch applied.

Regards,

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

[-- Attachment #2: 0001-Switch-m68k-to-generic-siginfo-layout.patch --]
[-- Type: text/plain, Size: 3040 bytes --]

From 83eee1a2ec5f5bead16f1534dc7b8cac05660678 Mon Sep 17 00:00:00 2001
From: Maxim Kuvyrkov <maxim@codesourcery.com>
Date: Wed, 23 Dec 2009 11:28:42 -0800
Subject: [PATCH] Switch m68k to generic siginfo layout.

This patch switches m68k to generic siginfo layout.  The custom layout
of m68k's `struct siginfo' had several issues due to not considering
aliasing of members in the union, e.g., _uid32 was at different offsets
in ._kill, ._rt and ._sigchld.

Signed-off-by: Maxim Kuvyrkov <maxim@codesourcery.com>
---
 arch/m68k/include/asm/siginfo.h |   91 ---------------------------------------
 1 files changed, 0 insertions(+), 91 deletions(-)

diff --git a/arch/m68k/include/asm/siginfo.h b/arch/m68k/include/asm/siginfo.h
index ca7dde8..851d3d7 100644
--- a/arch/m68k/include/asm/siginfo.h
+++ b/arch/m68k/include/asm/siginfo.h
@@ -1,97 +1,6 @@
 #ifndef _M68K_SIGINFO_H
 #define _M68K_SIGINFO_H
 
-#ifndef __uClinux__
-#define HAVE_ARCH_SIGINFO_T
-#define HAVE_ARCH_COPY_SIGINFO
-#endif
-
 #include <asm-generic/siginfo.h>
 
-#ifndef __uClinux__
-
-typedef struct siginfo {
-	int si_signo;
-	int si_errno;
-	int si_code;
-
-	union {
-		int _pad[SI_PAD_SIZE];
-
-		/* kill() */
-		struct {
-			__kernel_pid_t _pid;	/* sender's pid */
-			__kernel_uid_t _uid;	/* backwards compatibility */
-			__kernel_uid32_t _uid32; /* sender's uid */
-		} _kill;
-
-		/* POSIX.1b timers */
-		struct {
-			timer_t _tid;		/* timer id */
-			int _overrun;		/* overrun count */
-			char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
-			sigval_t _sigval;	/* same as below */
-			int _sys_private;       /* not to be passed to user */
-		} _timer;
-
-		/* POSIX.1b signals */
-		struct {
-			__kernel_pid_t _pid;	/* sender's pid */
-			__kernel_uid_t _uid;	/* backwards compatibility */
-			sigval_t _sigval;
-			__kernel_uid32_t _uid32; /* sender's uid */
-		} _rt;
-
-		/* SIGCHLD */
-		struct {
-			__kernel_pid_t _pid;	/* which child */
-			__kernel_uid_t _uid;	/* backwards compatibility */
-			int _status;		/* exit code */
-			clock_t _utime;
-			clock_t _stime;
-			__kernel_uid32_t _uid32; /* sender's uid */
-		} _sigchld;
-
-		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
-		struct {
-			void *_addr; /* faulting insn/memory ref. */
-		} _sigfault;
-
-		/* SIGPOLL */
-		struct {
-			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
-			int _fd;
-		} _sigpoll;
-	} _sifields;
-} siginfo_t;
-
-#define UID16_SIGINFO_COMPAT_NEEDED
-
-/*
- * How these fields are to be accessed.
- */
-#undef si_uid
-#ifdef __KERNEL__
-#define si_uid		_sifields._kill._uid32
-#define si_uid16	_sifields._kill._uid
-#else
-#define si_uid		_sifields._kill._uid
-#endif
-
-#ifdef __KERNEL__
-
-#include <linux/string.h>
-
-static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
-{
-	if (from->si_code < 0)
-		memcpy(to, from, sizeof(*to));
-	else
-		/* _sigchld is currently the largest know union member */
-		memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
-}
-
-#endif /* __KERNEL__ */
-#endif /* !__uClinux__ */
-
 #endif
-- 
1.6.2.4


  reply	other threads:[~2009-12-23 19:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16 16:35 [PATCH] Fix siginfo._uid bug Maxim Kuvyrkov
2009-09-16 19:42 ` Andreas Schwab
2009-09-16 19:56   ` Maxim Kuvyrkov
2009-09-18 15:18   ` Maxim Kuvyrkov
2009-10-02  8:54     ` Maxim Kuvyrkov
2009-10-26 14:21       ` Maxim Kuvyrkov
2009-11-19 19:31         ` Geert Uytterhoeven
2009-11-19 19:47           ` Maxim Kuvyrkov
2009-11-24 13:01             ` Geert Uytterhoeven
2009-12-23 18:37               ` Geert Uytterhoeven
2009-12-23 19:47                 ` Maxim Kuvyrkov [this message]
2010-01-08 19:32                   ` Geert Uytterhoeven

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=4B3273E6.8030407@codesourcery.com \
    --to=maxim@codesourcery.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=schwab@linux-m68k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.