linux-stable/include/linux/elfcore-compat.h
Al Viro 7facdc426f [amd64] clean PRSTATUS_SIZE/SET_PR_FPVALID up properly
To get rid of hardcoded size/offset in those macros we need to have
a definition of i386 variant of struct elf_prstatus.  However, we can't
do that in asm/compat.h - the types needed for that are not there and
adding an include of asm/user32.h into asm/compat.h would cause a lot
of mess.

That could be conveniently done in elfcore-compat.h, but currently there
is nowhere to put arch-dependent parts of it - no asm/elfcore-compat.h.
So we introduce a new file (asm/elfcore-compat.h, present on architectures
that have CONFIG_ARCH_HAS_ELFCORE_COMPAT set, currently only on x86),
have it pulled by linux/elfcore-compat.h and move the definitions there.

As a side benefit, we don't need to worry about accidental inclusion of
that file into binfmt_elf.c itself, so we don't need the dance with
COMPAT_PRSTATUS_SIZE, etc. - only fs/compat_binfmt_elf.c will see
that header.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2021-01-06 08:40:56 -05:00

61 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_ELFCORE_COMPAT_H
#define _LINUX_ELFCORE_COMPAT_H
#include <linux/elf.h>
#include <linux/elfcore.h>
#include <linux/compat.h>
/*
* Make sure these layouts match the linux/elfcore.h native definitions.
*/
struct compat_elf_siginfo
{
compat_int_t si_signo;
compat_int_t si_code;
compat_int_t si_errno;
};
struct compat_elf_prstatus_common
{
struct compat_elf_siginfo pr_info;
short pr_cursig;
compat_ulong_t pr_sigpend;
compat_ulong_t pr_sighold;
compat_pid_t pr_pid;
compat_pid_t pr_ppid;
compat_pid_t pr_pgrp;
compat_pid_t pr_sid;
struct old_timeval32 pr_utime;
struct old_timeval32 pr_stime;
struct old_timeval32 pr_cutime;
struct old_timeval32 pr_cstime;
};
struct compat_elf_prpsinfo
{
char pr_state;
char pr_sname;
char pr_zomb;
char pr_nice;
compat_ulong_t pr_flag;
__compat_uid_t pr_uid;
__compat_gid_t pr_gid;
compat_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
char pr_fname[16];
char pr_psargs[ELF_PRARGSZ];
};
#ifdef CONFIG_ARCH_HAS_ELFCORE_COMPAT
#include <asm/elfcore-compat.h>
#endif
struct compat_elf_prstatus
{
struct compat_elf_prstatus_common common;
compat_elf_gregset_t pr_reg;
compat_int_t pr_fpvalid;
};
#endif /* _LINUX_ELFCORE_COMPAT_H */