Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
7d2f551f
Commit
7d2f551f
authored
Oct 06, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore 32bit aout coredump
just getting rid of bitrot Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
0f6ed63b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
34 deletions
+36
-34
arch/x86/ia32/ia32_aout.c
arch/x86/ia32/ia32_aout.c
+36
-34
No files found.
arch/x86/ia32/ia32_aout.c
View file @
7d2f551f
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <linux/personality.h>
#include <linux/personality.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/jiffies.h>
#include <linux/perf_event.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
#include <asm/pgalloc.h>
...
@@ -33,14 +34,18 @@
...
@@ -33,14 +34,18 @@
#include <asm/ia32.h>
#include <asm/ia32.h>
#undef WARN_OLD
#undef WARN_OLD
#undef CORE_DUMP
/* definitely broken */
static
int
load_aout_binary
(
struct
linux_binprm
*
);
static
int
load_aout_binary
(
struct
linux_binprm
*
);
static
int
load_aout_library
(
struct
file
*
);
static
int
load_aout_library
(
struct
file
*
);
#ifdef CORE_DUMP
#ifdef CONFIG_COREDUMP
static
int
aout_core_dump
(
long
signr
,
struct
pt_regs
*
regs
,
struct
file
*
file
,
static
int
aout_core_dump
(
struct
coredump_params
*
);
unsigned
long
limit
);
static
unsigned
long
get_dr
(
int
n
)
{
struct
perf_event
*
bp
=
current
->
thread
.
ptrace_bps
[
n
];
return
bp
?
bp
->
hw
.
info
.
address
:
0
;
}
/*
/*
* fill in the user structure for a core dump..
* fill in the user structure for a core dump..
...
@@ -48,6 +53,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
...
@@ -48,6 +53,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
static
void
dump_thread32
(
struct
pt_regs
*
regs
,
struct
user32
*
dump
)
static
void
dump_thread32
(
struct
pt_regs
*
regs
,
struct
user32
*
dump
)
{
{
u32
fs
,
gs
;
u32
fs
,
gs
;
memset
(
dump
,
0
,
sizeof
(
*
dump
));
/* changed the size calculations - should hopefully work better. lbt */
/* changed the size calculations - should hopefully work better. lbt */
dump
->
magic
=
CMAGIC
;
dump
->
magic
=
CMAGIC
;
...
@@ -57,15 +63,12 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
...
@@ -57,15 +63,12 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
dump
->
u_dsize
=
((
unsigned
long
)
dump
->
u_dsize
=
((
unsigned
long
)
(
current
->
mm
->
brk
+
(
PAGE_SIZE
-
1
)))
>>
PAGE_SHIFT
;
(
current
->
mm
->
brk
+
(
PAGE_SIZE
-
1
)))
>>
PAGE_SHIFT
;
dump
->
u_dsize
-=
dump
->
u_tsize
;
dump
->
u_dsize
-=
dump
->
u_tsize
;
dump
->
u_ssize
=
0
;
dump
->
u_debugreg
[
0
]
=
get_dr
(
0
);
dump
->
u_debugreg
[
0
]
=
current
->
thread
.
debugreg0
;
dump
->
u_debugreg
[
1
]
=
get_dr
(
1
);
dump
->
u_debugreg
[
1
]
=
current
->
thread
.
debugreg1
;
dump
->
u_debugreg
[
2
]
=
get_dr
(
2
);
dump
->
u_debugreg
[
2
]
=
current
->
thread
.
debugreg2
;
dump
->
u_debugreg
[
3
]
=
get_dr
(
3
);
dump
->
u_debugreg
[
3
]
=
current
->
thread
.
debugreg3
;
dump
->
u_debugreg
[
4
]
=
0
;
dump
->
u_debugreg
[
5
]
=
0
;
dump
->
u_debugreg
[
6
]
=
current
->
thread
.
debugreg6
;
dump
->
u_debugreg
[
6
]
=
current
->
thread
.
debugreg6
;
dump
->
u_debugreg
[
7
]
=
current
->
thread
.
debugreg
7
;
dump
->
u_debugreg
[
7
]
=
current
->
thread
.
ptrace_dr
7
;
if
(
dump
->
start_stack
<
0xc0000000
)
{
if
(
dump
->
start_stack
<
0xc0000000
)
{
unsigned
long
tmp
;
unsigned
long
tmp
;
...
@@ -74,24 +77,24 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
...
@@ -74,24 +77,24 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
dump
->
u_ssize
=
tmp
>>
PAGE_SHIFT
;
dump
->
u_ssize
=
tmp
>>
PAGE_SHIFT
;
}
}
dump
->
regs
.
bx
=
regs
->
bx
;
dump
->
regs
.
e
bx
=
regs
->
bx
;
dump
->
regs
.
cx
=
regs
->
cx
;
dump
->
regs
.
e
cx
=
regs
->
cx
;
dump
->
regs
.
dx
=
regs
->
dx
;
dump
->
regs
.
e
dx
=
regs
->
dx
;
dump
->
regs
.
si
=
regs
->
si
;
dump
->
regs
.
e
si
=
regs
->
si
;
dump
->
regs
.
di
=
regs
->
di
;
dump
->
regs
.
e
di
=
regs
->
di
;
dump
->
regs
.
bp
=
regs
->
bp
;
dump
->
regs
.
e
bp
=
regs
->
bp
;
dump
->
regs
.
ax
=
regs
->
ax
;
dump
->
regs
.
e
ax
=
regs
->
ax
;
dump
->
regs
.
ds
=
current
->
thread
.
ds
;
dump
->
regs
.
ds
=
current
->
thread
.
ds
;
dump
->
regs
.
es
=
current
->
thread
.
es
;
dump
->
regs
.
es
=
current
->
thread
.
es
;
savesegment
(
fs
,
fs
);
savesegment
(
fs
,
fs
);
dump
->
regs
.
fs
=
fs
;
dump
->
regs
.
fs
=
fs
;
savesegment
(
gs
,
gs
);
savesegment
(
gs
,
gs
);
dump
->
regs
.
gs
=
gs
;
dump
->
regs
.
gs
=
gs
;
dump
->
regs
.
orig_ax
=
regs
->
orig_ax
;
dump
->
regs
.
orig_
e
ax
=
regs
->
orig_ax
;
dump
->
regs
.
ip
=
regs
->
ip
;
dump
->
regs
.
e
ip
=
regs
->
ip
;
dump
->
regs
.
cs
=
regs
->
cs
;
dump
->
regs
.
cs
=
regs
->
cs
;
dump
->
regs
.
flags
=
regs
->
flags
;
dump
->
regs
.
e
flags
=
regs
->
flags
;
dump
->
regs
.
sp
=
regs
->
sp
;
dump
->
regs
.
e
sp
=
regs
->
sp
;
dump
->
regs
.
ss
=
regs
->
ss
;
dump
->
regs
.
ss
=
regs
->
ss
;
#if 1
/* FIXME */
#if 1
/* FIXME */
...
@@ -107,7 +110,7 @@ static struct linux_binfmt aout_format = {
...
@@ -107,7 +110,7 @@ static struct linux_binfmt aout_format = {
.
module
=
THIS_MODULE
,
.
module
=
THIS_MODULE
,
.
load_binary
=
load_aout_binary
,
.
load_binary
=
load_aout_binary
,
.
load_shlib
=
load_aout_library
,
.
load_shlib
=
load_aout_library
,
#ifdef CO
RE_
DUMP
#ifdef CO
NFIG_CORE
DUMP
.
core_dump
=
aout_core_dump
,
.
core_dump
=
aout_core_dump
,
#endif
#endif
.
min_coredump
=
PAGE_SIZE
.
min_coredump
=
PAGE_SIZE
...
@@ -122,7 +125,7 @@ static void set_brk(unsigned long start, unsigned long end)
...
@@ -122,7 +125,7 @@ static void set_brk(unsigned long start, unsigned long end)
vm_brk
(
start
,
end
-
start
);
vm_brk
(
start
,
end
-
start
);
}
}
#ifdef CO
RE_
DUMP
#ifdef CO
NFIG_CORE
DUMP
/*
/*
* These are the only things you should do on a core-file: use only these
* These are the only things you should do on a core-file: use only these
* macros to write out all the necessary info.
* macros to write out all the necessary info.
...
@@ -131,14 +134,14 @@ static void set_brk(unsigned long start, unsigned long end)
...
@@ -131,14 +134,14 @@ static void set_brk(unsigned long start, unsigned long end)
#include <linux/coredump.h>
#include <linux/coredump.h>
#define DUMP_WRITE(addr, nr) \
#define DUMP_WRITE(addr, nr) \
if (!dump_write(file, (void *)(addr), (nr))) \
if (!dump_write(
cprm->
file, (void *)(addr), (nr))) \
goto end_coredump;
goto end_coredump;
#define DUMP_SEEK(offset) \
#define DUMP_SEEK(offset) \
if (!dump_seek(file, offset)) \
if (!dump_seek(
cprm->
file, offset)) \
goto end_coredump;
goto end_coredump;
#define START_DATA() (u.u_tsize << PAGE_SHIFT)
#define START_DATA(
u
) (u.u_tsize << PAGE_SHIFT)
#define START_STACK(u) (u.start_stack)
#define START_STACK(u) (u.start_stack)
/*
/*
...
@@ -151,8 +154,7 @@ static void set_brk(unsigned long start, unsigned long end)
...
@@ -151,8 +154,7 @@ static void set_brk(unsigned long start, unsigned long end)
* dumping of the process results in another error..
* dumping of the process results in another error..
*/
*/
static
int
aout_core_dump
(
long
signr
,
struct
pt_regs
*
regs
,
struct
file
*
file
,
static
int
aout_core_dump
(
struct
coredump_params
*
cprm
)
unsigned
long
limit
)
{
{
mm_segment_t
fs
;
mm_segment_t
fs
;
int
has_dumped
=
0
;
int
has_dumped
=
0
;
...
@@ -164,19 +166,19 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
...
@@ -164,19 +166,19 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
has_dumped
=
1
;
has_dumped
=
1
;
strncpy
(
dump
.
u_comm
,
current
->
comm
,
sizeof
(
current
->
comm
));
strncpy
(
dump
.
u_comm
,
current
->
comm
,
sizeof
(
current
->
comm
));
dump
.
u_ar0
=
offsetof
(
struct
user32
,
regs
);
dump
.
u_ar0
=
offsetof
(
struct
user32
,
regs
);
dump
.
signal
=
signr
;
dump
.
signal
=
cprm
->
siginfo
->
si_signo
;
dump_thread32
(
regs
,
&
dump
);
dump_thread32
(
cprm
->
regs
,
&
dump
);
/*
/*
* If the size of the dump file exceeds the rlimit, then see
* If the size of the dump file exceeds the rlimit, then see
* what would happen if we wrote the stack, but not the data
* what would happen if we wrote the stack, but not the data
* area.
* area.
*/
*/
if
((
dump
.
u_dsize
+
dump
.
u_ssize
+
1
)
*
PAGE_SIZE
>
limit
)
if
((
dump
.
u_dsize
+
dump
.
u_ssize
+
1
)
*
PAGE_SIZE
>
cprm
->
limit
)
dump
.
u_dsize
=
0
;
dump
.
u_dsize
=
0
;
/* Make sure we have enough room to write the stack and data areas. */
/* Make sure we have enough room to write the stack and data areas. */
if
((
dump
.
u_ssize
+
1
)
*
PAGE_SIZE
>
limit
)
if
((
dump
.
u_ssize
+
1
)
*
PAGE_SIZE
>
cprm
->
limit
)
dump
.
u_ssize
=
0
;
dump
.
u_ssize
=
0
;
/* make sure we actually have a data and stack area to dump */
/* make sure we actually have a data and stack area to dump */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment