From: Philipp Kohlbecher <pk031698@uni-greifswald.de>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Dave Jones <davej@codemonkey.org.uk>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, linux-assembly@vger.kernel.org
Subject: Re: [PATCH 2.6.21.1] i386: save registers before intra-privilege syscall
Date: Fri, 18 May 2007 01:27:06 +0200 [thread overview]
Message-ID: <464CE4CA.8000704@uni-greifswald.de> (raw)
In-Reply-To: <464CD44A.5000307@zytor.com>
H. Peter Anvin wrote:
> Philipp Kohlbecher wrote:
>> From: Philipp Kohlbecher <pk031698@uni-greifswald.de>
>>
>> The kernel_execve function issues a software interrupt (int 0x80) to make
>> a system call to sys_execve. This function expects to find the stack segment
>> and stack pointer of the function that issued the system call in the pt_regs
>> struct. The syscall entry code that sets up this struct expects the stack
>> segment and the stack pointer of the issuing function already on the stack.
>> But the Intel processor saves these registers only if a stack-switch occurs,
>> i.e. for inter-privilege interrupts and exceptions (cf. Intel Software
>> Developer’s Manual, Vol. 3A, p. 5-17,
>> http://www.intel.com/design/processor/manuals/253668.pdf).
>> For an intra-privilege interrupt like the one issued in kernel_execve, these
>> registers must be saved manually.
>>
>
> Could you describe the failure scenario this causes?
I don't know of any problems this causes. The kernel needs to be aware
of the fact that the xss and esp fields of the pt_regs struct may
contain wrong values anyway, as hardware interrupts arriving while the
CPU is in kernel mode would also lead to this condition.
The file include/asm-i386/processor.h contains a comment to that effect
(lines 483-492).
With kernel_execve we can predict this, however, and account for it.
(This may be superfluous, but I don't think it hurts and it might
prevent future errors.)
- Phil Kohlbecher
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Philipp Kohlbecher <pk031698@uni-greifswald.de>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Dave Jones <davej@codemonkey.org.uk>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, linux-assembly@vger.kernel.org
Subject: Re: [PATCH 2.6.21.1] i386: save registers before intra-privilege syscall
Date: Fri, 18 May 2007 01:27:06 +0200 [thread overview]
Message-ID: <464CE4CA.8000704@uni-greifswald.de> (raw)
In-Reply-To: <464CD44A.5000307@zytor.com>
H. Peter Anvin wrote:
> Philipp Kohlbecher wrote:
>> From: Philipp Kohlbecher <pk031698@uni-greifswald.de>
>>
>> The kernel_execve function issues a software interrupt (int 0x80) to make
>> a system call to sys_execve. This function expects to find the stack segment
>> and stack pointer of the function that issued the system call in the pt_regs
>> struct. The syscall entry code that sets up this struct expects the stack
>> segment and the stack pointer of the issuing function already on the stack.
>> But the Intel processor saves these registers only if a stack-switch occurs,
>> i.e. for inter-privilege interrupts and exceptions (cf. Intel Software
>> Developer’s Manual, Vol. 3A, p. 5-17,
>> http://www.intel.com/design/processor/manuals/253668.pdf).
>> For an intra-privilege interrupt like the one issued in kernel_execve, these
>> registers must be saved manually.
>>
>
> Could you describe the failure scenario this causes?
I don't know of any problems this causes. The kernel needs to be aware
of the fact that the xss and esp fields of the pt_regs struct may
contain wrong values anyway, as hardware interrupts arriving while the
CPU is in kernel mode would also lead to this condition.
The file include/asm-i386/processor.h contains a comment to that effect
(lines 483-492).
With kernel_execve we can predict this, however, and account for it.
(This may be superfluous, but I don't think it hurts and it might
prevent future errors.)
- Phil Kohlbecher
next prev parent reply other threads:[~2007-05-17 23:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-17 22:06 [PATCH 2.6.21.1] i386: save registers before intra-privilege syscall Philipp Kohlbecher
2007-05-17 22:06 ` Philipp Kohlbecher
2007-05-17 22:16 ` H. Peter Anvin
2007-05-17 22:16 ` H. Peter Anvin
2007-05-17 23:27 ` Philipp Kohlbecher [this message]
2007-05-17 23:27 ` Philipp Kohlbecher
2007-05-17 23:33 ` H. Peter Anvin
2007-05-18 8:32 ` Philipp Kohlbecher
2007-05-18 22:41 ` H. Peter Anvin
2007-05-18 23:08 ` H. Peter Anvin
2007-05-21 10:48 ` Philipp Kohlbecher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=464CE4CA.8000704@uni-greifswald.de \
--to=pk031698@uni-greifswald.de \
--cc=arnd@arndb.de \
--cc=davej@codemonkey.org.uk \
--cc=hpa@zytor.com \
--cc=linux-assembly@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.