signal: Remove the need for __ARCH_SI_PREABLE_SIZE and SI_PAD_SIZE
Rework the defintion of struct siginfo so that the array padding struct siginfo to SI_MAX_SIZE can be placed in a union along side of the rest of the struct siginfo members. The result is that we no longer need the __ARCH_SI_PREAMBLE_SIZE or SI_PAD_SIZE definitions. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
#ifndef _ALPHA_SIGINFO_H
|
#ifndef _ALPHA_SIGINFO_H
|
||||||
#define _ALPHA_SIGINFO_H
|
#define _ALPHA_SIGINFO_H
|
||||||
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
#define __ARCH_SI_TRAPNO
|
#define __ARCH_SI_TRAPNO
|
||||||
|
|
||||||
#include <asm-generic/siginfo.h>
|
#include <asm-generic/siginfo.h>
|
||||||
|
@@ -19,3 +19,4 @@ generic-y += swab.h
|
|||||||
generic-y += termbits.h
|
generic-y += termbits.h
|
||||||
generic-y += termios.h
|
generic-y += termios.h
|
||||||
generic-y += types.h
|
generic-y += types.h
|
||||||
|
generic-y += siginfo.h
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2012 ARM Ltd.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef __ASM_SIGINFO_H
|
|
||||||
#define __ASM_SIGINFO_H
|
|
||||||
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
|
|
||||||
#include <asm-generic/siginfo.h>
|
|
||||||
|
|
||||||
#endif
|
|
@@ -9,8 +9,6 @@
|
|||||||
#define _UAPI_ASM_IA64_SIGINFO_H
|
#define _UAPI_ASM_IA64_SIGINFO_H
|
||||||
|
|
||||||
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
|
|
||||||
#include <asm-generic/siginfo.h>
|
#include <asm-generic/siginfo.h>
|
||||||
|
|
||||||
#define si_imm _sifields._sigfault._imm /* as per UNIX SysV ABI spec */
|
#define si_imm _sifields._sigfault._imm /* as per UNIX SysV ABI spec */
|
||||||
|
@@ -14,17 +14,6 @@
|
|||||||
#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int))
|
#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int))
|
||||||
#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
|
#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
|
||||||
|
|
||||||
/*
|
|
||||||
* Careful to keep union _sifields from shifting ...
|
|
||||||
*/
|
|
||||||
#if _MIPS_SZLONG == 32
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
|
|
||||||
#elif _MIPS_SZLONG == 64
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
#else
|
|
||||||
#error _MIPS_SZLONG neither 32 nor 64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define __ARCH_HAS_SWAPPED_SIGINFO
|
#define __ARCH_HAS_SWAPPED_SIGINFO
|
||||||
|
|
||||||
#include <asm-generic/siginfo.h>
|
#include <asm-generic/siginfo.h>
|
||||||
|
@@ -7,3 +7,4 @@ generic-y += kvm_para.h
|
|||||||
generic-y += param.h
|
generic-y += param.h
|
||||||
generic-y += poll.h
|
generic-y += poll.h
|
||||||
generic-y += resource.h
|
generic-y += resource.h
|
||||||
|
generic-y += siginfo.h
|
||||||
|
@@ -1,11 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
||||||
#ifndef _PARISC_SIGINFO_H
|
|
||||||
#define _PARISC_SIGINFO_H
|
|
||||||
|
|
||||||
#if defined(__LP64__)
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <asm-generic/siginfo.h>
|
|
||||||
|
|
||||||
#endif
|
|
@@ -7,3 +7,4 @@ generic-y += poll.h
|
|||||||
generic-y += resource.h
|
generic-y += resource.h
|
||||||
generic-y += sockios.h
|
generic-y += sockios.h
|
||||||
generic-y += statfs.h
|
generic-y += statfs.h
|
||||||
|
generic-y += siginfo.h
|
||||||
|
@@ -1,18 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
|
||||||
#ifndef _ASM_POWERPC_SIGINFO_H
|
|
||||||
#define _ASM_POWERPC_SIGINFO_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version
|
|
||||||
* 2 of the License, or (at your option) any later version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __powerpc64__
|
|
||||||
# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <asm-generic/siginfo.h>
|
|
||||||
|
|
||||||
#endif /* _ASM_POWERPC_SIGINFO_H */
|
|
@@ -26,3 +26,4 @@ generic-y += swab.h
|
|||||||
generic-y += termbits.h
|
generic-y += termbits.h
|
||||||
generic-y += termios.h
|
generic-y += termios.h
|
||||||
generic-y += types.h
|
generic-y += types.h
|
||||||
|
generic-y += siginfo.h
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012 ARM Ltd.
|
|
||||||
* Copyright (C) 2016 SiFive, Inc.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef __ASM_SIGINFO_H
|
|
||||||
#define __ASM_SIGINFO_H
|
|
||||||
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (__SIZEOF_POINTER__ == 4 ? 12 : 16)
|
|
||||||
|
|
||||||
#include <asm-generic/siginfo.h>
|
|
||||||
|
|
||||||
#endif
|
|
@@ -18,3 +18,4 @@ generic-y += shmbuf.h
|
|||||||
generic-y += sockios.h
|
generic-y += sockios.h
|
||||||
generic-y += swab.h
|
generic-y += swab.h
|
||||||
generic-y += termbits.h
|
generic-y += termbits.h
|
||||||
|
generic-y += siginfo.h
|
@@ -1,17 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
||||||
/*
|
|
||||||
* S390 version
|
|
||||||
*
|
|
||||||
* Derived from "include/asm-i386/siginfo.h"
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _S390_SIGINFO_H
|
|
||||||
#define _S390_SIGINFO_H
|
|
||||||
|
|
||||||
#ifdef __s390x__
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <asm-generic/siginfo.h>
|
|
||||||
|
|
||||||
#endif
|
|
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#if defined(__sparc__) && defined(__arch64__)
|
#if defined(__sparc__) && defined(__arch64__)
|
||||||
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
#define __ARCH_SI_BAND_T int
|
#define __ARCH_SI_BAND_T int
|
||||||
|
|
||||||
#endif /* defined(__sparc__) && defined(__arch64__) */
|
#endif /* defined(__sparc__) && defined(__arch64__) */
|
||||||
|
@@ -7,8 +7,6 @@
|
|||||||
typedef long long __kernel_si_clock_t __attribute__((aligned(4)));
|
typedef long long __kernel_si_clock_t __attribute__((aligned(4)));
|
||||||
# define __ARCH_SI_CLOCK_T __kernel_si_clock_t
|
# define __ARCH_SI_CLOCK_T __kernel_si_clock_t
|
||||||
# define __ARCH_SI_ATTRIBUTES __attribute__((aligned(8)))
|
# define __ARCH_SI_ATTRIBUTES __attribute__((aligned(8)))
|
||||||
# else /* x86-64 */
|
|
||||||
# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -10,18 +10,7 @@ typedef union sigval {
|
|||||||
void __user *sival_ptr;
|
void __user *sival_ptr;
|
||||||
} sigval_t;
|
} sigval_t;
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the size (including padding) of the part of the
|
|
||||||
* struct siginfo that is before the union.
|
|
||||||
*/
|
|
||||||
#ifndef __ARCH_SI_PREAMBLE_SIZE
|
|
||||||
#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SI_MAX_SIZE 128
|
#define SI_MAX_SIZE 128
|
||||||
#ifndef SI_PAD_SIZE
|
|
||||||
#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The default "si_band" type is "long", as specified by POSIX.
|
* The default "si_band" type is "long", as specified by POSIX.
|
||||||
@@ -40,19 +29,7 @@ typedef union sigval {
|
|||||||
#define __ARCH_SI_ATTRIBUTES
|
#define __ARCH_SI_ATTRIBUTES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct siginfo {
|
union __sifields {
|
||||||
int si_signo;
|
|
||||||
#ifndef __ARCH_HAS_SWAPPED_SIGINFO
|
|
||||||
int si_errno;
|
|
||||||
int si_code;
|
|
||||||
#else
|
|
||||||
int si_code;
|
|
||||||
int si_errno;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
union {
|
|
||||||
int _pad[SI_PAD_SIZE];
|
|
||||||
|
|
||||||
/* kill() */
|
/* kill() */
|
||||||
struct {
|
struct {
|
||||||
__kernel_pid_t _pid; /* sender's pid */
|
__kernel_pid_t _pid; /* sender's pid */
|
||||||
@@ -129,7 +106,31 @@ typedef struct siginfo {
|
|||||||
int _syscall; /* triggering system call number */
|
int _syscall; /* triggering system call number */
|
||||||
unsigned int _arch; /* AUDIT_ARCH_* of syscall */
|
unsigned int _arch; /* AUDIT_ARCH_* of syscall */
|
||||||
} _sigsys;
|
} _sigsys;
|
||||||
} _sifields;
|
};
|
||||||
|
|
||||||
|
#ifndef __ARCH_HAS_SWAPPED_SIGINFO
|
||||||
|
#define __SIGINFO \
|
||||||
|
struct { \
|
||||||
|
int si_signo; \
|
||||||
|
int si_errno; \
|
||||||
|
int si_code; \
|
||||||
|
union __sifields _sifields; \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define __SIGINFO \
|
||||||
|
struct { \
|
||||||
|
int si_signo; \
|
||||||
|
int si_code; \
|
||||||
|
int si_errno; \
|
||||||
|
union __sifields _sifields; \
|
||||||
|
}
|
||||||
|
#endif /* __ARCH_HAS_SWAPPED_SIGINFO */
|
||||||
|
|
||||||
|
typedef struct siginfo {
|
||||||
|
union {
|
||||||
|
__SIGINFO;
|
||||||
|
int _si_pad[SI_MAX_SIZE/sizeof(int)];
|
||||||
|
};
|
||||||
} __ARCH_SI_ATTRIBUTES siginfo_t;
|
} __ARCH_SI_ATTRIBUTES siginfo_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -3963,9 +3963,6 @@ __weak const char *arch_vma_name(struct vm_area_struct *vma)
|
|||||||
|
|
||||||
void __init signals_init(void)
|
void __init signals_init(void)
|
||||||
{
|
{
|
||||||
/* If this check fails, the __ARCH_SI_PREAMBLE_SIZE value is wrong! */
|
|
||||||
BUILD_BUG_ON(__ARCH_SI_PREAMBLE_SIZE
|
|
||||||
!= offsetof(struct siginfo, _sifields._pad));
|
|
||||||
BUILD_BUG_ON(sizeof(struct siginfo) != SI_MAX_SIZE);
|
BUILD_BUG_ON(sizeof(struct siginfo) != SI_MAX_SIZE);
|
||||||
|
|
||||||
sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC);
|
sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC);
|
||||||
|
Reference in New Issue
Block a user