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
nexedi
linux
Commits
ae802127
Commit
ae802127
authored
Jan 30, 2003
by
Anton Blanchard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ppc64: restore non rt signals, we need to verify that older 64bit glibcs dont use them
parent
09b54128
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
190 additions
and
45 deletions
+190
-45
arch/ppc64/kernel/entry.S
arch/ppc64/kernel/entry.S
+4
-0
arch/ppc64/kernel/misc.S
arch/ppc64/kernel/misc.S
+6
-6
arch/ppc64/kernel/signal.c
arch/ppc64/kernel/signal.c
+180
-2
arch/ppc64/kernel/signal32.c
arch/ppc64/kernel/signal32.c
+0
-37
No files found.
arch/ppc64/kernel/entry.S
View file @
ae802127
...
...
@@ -228,6 +228,10 @@ _GLOBAL(ppc32_rt_sigreturn)
bl
.
sys32_rt_sigreturn
b
80
f
_GLOBAL
(
ppc64_sigreturn
)
bl
.
sys_sigreturn
b
80
f
_GLOBAL
(
ppc64_rt_sigreturn
)
bl
.
sys_rt_sigreturn
...
...
arch/ppc64/kernel/misc.S
View file @
ae802127
...
...
@@ -540,7 +540,7 @@ _GLOBAL(sys_call_table32)
.
llong
.
sys32_ssetmask
.
llong
.
sys_setreuid
/*
70
*/
.
llong
.
sys_setregid
.
llong
.
sys
32
_sigsuspend
.
llong
.
sys_sigsuspend
.
llong
.
compat_sys_sigpending
.
llong
.
sys32_sethostname
.
llong
.
sys32_setrlimit
/*
75
*/
...
...
@@ -783,13 +783,13 @@ _GLOBAL(sys_call_table)
.
llong
.
sys_getppid
.
llong
.
sys_getpgrp
/*
65
*/
.
llong
.
sys_setsid
.
llong
.
sys_
ni_syscall
/*
32
bit
only
sigaction
*/
.
llong
.
sys_
sigaction
.
llong
.
sys_sgetmask
.
llong
.
sys_ssetmask
.
llong
.
sys_setreuid
/*
70
*/
.
llong
.
sys_setregid
.
llong
.
sys_
ni_syscall
/*
32
bit
only
sigsuspend
*/
.
llong
.
sys_
ni_syscall
/*
32
bit
only
sigpending
*/
.
llong
.
sys_
sigsuspend
.
llong
.
sys_
sigpending
.
llong
.
sys_sethostname
.
llong
.
sys_setrlimit
/*
75
*/
.
llong
.
sys_ni_syscall
/*
old
getrlimit
syscall
*/
...
...
@@ -835,14 +835,14 @@ _GLOBAL(sys_call_table)
.
llong
.
sys_sysinfo
.
llong
.
sys_ipc
.
llong
.
sys_fsync
.
llong
.
sys_ni_syscall
/*
32
bit
only
sigreturn
*/
.
llong
.
ppc64_sigreturn
.
llong
.
sys_clone
/*
120
*/
.
llong
.
sys_setdomainname
.
llong
.
ppc64_newuname
.
llong
.
sys_ni_syscall
/*
old
modify_ldt
syscall
*/
.
llong
.
sys_adjtimex
.
llong
.
sys_mprotect
/*
125
*/
.
llong
.
sys_
ni_syscall
/*
32
bit
only
sigprocmask
*/
.
llong
.
sys_
sigprocmask
.
llong
.
sys_ni_syscall
/*
old
create_module
syscall
*/
.
llong
.
sys_init_module
.
llong
.
sys_delete_module
...
...
arch/ppc64/kernel/signal.c
View file @
ae802127
...
...
@@ -99,6 +99,40 @@ struct rt_sigframe
extern
int
do_signal
(
sigset_t
*
oldset
,
struct
pt_regs
*
regs
);
/*
* Atomically swap in the new signal mask, and wait for a signal.
*/
long
sys_sigsuspend
(
old_sigset_t
mask
,
int
p2
,
int
p3
,
int
p4
,
int
p6
,
int
p7
,
struct
pt_regs
*
regs
)
{
sigset_t
saveset
;
mask
&=
_BLOCKABLE
;
spin_lock_irq
(
&
current
->
sig
->
siglock
);
saveset
=
current
->
blocked
;
siginitset
(
&
current
->
blocked
,
mask
);
recalc_sigpending
();
spin_unlock_irq
(
&
current
->
sig
->
siglock
);
regs
->
result
=
-
EINTR
;
regs
->
gpr
[
3
]
=
EINTR
;
regs
->
ccr
|=
0x10000000
;
while
(
1
)
{
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule
();
if
(
do_signal
(
&
saveset
,
regs
))
/*
* If a signal handler needs to be called,
* do_signal() has set R3 to the signal number (the
* first argument of the signal handler), so don't
* overwrite that with EINTR !
* In the other cases, do_signal() doesn't touch
* R3, so it's still set to -EINTR (see above).
*/
return
regs
->
gpr
[
3
];
}
}
long
sys_rt_sigsuspend
(
sigset_t
*
unewset
,
size_t
sigsetsize
,
int
p3
,
int
p4
,
int
p6
,
int
p7
,
struct
pt_regs
*
regs
)
{
...
...
@@ -136,6 +170,37 @@ long sys_sigaltstack(const stack_t *uss, stack_t *uoss, unsigned long r5,
return
do_sigaltstack
(
uss
,
uoss
,
regs
->
gpr
[
1
]);
}
long
sys_sigaction
(
int
sig
,
const
struct
old_sigaction
*
act
,
struct
old_sigaction
*
oact
)
{
struct
k_sigaction
new_ka
,
old_ka
;
int
ret
;
if
(
act
)
{
old_sigset_t
mask
;
if
(
verify_area
(
VERIFY_READ
,
act
,
sizeof
(
*
act
))
||
__get_user
(
new_ka
.
sa
.
sa_handler
,
&
act
->
sa_handler
)
||
__get_user
(
new_ka
.
sa
.
sa_restorer
,
&
act
->
sa_restorer
))
return
-
EFAULT
;
__get_user
(
new_ka
.
sa
.
sa_flags
,
&
act
->
sa_flags
);
__get_user
(
mask
,
&
act
->
sa_mask
);
siginitset
(
&
new_ka
.
sa
.
sa_mask
,
mask
);
}
ret
=
do_sigaction
(
sig
,
act
?
&
new_ka
:
NULL
,
oact
?
&
old_ka
:
NULL
);
if
(
!
ret
&&
oact
)
{
if
(
verify_area
(
VERIFY_WRITE
,
oact
,
sizeof
(
*
oact
))
||
__put_user
(
old_ka
.
sa
.
sa_handler
,
&
oact
->
sa_handler
)
||
__put_user
(
old_ka
.
sa
.
sa_restorer
,
&
oact
->
sa_restorer
))
return
-
EFAULT
;
__put_user
(
old_ka
.
sa
.
sa_flags
,
&
oact
->
sa_flags
);
__put_user
(
old_ka
.
sa
.
sa_mask
.
sig
[
0
],
&
oact
->
sa_mask
);
}
return
ret
;
}
/*
* When we have rt signals to deliver, we set up on the
* user stack, going down from the original stack pointer:
...
...
@@ -263,6 +328,116 @@ static void setup_rt_frame(struct pt_regs *regs, struct sigregs *frame,
do_exit
(
SIGSEGV
);
}
/*
* Do a signal return; undo the signal stack.
*/
long
sys_sigreturn
(
unsigned
long
r3
,
unsigned
long
r4
,
unsigned
long
r5
,
unsigned
long
r6
,
unsigned
long
r7
,
unsigned
long
r8
,
struct
pt_regs
*
regs
)
{
struct
sigcontext
*
sc
,
sigctx
;
struct
sigregs
*
sr
;
elf_gregset_t
saved_regs
;
/* an array of ELF_NGREG unsigned longs */
sigset_t
set
;
sc
=
(
struct
sigcontext
*
)(
regs
->
gpr
[
1
]
+
__SIGNAL_FRAMESIZE
);
if
(
copy_from_user
(
&
sigctx
,
sc
,
sizeof
(
sigctx
)))
goto
badframe
;
set
.
sig
[
0
]
=
sigctx
.
oldmask
;
#if _NSIG_WORDS > 1
set
.
sig
[
1
]
=
sigctx
.
_unused
[
3
];
#endif
sigdelsetmask
(
&
set
,
~
_BLOCKABLE
);
spin_lock_irq
(
&
current
->
sig
->
siglock
);
current
->
blocked
=
set
;
recalc_sigpending
();
spin_unlock_irq
(
&
current
->
sig
->
siglock
);
if
(
regs
->
msr
&
MSR_FP
)
giveup_fpu
(
current
);
/* restore registers */
sr
=
(
struct
sigregs
*
)
sigctx
.
regs
;
if
(
copy_from_user
(
saved_regs
,
&
sr
->
gp_regs
,
sizeof
(
sr
->
gp_regs
)))
goto
badframe
;
saved_regs
[
PT_MSR
]
=
(
regs
->
msr
&
~
MSR_USERCHANGE
)
|
(
saved_regs
[
PT_MSR
]
&
MSR_USERCHANGE
);
saved_regs
[
PT_SOFTE
]
=
regs
->
softe
;
memcpy
(
regs
,
saved_regs
,
GP_REGS_SIZE
);
if
(
copy_from_user
(
current
->
thread
.
fpr
,
&
sr
->
fp_regs
,
sizeof
(
sr
->
fp_regs
)))
goto
badframe
;
return
regs
->
result
;
badframe:
do_exit
(
SIGSEGV
);
}
/*
* Set up a signal frame.
*/
static
void
setup_frame
(
struct
pt_regs
*
regs
,
struct
sigregs
*
frame
,
unsigned
long
newsp
)
{
/* Handler is *really* a pointer to the function descriptor for
* the signal routine. The first entry in the function
* descriptor is the entry address of signal and the second
* entry is the TOC value we need to use.
*/
struct
funct_descr_entry
{
unsigned
long
entry
;
unsigned
long
toc
;
};
struct
funct_descr_entry
*
funct_desc_ptr
;
unsigned
long
temp_ptr
;
struct
sigcontext
*
sc
=
(
struct
sigcontext
*
)
newsp
;
if
(
verify_area
(
VERIFY_WRITE
,
frame
,
sizeof
(
*
frame
)))
goto
badframe
;
if
(
regs
->
msr
&
MSR_FP
)
giveup_fpu
(
current
);
if
(
__copy_to_user
(
&
frame
->
gp_regs
,
regs
,
GP_REGS_SIZE
)
||
__copy_to_user
(
&
frame
->
fp_regs
,
current
->
thread
.
fpr
,
ELF_NFPREG
*
sizeof
(
double
))
/* li r0, __NR_sigreturn */
||
__put_user
(
0x38000000UL
+
__NR_sigreturn
,
&
frame
->
tramp
[
0
])
/* sc */
||
__put_user
(
0x44000002UL
,
&
frame
->
tramp
[
1
]))
goto
badframe
;
flush_icache_range
((
unsigned
long
)
&
frame
->
tramp
[
0
],
(
unsigned
long
)
&
frame
->
tramp
[
2
]);
current
->
thread
.
fpscr
=
0
;
/* turn off all fp exceptions */
newsp
-=
__SIGNAL_FRAMESIZE
;
if
(
get_user
(
temp_ptr
,
&
sc
->
handler
))
goto
badframe
;
funct_desc_ptr
=
(
struct
funct_descr_entry
*
)
temp_ptr
;
if
(
put_user
(
regs
->
gpr
[
1
],
(
unsigned
long
*
)
newsp
)
||
get_user
(
regs
->
nip
,
&
funct_desc_ptr
->
entry
)
||
get_user
(
regs
->
gpr
[
2
],
&
funct_desc_ptr
->
toc
)
||
get_user
(
regs
->
gpr
[
3
],
&
sc
->
signal
))
goto
badframe
;
regs
->
gpr
[
1
]
=
newsp
;
regs
->
gpr
[
4
]
=
(
unsigned
long
)
sc
;
regs
->
link
=
(
unsigned
long
)
frame
->
tramp
;
return
;
badframe:
#if DEBUG_SIG
printk
(
"badframe in setup_frame, regs=%p frame=%p newsp=%lx
\n
"
,
regs
,
frame
,
newsp
);
#endif
do_exit
(
SIGSEGV
);
}
/*
* OK, we're invoking a handler
*/
...
...
@@ -407,7 +582,10 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
if
(
newsp
==
frame
)
return
0
;
/* no signals delivered */
setup_rt_frame
(
regs
,
(
struct
sigregs
*
)
frame
,
newsp
);
/* Invoke correct stack setup routine */
if
(
ka
->
sa
.
sa_flags
&
SA_SIGINFO
)
setup_rt_frame
(
regs
,
(
struct
sigregs
*
)
frame
,
newsp
);
else
setup_frame
(
regs
,
(
struct
sigregs
*
)
frame
,
newsp
);
return
1
;
}
arch/ppc64/kernel/signal32.c
View file @
ae802127
...
...
@@ -112,43 +112,6 @@ struct rt_sigframe_32 {
* setup_frame32
*/
/*
* Atomically swap in the new signal mask, and wait for a signal.
*/
extern
int
do_signal
(
sigset_t
*
oldset
,
struct
pt_regs
*
regs
);
long
sys32_sigsuspend
(
old_sigset_t
mask
,
int
p2
,
int
p3
,
int
p4
,
int
p6
,
int
p7
,
struct
pt_regs
*
regs
)
{
sigset_t
saveset
;
mask
&=
_BLOCKABLE
;
spin_lock_irq
(
&
current
->
sig
->
siglock
);
saveset
=
current
->
blocked
;
siginitset
(
&
current
->
blocked
,
mask
);
recalc_sigpending
();
spin_unlock_irq
(
&
current
->
sig
->
siglock
);
regs
->
result
=
-
EINTR
;
regs
->
gpr
[
3
]
=
EINTR
;
regs
->
ccr
|=
0x10000000
;
while
(
1
)
{
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule
();
if
(
do_signal
(
&
saveset
,
regs
))
/*
* If a signal handler needs to be called,
* do_signal() has set R3 to the signal number (the
* first argument of the signal handler), so don't
* overwrite that with EINTR !
* In the other cases, do_signal() doesn't touch
* R3, so it's still set to -EINTR (see above).
*/
return
regs
->
gpr
[
3
];
}
}
long
sys32_sigaction
(
int
sig
,
struct
old_sigaction32
*
act
,
struct
old_sigaction32
*
oact
)
{
...
...
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