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
cdc3d562
Commit
cdc3d562
authored
Oct 05, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch elf_coredump_extra_notes_write() to dump_emit()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
e6c1baa9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
38 deletions
+30
-38
arch/powerpc/include/asm/spu.h
arch/powerpc/include/asm/spu.h
+2
-1
arch/powerpc/platforms/cell/spu_syscalls.c
arch/powerpc/platforms/cell/spu_syscalls.c
+3
-2
arch/powerpc/platforms/cell/spufs/coredump.c
arch/powerpc/platforms/cell/spufs/coredump.c
+17
-27
arch/powerpc/platforms/cell/spufs/spufs.h
arch/powerpc/platforms/cell/spufs/spufs.h
+2
-1
fs/binfmt_elf.c
fs/binfmt_elf.c
+3
-4
include/linux/elf.h
include/linux/elf.h
+3
-3
No files found.
arch/powerpc/include/asm/spu.h
View file @
cdc3d562
...
@@ -235,6 +235,7 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
...
@@ -235,6 +235,7 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
/* syscalls implemented in spufs */
/* syscalls implemented in spufs */
struct
file
;
struct
file
;
struct
coredump_params
;
struct
spufs_calls
{
struct
spufs_calls
{
long
(
*
create_thread
)(
const
char
__user
*
name
,
long
(
*
create_thread
)(
const
char
__user
*
name
,
unsigned
int
flags
,
umode_t
mode
,
unsigned
int
flags
,
umode_t
mode
,
...
@@ -242,7 +243,7 @@ struct spufs_calls {
...
@@ -242,7 +243,7 @@ struct spufs_calls {
long
(
*
spu_run
)(
struct
file
*
filp
,
__u32
__user
*
unpc
,
long
(
*
spu_run
)(
struct
file
*
filp
,
__u32
__user
*
unpc
,
__u32
__user
*
ustatus
);
__u32
__user
*
ustatus
);
int
(
*
coredump_extra_notes_size
)(
void
);
int
(
*
coredump_extra_notes_size
)(
void
);
int
(
*
coredump_extra_notes_write
)(
struct
file
*
file
,
loff_t
*
foffset
);
int
(
*
coredump_extra_notes_write
)(
struct
coredump_params
*
cprm
);
void
(
*
notify_spus_active
)(
void
);
void
(
*
notify_spus_active
)(
void
);
struct
module
*
owner
;
struct
module
*
owner
;
};
};
...
...
arch/powerpc/platforms/cell/spu_syscalls.c
View file @
cdc3d562
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/syscalls.h>
#include <linux/rcupdate.h>
#include <linux/rcupdate.h>
#include <linux/binfmts.h>
#include <asm/spu.h>
#include <asm/spu.h>
...
@@ -126,7 +127,7 @@ int elf_coredump_extra_notes_size(void)
...
@@ -126,7 +127,7 @@ int elf_coredump_extra_notes_size(void)
return
ret
;
return
ret
;
}
}
int
elf_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
)
int
elf_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
)
{
{
struct
spufs_calls
*
calls
;
struct
spufs_calls
*
calls
;
int
ret
;
int
ret
;
...
@@ -135,7 +136,7 @@ int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
...
@@ -135,7 +136,7 @@ int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
if
(
!
calls
)
if
(
!
calls
)
return
0
;
return
0
;
ret
=
calls
->
coredump_extra_notes_write
(
file
,
foffset
);
ret
=
calls
->
coredump_extra_notes_write
(
cprm
);
spufs_calls_put
(
calls
);
spufs_calls_put
(
calls
);
...
...
arch/powerpc/platforms/cell/spufs/coredump.c
View file @
cdc3d562
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
#include <linux/gfp.h>
#include <linux/gfp.h>
#include <linux/list.h>
#include <linux/list.h>
#include <linux/syscalls.h>
#include <linux/syscalls.h>
#include <linux/coredump.h>
#include <linux/binfmts.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
...
@@ -52,35 +54,24 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
...
@@ -52,35 +54,24 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
* 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
* functions to write out all the necessary info.
* functions to write out all the necessary info.
*/
*/
static
int
spufs_dump_write
(
struct
file
*
file
,
const
void
*
addr
,
int
nr
,
loff_t
*
foffset
)
static
int
spufs_dump_write
(
struct
coredump_params
*
cprm
,
const
void
*
addr
,
int
nr
)
{
{
unsigned
long
limit
=
rlimit
(
RLIMIT_CORE
);
if
(
!
dump_emit
(
cprm
,
addr
,
nr
))
ssize_t
written
;
if
(
*
foffset
+
nr
>
limit
)
return
-
EIO
;
return
-
EIO
;
written
=
file
->
f_op
->
write
(
file
,
addr
,
nr
,
&
file
->
f_pos
);
*
foffset
+=
written
;
if
(
written
!=
nr
)
return
-
EIO
;
return
0
;
return
0
;
}
}
static
int
spufs_dump_align
(
struct
file
*
file
,
char
*
buf
,
loff_t
new_off
,
static
int
spufs_dump_align
(
struct
coredump_params
*
cprm
,
char
*
buf
,
loff_t
new_off
)
loff_t
*
foffset
)
{
{
int
rc
,
size
;
int
rc
,
size
;
size
=
min
((
loff_t
)
PAGE_SIZE
,
new_off
-
*
foffset
);
size
=
min
((
loff_t
)
PAGE_SIZE
,
new_off
-
cprm
->
written
);
memset
(
buf
,
0
,
size
);
memset
(
buf
,
0
,
size
);
rc
=
0
;
rc
=
0
;
while
(
rc
==
0
&&
new_off
>
*
foffset
)
{
while
(
rc
==
0
&&
new_off
>
cprm
->
written
)
{
size
=
min
((
loff_t
)
PAGE_SIZE
,
new_off
-
*
foffset
);
size
=
min
((
loff_t
)
PAGE_SIZE
,
new_off
-
cprm
->
written
);
rc
=
spufs_dump_write
(
file
,
buf
,
size
,
foffset
);
rc
=
spufs_dump_write
(
cprm
,
buf
,
size
);
}
}
return
rc
;
return
rc
;
...
@@ -165,7 +156,7 @@ int spufs_coredump_extra_notes_size(void)
...
@@ -165,7 +156,7 @@ int spufs_coredump_extra_notes_size(void)
}
}
static
int
spufs_arch_write_note
(
struct
spu_context
*
ctx
,
int
i
,
static
int
spufs_arch_write_note
(
struct
spu_context
*
ctx
,
int
i
,
struct
file
*
file
,
int
dfd
,
loff_t
*
foffset
)
struct
coredump_params
*
cprm
,
int
dfd
)
{
{
loff_t
pos
=
0
;
loff_t
pos
=
0
;
int
sz
,
rc
,
nread
,
total
=
0
;
int
sz
,
rc
,
nread
,
total
=
0
;
...
@@ -186,22 +177,22 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
...
@@ -186,22 +177,22 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
en
.
n_descsz
=
sz
;
en
.
n_descsz
=
sz
;
en
.
n_type
=
NT_SPU
;
en
.
n_type
=
NT_SPU
;
rc
=
spufs_dump_write
(
file
,
&
en
,
sizeof
(
en
),
foffset
);
rc
=
spufs_dump_write
(
cprm
,
&
en
,
sizeof
(
en
)
);
if
(
rc
)
if
(
rc
)
goto
out
;
goto
out
;
rc
=
spufs_dump_write
(
file
,
fullname
,
en
.
n_namesz
,
foffset
);
rc
=
spufs_dump_write
(
cprm
,
fullname
,
en
.
n_namesz
);
if
(
rc
)
if
(
rc
)
goto
out
;
goto
out
;
rc
=
spufs_dump_align
(
file
,
buf
,
roundup
(
*
foffset
,
4
),
foffset
);
rc
=
spufs_dump_align
(
cprm
,
buf
,
roundup
(
cprm
->
written
,
4
)
);
if
(
rc
)
if
(
rc
)
goto
out
;
goto
out
;
do
{
do
{
nread
=
do_coredump_read
(
i
,
ctx
,
buf
,
bufsz
,
&
pos
);
nread
=
do_coredump_read
(
i
,
ctx
,
buf
,
bufsz
,
&
pos
);
if
(
nread
>
0
)
{
if
(
nread
>
0
)
{
rc
=
spufs_dump_write
(
file
,
buf
,
nread
,
foffset
);
rc
=
spufs_dump_write
(
cprm
,
buf
,
nread
);
if
(
rc
)
if
(
rc
)
goto
out
;
goto
out
;
total
+=
nread
;
total
+=
nread
;
...
@@ -213,15 +204,14 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
...
@@ -213,15 +204,14 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
goto
out
;
goto
out
;
}
}
rc
=
spufs_dump_align
(
file
,
buf
,
roundup
(
*
foffset
-
total
+
sz
,
4
),
rc
=
spufs_dump_align
(
cprm
,
buf
,
roundup
(
cprm
->
written
-
total
+
sz
,
4
));
foffset
);
out:
out:
free_page
((
unsigned
long
)
buf
);
free_page
((
unsigned
long
)
buf
);
return
rc
;
return
rc
;
}
}
int
spufs_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
)
int
spufs_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
)
{
{
struct
spu_context
*
ctx
;
struct
spu_context
*
ctx
;
int
fd
,
j
,
rc
;
int
fd
,
j
,
rc
;
...
@@ -233,7 +223,7 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset)
...
@@ -233,7 +223,7 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset)
return
rc
;
return
rc
;
for
(
j
=
0
;
spufs_coredump_read
[
j
].
name
!=
NULL
;
j
++
)
{
for
(
j
=
0
;
spufs_coredump_read
[
j
].
name
!=
NULL
;
j
++
)
{
rc
=
spufs_arch_write_note
(
ctx
,
j
,
file
,
fd
,
foffset
);
rc
=
spufs_arch_write_note
(
ctx
,
j
,
cprm
,
fd
);
if
(
rc
)
{
if
(
rc
)
{
spu_release_saved
(
ctx
);
spu_release_saved
(
ctx
);
return
rc
;
return
rc
;
...
...
arch/powerpc/platforms/cell/spufs/spufs.h
View file @
cdc3d562
...
@@ -247,12 +247,13 @@ extern const struct spufs_tree_descr spufs_dir_debug_contents[];
...
@@ -247,12 +247,13 @@ extern const struct spufs_tree_descr spufs_dir_debug_contents[];
/* system call implementation */
/* system call implementation */
extern
struct
spufs_calls
spufs_calls
;
extern
struct
spufs_calls
spufs_calls
;
struct
coredump_params
;
long
spufs_run_spu
(
struct
spu_context
*
ctx
,
u32
*
npc
,
u32
*
status
);
long
spufs_run_spu
(
struct
spu_context
*
ctx
,
u32
*
npc
,
u32
*
status
);
long
spufs_create
(
struct
path
*
nd
,
struct
dentry
*
dentry
,
unsigned
int
flags
,
long
spufs_create
(
struct
path
*
nd
,
struct
dentry
*
dentry
,
unsigned
int
flags
,
umode_t
mode
,
struct
file
*
filp
);
umode_t
mode
,
struct
file
*
filp
);
/* ELF coredump callbacks for writing SPU ELF notes */
/* ELF coredump callbacks for writing SPU ELF notes */
extern
int
spufs_coredump_extra_notes_size
(
void
);
extern
int
spufs_coredump_extra_notes_size
(
void
);
extern
int
spufs_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
);
extern
int
spufs_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
);
extern
const
struct
file_operations
spufs_context_fops
;
extern
const
struct
file_operations
spufs_context_fops
;
...
...
fs/binfmt_elf.c
View file @
cdc3d562
...
@@ -2037,7 +2037,7 @@ static int elf_core_dump(struct coredump_params *cprm)
...
@@ -2037,7 +2037,7 @@ static int elf_core_dump(struct coredump_params *cprm)
size_t
size
=
0
;
size_t
size
=
0
;
struct
vm_area_struct
*
vma
,
*
gate_vma
;
struct
vm_area_struct
*
vma
,
*
gate_vma
;
struct
elfhdr
*
elf
=
NULL
;
struct
elfhdr
*
elf
=
NULL
;
loff_t
offset
=
0
,
dataoff
,
foffset
;
loff_t
offset
=
0
,
dataoff
;
struct
elf_note_info
info
=
{
};
struct
elf_note_info
info
=
{
};
struct
elf_phdr
*
phdr4note
=
NULL
;
struct
elf_phdr
*
phdr4note
=
NULL
;
struct
elf_shdr
*
shdr4extnum
=
NULL
;
struct
elf_shdr
*
shdr4extnum
=
NULL
;
...
@@ -2160,12 +2160,11 @@ static int elf_core_dump(struct coredump_params *cprm)
...
@@ -2160,12 +2160,11 @@ static int elf_core_dump(struct coredump_params *cprm)
if
(
!
write_note_info
(
&
info
,
cprm
))
if
(
!
write_note_info
(
&
info
,
cprm
))
goto
end_coredump
;
goto
end_coredump
;
foffset
=
cprm
->
written
;
if
(
elf_coredump_extra_notes_write
(
cprm
))
if
(
elf_coredump_extra_notes_write
(
cprm
->
file
,
&
foffset
))
goto
end_coredump
;
goto
end_coredump
;
/* Align to page */
/* Align to page */
if
(
!
dump_seek
(
cprm
->
file
,
dataoff
-
foffset
))
if
(
!
dump_seek
(
cprm
->
file
,
dataoff
-
cprm
->
written
))
goto
end_coredump
;
goto
end_coredump
;
cprm
->
written
=
size
;
cprm
->
written
=
size
;
...
...
include/linux/elf.h
View file @
cdc3d562
...
@@ -39,13 +39,13 @@ extern Elf64_Dyn _DYNAMIC [];
...
@@ -39,13 +39,13 @@ extern Elf64_Dyn _DYNAMIC [];
/* Optional callbacks to write extra ELF notes. */
/* Optional callbacks to write extra ELF notes. */
struct
file
;
struct
file
;
struct
coredump_params
;
#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
static
inline
int
elf_coredump_extra_notes_size
(
void
)
{
return
0
;
}
static
inline
int
elf_coredump_extra_notes_size
(
void
)
{
return
0
;
}
static
inline
int
elf_coredump_extra_notes_write
(
struct
file
*
file
,
static
inline
int
elf_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
)
{
return
0
;
}
loff_t
*
foffset
)
{
return
0
;
}
#else
#else
extern
int
elf_coredump_extra_notes_size
(
void
);
extern
int
elf_coredump_extra_notes_size
(
void
);
extern
int
elf_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
);
extern
int
elf_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
);
#endif
#endif
#endif
/* _LINUX_ELF_H */
#endif
/* _LINUX_ELF_H */
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