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
a58d5360
Commit
a58d5360
authored
Jun 18, 2003
by
Richard Henderson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ALPHA] Implement execve entirely in assembly. Force KSP to
the top of the kernel stack space before entering userland.
parent
e01b34d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
23 deletions
+48
-23
arch/alpha/kernel/alpha_ksyms.c
arch/alpha/kernel/alpha_ksyms.c
+1
-1
arch/alpha/kernel/entry.S
arch/alpha/kernel/entry.S
+46
-15
include/asm-alpha/unistd.h
include/asm-alpha/unistd.h
+1
-7
No files found.
arch/alpha/kernel/alpha_ksyms.c
View file @
a58d5360
...
...
@@ -156,7 +156,7 @@ EXPORT_SYMBOL(sys_exit);
EXPORT_SYMBOL
(
sys_write
);
EXPORT_SYMBOL
(
sys_read
);
EXPORT_SYMBOL
(
sys_lseek
);
EXPORT_SYMBOL
(
__kernel_
execve
);
EXPORT_SYMBOL
(
execve
);
EXPORT_SYMBOL
(
sys_setsid
);
EXPORT_SYMBOL
(
sys_wait4
);
...
...
arch/alpha/kernel/entry.S
View file @
a58d5360
...
...
@@ -606,7 +606,8 @@ ret_from_fork:
.
globl
kernel_thread
.
ent
kernel_thread
kernel_thread
:
ldgp
$gp
,
0
(
$
27
)
/*
we
can
be
called
from
a
module
*/
/
*
We
can
be
called
from
a
module
.
*/
ldgp
$gp
,
0
(
$
27
)
.
prologue
1
subq
$sp
,
SP_OFF
+
6
*
8
,
$sp
br
$
1
,
2
f
/*
load
start
address
*/
...
...
@@ -654,26 +655,56 @@ kernel_thread:
.
end
kernel_thread
/*
*
__kernel_execve
(
path
,
argv
,
envp
,
regs
)
*
execve
(
path
,
argv
,
envp
)
*/
.
align
4
.
globl
__kernel_execve
.
ent
__kernel_execve
__kernel_execve
:
ldgp
$gp
,
0
(
$
27
)
/*
we
can
be
called
from
modules
.
*/
subq
$sp
,
16
,
$sp
.
frame
$sp
,
16
,
$
26
,
0
.
globl
execve
.
ent
execve
execve
:
/
*
We
can
be
called
from
a
module
.
*/
ldgp
$gp
,
0
(
$
27
)
lda
$sp
,
-(
32
+
SIZEOF_PT_REGS
+
8
)(
$sp
)
.
frame
$sp
,
32
+
SIZEOF_PT_REGS
+
8
,
$
26
,
0
stq
$
26
,
0
(
$sp
)
stq
$
19
,
8
(
$sp
)
stq
$
16
,
8
(
$sp
)
stq
$
17
,
16
(
$sp
)
stq
$
18
,
24
(
$sp
)
.
prologue
1
jsr
$
26
,
do_execve
bne
$
0
,
1
f
/*
error
!
*/
ldq
$sp
,
8
(
$sp
)
lda
$
16
,
32
(
$sp
)
lda
$
17
,
0
lda
$
18
,
SIZEOF_PT_REGS
bsr
$
26
,
memset
!
samegp
/
*
Avoid
the
HAE
being
gratuitously
wrong
,
which
would
cause
us
to
do
the
whole
turn
off
interrupts
thing
and
restore
it
.
*/
ldq
$
2
,
alpha_mv
+
HAE_CACHE
stq
$
2
,
152
+
32
(
$sp
)
ldq
$
16
,
8
(
$sp
)
ldq
$
17
,
16
(
$sp
)
ldq
$
18
,
24
(
$sp
)
lda
$
19
,
32
(
$sp
)
bsr
$
26
,
do_execve
!
samegp
ldq
$
26
,
0
(
$sp
)
bne
$
0
,
1
f
/*
error
!
*/
/
*
Move
the
temporary
pt_regs
struct
from
its
current
location
to
the
top
of
the
kernel
stack
frame
.
See
copy_thread
for
details
for
a
normal
process
.
*/
lda
$
16
,
0x4000
-
SIZEOF_PT_REGS
(
$
8
)
lda
$
17
,
32
(
$sp
)
lda
$
18
,
SIZEOF_PT_REGS
bsr
$
26
,
memmove
!
samegp
/
*
Take
that
over
as
our
new
stack
frame
and
visit
userland
!
*/
lda
$sp
,
0x4000
-
SIZEOF_PT_REGS
(
$
8
)
br
$
31
,
ret_from_sys_call
1
:
ldq
$
26
,
0
(
$sp
)
addq
$sp
,
16
,
$sp
1
:
lda
$sp
,
32
+
SIZEOF_PT_REGS
+
8
(
$sp
)
ret
.
end
__kernel_
execve
.
end
execve
/*
...
...
include/asm-alpha/unistd.h
View file @
a58d5360
...
...
@@ -593,13 +593,7 @@ static inline long read(int fd, char * buf, size_t nr)
return
sys_read
(
fd
,
buf
,
nr
);
}
extern
int
__kernel_execve
(
char
*
,
char
**
,
char
**
,
struct
pt_regs
*
);
static
inline
long
execve
(
char
*
file
,
char
**
argvp
,
char
**
envp
)
{
struct
pt_regs
regs
;
memset
(
&
regs
,
0
,
sizeof
(
regs
));
return
__kernel_execve
(
file
,
argvp
,
envp
,
&
regs
);
}
extern
long
execve
(
char
*
,
char
**
,
char
**
);
extern
long
sys_setsid
(
void
);
static
inline
long
setsid
(
void
)
...
...
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