ine in_ia32_syscall() (IS_ENABLED(CONFIG_IA32_EMULATION) && \
> + current->thread.status & TS_COMPAT)
> #endif
> - return false;
> -}
>
> /*
> * Force syscall return via IRET by making it look as if there was
> diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c
> index 2bd5c6ff7ee7..a91a6ead24a2 100644
> --- a/arch/x86/kernel/asm-offsets.c
> +++ b/arch/x86/kernel/asm-offsets.c
> @@ -30,7 +30,6 @@
> void common(void) {
> BLANK();
> OFFSET(TI_flags, thread_info, flags);
> - OFFSET(TI_status, thread_info, status);
TI_status can be deleted. It's last users were removed in commit ee08c6bd.
--
Brian Gerst
struct *child, long addr, long
> data)
>
> static int get_fpregs(struct user_i387_struct __user *buf, struct
> task_struct *child)
> {
> - int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
> + int err, n, cpu = task_thread_info(child)->cpu;
Shouldn't this use task_cpu() like in patch 23?
--
Brian Gerst
>> sysret
>> END(ignore_sysret)
>> +
>> +ENTRY(rewind_stack_do_exit)
>> + /* Prevent any naive code from trying to unwind to our caller. */
>> + xorl%ebp, %ebp
>
> s/ebp/rbp/g/ ?
No, this quirk of the x86-64 instruction set will zero-extend to
64-bits without needing a REX prefix.
--
Brian Gerst
t; Linus
* A newly forked process directly context switches into this address.
*
* rdi: prev task we switched from
+ * rsi: task we're switching to
*/
ENTRY(ret_from_fork)
-LOCK ; btr $TIF_FORK, TI_flags(%r8)
+ LOCK ; btr $TIF_FORK, TI_flags(%rsi)/* rsi: this newly forked task */
callschedule_tail/* rdi: 'prev' task parameter */
I think you forgot GET_THREAD_INFO() here. RSI is the task, not the
thread_info. FYI, this goes away with my switch_to() rewrite, which
removes TIF_FORK.
--
Brian Gerst
On Mon, Jun 20, 2016 at 11:14 AM, Borislav Petkov wrote:
> On Mon, Jun 20, 2016 at 11:01:02AM -0400, Brian Gerst wrote:
>> The idea was to put the uncommon case (kernel thread) out of line for
>> performance reasons.
>
> A comment saying so wouldn't hurt...
This is a
On Mon, Jun 20, 2016 at 12:01 PM, Josh Poimboeuf wrote:
> On Sat, Jun 18, 2016 at 04:56:18PM -0400, Brian Gerst wrote:
>> thread_saved_pc() was using a completely bogus method to get the return
>> address. Since switch_to() was previously inlined, there was no sane way
>>
On Mon, Jun 20, 2016 at 9:51 AM, Borislav Petkov wrote:
> On Sat, Jun 18, 2016 at 04:56:17PM -0400, Brian Gerst wrote:
>> Instead of setting up a fake pt_regs context, put the kernel thread
>> function pointer and arg into the unused callee-restored registers
>> of struct for
On Sat, Jun 18, 2016 at 4:56 PM, Brian Gerst wrote:
> This patch set simplifies the switch_to() code, by moving the stack switch
> code out of line into an asm stub before calling __switch_to(). This ends
> up being more readable, and using the C calling convention instead of
> cl
On Sun, Jun 19, 2016 at 5:28 PM, Andy Lutomirski wrote:
> On Sat, Jun 18, 2016 at 1:56 PM, Brian Gerst wrote:
>> Instead of setting up a fake pt_regs context, put the kernel thread
>> function pointer and arg into the unused callee-restored registers
>> of struct fork_
Match 64-bit and set gdb_regs[GDB_PC] to zero. thread.ip is always the
same point in the scheduler (except for newly forked processes), and will
be removed in a future patch.
Signed-off-by: Brian Gerst
---
arch/x86/kernel/kgdb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff
for
__schedule() by using the C calling convention instead of clobbering all
registers.
Signed-off-by: Brian Gerst
---
arch/x86/entry/entry_32.S | 37 ++
arch/x86/entry/entry_64.S | 41 ++-
arch/x86/include/asm/processor.h | 3 -
arch/x86/include/asm
thread.sp
Brian Gerst (6):
x86-32, kgdb: Don't use thread.ip in sleeping_thread_to_gdb_regs()
x86-64, kgdb: clear GDB_PS on 64-bit
x86: Add struct inactive_task_frame
x86: Rewrite switch_to() code
x86: Pass kernel thread parameters in fork_frame
x86
Add struct inactive_task_frame, which defines the layout of the stack for
a sleeping process. For now, the only defined field is the BP register
(frame pointer).
Signed-off-by: Brian Gerst
---
arch/x86/include/asm/stacktrace.h | 4 ++--
arch/x86/include/asm/switch_to.h | 5 +
arch/x86
Instead of setting up a fake pt_regs context, put the kernel thread
function pointer and arg into the unused callee-restored registers
of struct fork_frame.
Signed-off-by: Brian Gerst
---
arch/x86/entry/entry_32.S| 31 +++
arch/x86/entry/entry_64.S| 35
switch_to() no longer saves EFLAGS, so it's bogus to look for it on the
stack. Set it to zero like 32-bit.
Signed-off-by: Brian Gerst
---
arch/x86/kernel/kgdb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index fe
.
Signed-off-by: Brian Gerst
---
arch/x86/include/asm/processor.h | 10 ++
arch/x86/kernel/process.c| 10 ++
arch/x86/kernel/process_32.c | 8
3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm
On Wed, Jun 15, 2016 at 4:03 AM, Ingo Molnar wrote:
>
> * Andy Lutomirski wrote:
>
>> On Sat, May 21, 2016 at 9:04 AM, Brian Gerst wrote:
>>
>> > Move the low-level context switch code to an out-of-line asm stub instead
>> > of
>> > using com
ver uses the zero page and access it.
>
> Writing to the zero page would be a major fail.
I would think the safest thing to do during resume from hibernation is
to use hlt instead of mwait, so there is no dependency on any memory
address. It doesn't need the power management features of mwait
either because the CPU will be reset soon after the restored kernel
resumes.
--
Brian Gerst
rspace accesses so
that it only touches kernel memory, you can eliminate the set_fs() and
the extra copy from the compat case.
I had started work on this a while back but never finished it. I'll
look at bringing it up to date.
--
Brian Gerst
On Mon, May 23, 2016 at 11:36 AM, Andy Lutomirski wrote:
> On Mon, May 23, 2016 at 8:23 AM, Josh Poimboeuf wrote:
>> On Sat, May 21, 2016 at 12:04:51PM -0400, Brian Gerst wrote:
>>> --- a/arch/x86/entry/entry_64.S
>>> +++ b/arch/x86/entry/entry_64.S
>>> @@ -4
; >
>> > But overall I think this patch is a really nice cleanup, and other than
>> > the above minor issue it should be fine with my reliable unwinder, since
>> > rbp is still at the top of the stack.
>>
>> Is this a regression or is there some reason that it works right
>> without the patch?
>
> Without the patch, it uses TIF_FORK to determine the stack is empty.
Where is this code? I don't see it in the mainline kernel.
--
Brian Gerst
ch is a really nice cleanup, and other than
> the above minor issue it should be fine with my reliable unwinder, since
> rbp is still at the top of the stack.
Ok, how about if it pushed RBP first, then we teach get_wchan() to add
the fixed offset from thread.sp to get bp? that way it don't have to
push it twice.
--
Brian Gerst
On Sun, May 22, 2016 at 1:59 PM, Andy Lutomirski wrote:
> cc: Josh Poimboeuf: do you care about the exact stack layout of the
> bottom of the stack of an inactive task?
>
> On May 21, 2016 9:05 AM, "Brian Gerst" wrote:
>>
>> Move the low-level context swit
On Sun, May 22, 2016 at 2:01 PM, Andy Lutomirski wrote:
> On Sat, May 21, 2016 at 9:04 AM, Brian Gerst wrote:
>> Instead of setting up a fake pt_regs context, put the kernel thread
>> function pointer and arg into the unused callee-restored registers
>> of struct fork_frame
On Sat, May 21, 2016 at 9:44 PM, Andy Lutomirski wrote:
> On Sat, May 21, 2016 at 9:04 AM, Brian Gerst wrote:
>> Kernel threads should always return zero on success after calling
>> do_execve(). The
>> two existing cases in the kernel (kernel_init() and
>> cal
save the full 64-bits.
Signed-off-by: Brian Gerst
---
arch/x86/entry/entry_32.S | 2 +-
arch/x86/entry/entry_64.S | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index 983e5d3..ee6fea0 100644
--- a/arch/x86/entry/entry_32
for
__schedule() by using the C calling convention instead of clobbering all
registers.
Signed-off-by: Brian Gerst
---
arch/x86/entry/entry_32.S | 38 ++
arch/x86/entry/entry_64.S | 42 +++-
arch/x86/include/asm/processor.h | 3 -
arch/x86/include/asm
Match 64-bit and set gdb_regs[GDB_PC] to zero. thread.ip is always the
same point in the scheduler (except for newly forked processes), and will
be removed in a future patch.
Signed-off-by: Brian Gerst
---
arch/x86/kernel/kgdb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff
This patch set simplifies the switch_to() code, by moving the stack switch
code out of line into an asm stub before calling __switch_to(). This ends
up being more readable, and using the C calling convention instead of
clobbering all registers improves code generation. It also allows newly
forked
Instead of setting up a fake pt_regs context, put the kernel thread
function pointer and arg into the unused callee-restored registers
of struct fork_frame.
Signed-off-by: Brian Gerst
---
arch/x86/entry/entry_32.S| 28 +++-
arch/x86/entry/entry_64.S| 30
will keep those 5 bytes *and* get rid of the calling convention
> without the growth.
>
> Or?
I think he meant the out of line version would be asm, so you could
control what registers were clobbered.
--
Brian Gerst
Commit-ID: 1e17880371f85d3d866962e04ba3567c0654a125
Gitweb: http://git.kernel.org/tip/1e17880371f85d3d866962e04ba3567c0654a125
Author: Brian Gerst
AuthorDate: Wed, 4 May 2016 22:44:37 -0400
Committer: Ingo Molnar
CommitDate: Thu, 5 May 2016 08:37:30 +0200
x86/entry/32: Remove
Commit-ID: 0676b4e0a1940a6b7ae3156bd212ca9032a29c30
Gitweb: http://git.kernel.org/tip/0676b4e0a1940a6b7ae3156bd212ca9032a29c30
Author: Brian Gerst
AuthorDate: Wed, 4 May 2016 22:44:38 -0400
Committer: Ingo Molnar
CommitDate: Thu, 5 May 2016 08:37:31 +0200
x86/entry/32: Remove
Commit-ID: 092c74e420952c7cb68141731f2b562245b51eeb
Gitweb: http://git.kernel.org/tip/092c74e420952c7cb68141731f2b562245b51eeb
Author: Brian Gerst
AuthorDate: Wed, 4 May 2016 22:44:36 -0400
Committer: Ingo Molnar
CommitDate: Thu, 5 May 2016 08:37:30 +0200
x86/entry, sched/x86: Don
Now that syscalls are called from C code, which copies the args to new stack
slots instead of overlaying pt_regs, asmlinkage_protect is no longer needed.
Signed-off-by: Brian Gerst
---
arch/x86/include/asm/linkage.h | 34 --
1 file changed, 34 deletions(-)
diff
Now that NT is filtered by the SYSENTER entry code, it is safe to skip saving
and
restoring flags on task switch. Also remove a leftover reset of flags on 64-bit
fork.
Signed-off-by: Brian Gerst
---
arch/x86/entry/entry_32.S| 4
arch/x86/entry/entry_64.S| 3 ---
arch/x86
The entry code used to cache the thread_info pointer in the EBP register, but
all the code that used it has been moved to C. Remove the unused code to
get the pointer.
Signed-off-by: Brian Gerst
---
arch/x86/entry/entry_32.S | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/x86/entry
Here are a few cleanups from the recent x86 entry code rewrite.
[PATCH 1/3] x86: Don't save/restore EFLAGS on task switch
[PATCH 2/3] x86-32: Remove GET_THREAD_INFO from entry code
[PATCH 3/3] x86-32: Remove asmlinkage_protect
arch/x86/entry/entry_32.S| 7 ---
arch/x86/entry/entry_6
m (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT)
> -: "="REG_OUT (res)
> -: REG_IN (w));
> + if (likely(static_cpu_has(X86_FEATURE_POPCNT))) {
> + asm volatile("popcnt %[w], %[res]" : [res] "=r" (res) : [w]
> "r" (w));
Do all supported versions of the assembler know of the popcnt
instruction? That's why is was open coded before. The problem is
Intel and AMD are constantly adding new instructions and it's a long
cycle for the user's assembler to get updated.
--
Brian Gerst
On Tue, May 3, 2016 at 1:55 PM, Andy Lutomirski wrote:
> On Tue, May 3, 2016 at 10:45 AM, Brian Gerst wrote:
>> On Mon, May 2, 2016 at 10:56 AM, Denys Vlasenko wrote:
>>> Use of a temporary R8 register here seems to be unnecessary.
>>>
>>> "push %r8&qu
/* pt_regs->r13 = 0 */
> + pushq $0 /* pt_regs->r14 = 0 */
> + pushq $0 /* pt_regs->r15 = 0 */
I think it actually should push r12-r15, since they are callee-saved
and we don't explicitly zero them out on SYSRET like r8-r10. If it
exited via IRET it would reload them as zero, so there is an
inconsistency there.
--
Brian Gerst
# fake return address to stop unwinder
> + call1f # put return address on stack for unwinder
> +1: xorq%rbp, %rbp # clear frame pointer
> + movqinitial_code(%rip), %rax
> pushq $__KERNEL_CS# set correct cs
> pushq %rax# target address in negative space
> lretq
This chunk looks like it should be a separate patch.
--
Brian Gerst
as() for
runtime checks, since it reduces down to a single jmp/nop instruction
after alternatives run. Even if it's not a hot path, it saves a bit
of runtime memory. boot_cpu_has() is fine for run-once init code.
--
Brian Gerst
+ REG_EFL,
> + REG_CSGSFS,/* Actually short cs, gs, fs, __pad0. */
> + REG_ERR,
> + REG_TRAPNO,
> + REG_OLDMASK,
> + REG_CR2
> +};
> +
> +void _exit_(void)
> +{
> + exit(1);
> +}
> +
> +void test(void)
> +{
> + struct ucontext ctx = { 0 };
> + register unsigned long rsp asm("rsp");
> + register unsigned long rbp asm("rbp");
> + ctx.uc_mcontext.gregs[REG_RIP] = (unsigned long) _exit_ + 4;
> + ctx.uc_mcontext.gregs[REG_RSP] = rsp;
> + ctx.uc_mcontext.gregs[REG_RBP] = rbp;
> + ctx.uc_mcontext.gregs[REG_CSGSFS] = 0x002b0033;
> + rsp = (unsigned long) &ctx;
> + asm("movq $0xf,%rax\n");
> + asm("syscall\n");
> +}
> +
> +
> +int main(void)
> +{
> + test();
> + return 0;
> +}
> --
> 1.9.1
>
These test programs should go in tools/testing/selftests/x86.
--
Brian Gerst
ode. fs/gs imply the %fs and
%gs registers (the selector index), not the base.
The rename should be:
fs -> fsbase
gs -> gsbase
fsindex -> fs
gsindex -> gs
--
Brian Gerst
or kernel is FSGSBASE capable.
>
> The application can then access it manually or using
> the getauxval() function in newer glibc.
How about adding a VDSO function instead? The VDSO can use
alternatives, so it can use the new instructions if supported, or else
use the old syscall.
--
Brian Gerst
On Mon, Mar 21, 2016 at 2:54 PM, Andi Kleen wrote:
> On Mon, Mar 21, 2016 at 02:49:44PM -0400, Brian Gerst wrote:
>> On Mon, Mar 21, 2016 at 12:16 PM, Andi Kleen wrote:
>> > From: Andi Kleen
>> >
>> > The kernel needs to explicitely enable RD/WRFSBASE to hand
On Mon, Mar 7, 2016 at 1:03 PM, Andy Lutomirski wrote:
> On Mon, Mar 7, 2016 at 9:17 AM, Brian Gerst wrote:
>> On Sun, Mar 6, 2016 at 12:52 AM, Andy Lutomirski wrote:
>>> Due to a blatant design error, SYSENTER doesn't clear TF. As a result,
>>> if a user do
to singlestep all the way
through the SYSENTER prologue.
Unless there is an actual issue with TIF_SINGLESTEP, I don't think
this patch is an improvement.
--
Brian Gerst
ed kernel on bare metal. This
would work though:
ALTERNATIVE "movl TSS_sysenter_sp0(%esp), %esp", "addl $5*4, %esp",
X86_FEATURE_XENPV
I haven't read the Xen hypervisor code, but what are those 5 words
that were pushed on the stack by the hypervisor? It suspiciously is
the size of an IRET frame. Considering that we don't use SYSEXIT on
Xen anymore, can we just redirect SYSENTER to the INT80 handler?
Perhaps even just disable SYSENTER support in the VDSO on Xen. I
can't imagine SYSENTER is any faster than INT80 on Xen, because it has
to trap to the hypervisor first.
--
Brian Gerst
%rsp
It would be better to add the offset to the initializer for
stack_start instead of adjusting it at runtime. That would require
moving the existing load of stack_start from the common path to the
secondary startup, which probably isn't a bad thing as it wouldn't
depend on the trampoline stack anymore.
--
Brian Gerst
set AC, so by adding it to
the test for flags to clear we can avoid the CLAC or POPF in the
common case that it is already clear.
--
Brian Gerst
dy on the stack wont ever trigger).
> -*/
> - boot_init_stack_canary();
> -#endif
> arch_cpu_idle_prepare();
> cpu_idle_loop();
> }
Does this actually work with stack protector enabled?
boot_init_stack_canary() is inlined while arch_cpu_idle_prepare() is
not.
--
Brian Gerst
th zero when the
> program begins to run" which I read as it's up to runtime and not the loader
> to do so.
>
> And since kernel does it explicitly on baremetal path I think it's a good
> idea for PV to do the same.
It does it on bare metal because bzImage is a raw binary image, not ELF.
--
Brian Gerst
On Thu, Feb 25, 2016 at 2:39 PM, Andy Lutomirski wrote:
> On Thu, Feb 25, 2016 at 11:31 AM, Brian Gerst wrote:
>> On Thu, Feb 25, 2016 at 1:30 PM, Linus Torvalds
>> wrote:
>>> On Thu, Feb 25, 2016 at 10:20 AM, Andy Lutomirski
>>> wrote:
>>>>
>&
y iret
> restores iopl, if I recall correctly (but maybe I don't, and I'm too
> lazy to take the 30 seconds to look it up).
>
> Linus
According to the SDM, popf will change IOPL only at CPL0, which is why
Xen (which runs at CPL1 on 32-bit) has a paravirt hook for it.
--
Brian Gerst
+
> #ifdef CONFIG_X86_32
> mov %esi,xen_start_info
> mov $init_thread_union+THREAD_SIZE,%esp
Better, but can still be improved. Replace WSIZE_SHIFT with
__ASM_SEL(2, 3), and use the macros for the registers (ie. __ASM_DI).
--
Brian Gerst
On Thu, Feb 25, 2016 at 8:47 AM, Brian Gerst wrote:
> On Thu, Feb 25, 2016 at 3:03 AM, Andy Lutomirski wrote:
>>
>> On Feb 24, 2016 10:01 PM, "H. Peter Anvin" wrote:
>>>
>>> On 02/24/16 21:53, tip-bot for Andy Lutomirski wrote:
>>> &g
confused as
> to the status on 32-bit. If we need to fix up NT, I think we can fold AC
> into that.
32-bit still saves eflags in switch_to(), so NT can't leak to other
tasks. But for consistency it should get the same treatment as 64-bit
(clear NT in sysenter entry and drop saving eflags in switch_to).
--
Brian Gerst
info
> + mov $init_thread_union+THREAD_SIZE,REG(sp)
> +
> jmp xen_start_kernel
>
> __FINIT
Use the macros in instead of defining your own. Also,
xorl %eax,%eax is good for 64-bit too, since the upper bits are
cleared.
--
Brian Gerst
orl $X86_EFLAGS_IF, (%esp) /* Fix IF */
> pushl $__USER_CS /* pt_regs->cs */
> pushl $0 /* pt_regs->ip = 0 (placeholder) */
> --
> 2.5.0
>
It looks like entry_INT80_compat is also missing a CLAC.
--
Brian Gerst
Commit-ID: 2476f2fa20568bd5d9e09cd35bcd73e99a6f4cc6
Gitweb: http://git.kernel.org/tip/2476f2fa20568bd5d9e09cd35bcd73e99a6f4cc6
Author: Brian Gerst
AuthorDate: Wed, 27 Jan 2016 09:45:25 +0100
Committer: Ingo Molnar
CommitDate: Sat, 30 Jan 2016 11:22:22 +0100
x86/alternatives: Discard
fect other than
>>determining which kernels actually support the syscall. Move
>>the logic into syscalltbl.sh.
>>
>>Signed-off-by: Andy Lutomirski
>>Cc: Andy Lutomirski
>>Cc: Borislav Petkov
>>Cc: Brian Gerst
>>Cc: Denys Vlasenko
>>Cc
erwise!
> */
>
> -#if __GNUC__ >= 4 && defined(CONFIG_X86_FAST_FEATURE_TESTS)
> +#if CC_HAVE_ASM_GOTO && defined(CONFIG_X86_FAST_FEATURE_TESTS)
This should be:
#if defined(CC_HAVE_ASM_GOTO) && ...
--
Brian Gerst
directly jumped to startup_64. However, this check
can be simplified to:
testl $~PMD_PAGE_MASK, %ebp
jnz bad_address
--
Brian Gerst
e direction this is going.
>
> Thanks!
>
> Borislav Petkov (4):
> x86/cpufeature: Carve out X86_FEATURE_*
> x86/cpufeature: Remove static_cpu_has()
> x86/cpufeature: Get rid of the non-asm goto variant
> x86/alternatives: Add an auxilary section
>
> Brian Gerst (
o_S = $(CC) $(a_flags) -c -o $@ $<
*.s (lower case) is the suffix used for preprocessed assembly files,
and there is already a rule for that. *.i is for preprocessed C
files.
--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the bod
On Wed, Dec 9, 2015 at 6:50 PM, Andy Lutomirski wrote:
> On Wed, Dec 9, 2015 at 1:15 PM, Andy Lutomirski wrote:
>> On Wed, Dec 9, 2015 at 1:08 PM, Brian Gerst wrote:
>>> Simplified version:
>>> ENTRY(stub_ptregs_64)
>>> cmpl $fast_path_return, (%rsp)
On Wed, Dec 9, 2015 at 1:53 PM, Andy Lutomirski wrote:
> On Wed, Dec 9, 2015 at 5:02 AM, Brian Gerst wrote:
>> Instead of using a duplicate syscall table for the fast path, create stubs
>> for
>> the syscalls that need pt_regs that save the extra registers if a flag for
&
Instead of using a duplicate syscall table for the fast path, create stubs for
the syscalls that need pt_regs that save the extra registers if a flag for the
slow path is not set.
Signed-off-by: Brian Gerst
To: Andy Lutomirski
Cc: Andy Lutomirski
Cc: the arch/x86 maintainers
Cc: Linux Kernel
On Wed, Dec 9, 2015 at 1:21 AM, Andy Lutomirski wrote:
> On Tue, Dec 8, 2015 at 9:45 PM, Andy Lutomirski wrote:
>> On Tue, Dec 8, 2015 at 8:43 PM, Brian Gerst wrote:
>>> On Mon, Dec 7, 2015 at 4:51 PM, Andy Lutomirski wrote:
>>>> 64-bit syscalls currently have an
48 c7 43 50 00 00 00 00 48 c7 c2 60 b4 c5 81 48 89
de 4c
[ 32.675469] RIP [] __audit_syscall_entry+0xcd/0xf0
[ 32.675471] RSP
--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More major
On Mon, Dec 7, 2015 at 8:12 PM, Andy Lutomirski wrote:
> On Mon, Dec 7, 2015 at 4:54 PM, Brian Gerst wrote:
>> On Mon, Dec 7, 2015 at 7:50 PM, Brian Gerst wrote:
>>> On Mon, Dec 7, 2015 at 4:51 PM, Andy Lutomirski wrote:
>>>> 64-bit syscalls currently have an
On Mon, Dec 7, 2015 at 7:50 PM, Brian Gerst wrote:
> On Mon, Dec 7, 2015 at 4:51 PM, Andy Lutomirski wrote:
>> 64-bit syscalls currently have an optimization in which they are
>> called with partial pt_regs. A small handful require full pt_regs.
>>
>> In the 32-bit
hout the duplicate syscall table.
ptregs_foo:
leaq sys_foo(%rip), %rax
jmp stub_ptregs_64
stub_ptregs_64:
testl $TS_EXTRAREGS, ti_status>
jnz 1f
SAVE_EXTRA_REGS
call *%rax
RESTORE_EXTRA_REGS
ret
1:
call *%rax
--
Brian Gerst
--
To unsubscribe from this lis
.Lsyscasll_32_done", X86_FEATURE_XENPV
>
> Borislav, what do you think?
>
> Ditto for the others.
Can you just add !xen_pv_domain() to the opportunistic SYSRET check
instead? Bury the alternatives in that macro, ie.
static_cpu_has(X86_FEATURE_XENPV). That would likely benefit other
; 31:0 - Mask: SYSCALL flag mask. Read-write. Reset: _h. This register
> holds the EFLAGS
> mask used by the SYSCALL instruction. 1=Clear the corresponding EFLAGS bit
> when executing the
> SYSCALL instruction.
>
> Intel has that too, except again, no SYSCALL in legacy mode on
On Fri, Oct 16, 2015 at 6:42 PM, Andy Lutomirski wrote:
> When I rewrote entry_INT80_32, I thought that int80 was an interrupt
> gate. It's a trap gate. *facepalm*
>
> Thanks to Brian Gerst for pointing out that it's better to change
> the entry code than to change the
On Fri, Oct 16, 2015 at 2:32 PM, Andy Lutomirski wrote:
> On Fri, Oct 16, 2015 at 11:22 AM, Brian Gerst wrote:
>> On Fri, Oct 16, 2015 at 1:34 PM, Borislav Petkov wrote:
>>> On Fri, Oct 16, 2015 at 08:59:23AM -0700, Andy Lutomirski wrote:
>>>> Wow I am incompetent.
o the tracing should be
fixed to expect interrupts on. do_int80_syscall_32() can be eliminated
too.
--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
s way, we don't even have an unconditional RMW op.
IF should normally be set in userspace, but since SYSENTER doesn't
save the old flags and always clears IF when entering the kernel, the
flags pushed on the stack will always have IF clear.
--
Brian Gerst
--
To unsubscribe from this list: send
t support SYSENTER and SYSCALL using
> alternatives.
This doesn't make sense to apply without the rest of the series.
--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info
sysenter_fix_flags
>> sysenter_flags_fixed:
>
> Btw, do I see it correctly that we can save us this jumping to
> sysenter_fix_flags and back to sysenter_flags_fixed? Label is jumped to
> only once and the couple of insns there can be behind a JZ...
This is an optimizat
R_LONG 64
>
> Can we write this as:
>
> #ifdef __ILP64__
Do all versions of gcc/clang define that, even if x32 isn't supported?
--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
nter_after_call
> --
> 2.4.3
>
While bisecting a boot failure on the 32-bit native kernel I came
across this build error:
arch/x86/built-in.o: In function `syscall_trace_entry':
/home/bgerst/kernel/linux/arch/x86/entry/entry_32.S:468: undefined
reference to `syscall_call'
/home/b
scalls.
>
> If we want some of the 25 cycles back, we could consider open-coding
> a new C fast path.
Is the 25 cycles for the compat or native case? I'd expect the native
case to be hit harder because of register pressure.
--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Tue, Sep 1, 2015 at 10:21 PM, Andy Lutomirski wrote:
> On Sep 1, 2015 6:53 PM, "Brian Gerst" wrote:
>>
>> On Tue, Sep 1, 2015 at 8:51 PM, Andy Lutomirski wrote:
>> > Hi all-
>> >
>> > Linux has a handful of weird features that are only supp
ain features.
>
> Ideas? We could add a new phdr for this, but then we'd need to play
> linker script games, and I'm not sure that could be done in a clean,
> extensible way.
The vsyscall page is mapped in the fixmap region, which is shared
between all processes. You can
On Mon, Aug 31, 2015 at 6:01 PM, Andy Lutomirski wrote:
> On Mon, Aug 31, 2015 at 2:47 PM, Brian Gerst wrote:
>> On Mon, Aug 31, 2015 at 5:00 PM, Andy Lutomirski wrote:
>>> Why not just a struct? Also, why is this all tangled up in gsbase
>>> initialization?
>&
nt, we have to make sure that the canary is placed at the start
of the percpu section. Overlaying it onto the bottom of the IRQ stack
and was the most convenient way to do it, with a side benefit that
overflowing the stack will trip the canary.
--
Brian Gerst
--
To unsubscribe from this list: se
On Sat, Aug 29, 2015 at 12:10 PM, Andy Lutomirski wrote:
> On Sat, Aug 29, 2015 at 8:20 AM, Brian Gerst wrote:
>> This patch set contains several cleanups to the 32-bit VDSO. The
>> main change is to only build one VDSO image, and select the syscall
>> entry point at runtim
Compile a separate sigreturn.o instead of including it in the three
syscall entry stub files. Use alternatives to patch in a syscall
instruction when supported.
Signed-off-by: Brian Gerst
---
arch/x86/entry/vdso/Makefile | 3 ++-
arch/x86/entry/vdso/vdso32/int80.S | 5 +
arch
Xen had its own vdso.h just to define VDSO_NOTE_NONEGSEG_BIT. Move it to the
main vdso.h.
Signed-off-by: Brian Gerst
---
arch/x86/entry/vdso/vdso-note.S | 4 +---
arch/x86/include/asm/vdso.h | 9 +
arch/x86/xen/setup.c| 1 -
arch/x86/xen/vdso.h | 4
4
of selecting the image, selects the entry point that is placed
in the AT_SYSINFO vector and the ELF entry point.
Signed-off-by: Brian Gerst
---
arch/x86/entry/vdso/.gitignore| 3 ---
arch/x86/entry/vdso/Makefile | 44 ---
arch/x86/entry/vdso
Merge the 32-bit versions of vclock_gettime and note.S into the 64-bit code.
Add some make rules to handle the combined code.
Signed-off-by: Brian Gerst
---
arch/x86/entry/vdso/Makefile| 10 ++-
arch/x86/entry/vdso/vclock_gettime.c| 31
arch/x86
Signed-off-by: Brian Gerst
---
arch/x86/entry/vdso/vdso32/vdso-fakesections.c | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 arch/x86/entry/vdso/vdso32/vdso-fakesections.c
diff --git a/arch/x86/entry/vdso/vdso32/vdso-fakesections.c
b/arch/x86/entry/vdso/vdso32/vdso-fakesections.c
Since the vdso32 subdirectory doesn't have a proper Makefile, it is more
difficult to work with. Move the remaining files up one level.
Signed-off-by: Brian Gerst
---
arch/x86/entry/vdso/.gitignore | 1 +
arch/x86/entry/vdso/Makefile| 14 ++-
arch/x86/entry/vdso/in
This symbol and the padding are unnecessary since we no longer rely
on the symbols being exactly the same in each variant of the vdso32.
Signed-off-by: Brian Gerst
---
arch/x86/entry/vdso/vdso32/int80.S| 8
arch/x86/entry/vdso/vdso32/syscall.S | 8
arch/x86/entry/vdso
This patch set contains several cleanups to the 32-bit VDSO. The
main change is to only build one VDSO image, and select the syscall
entry point at runtime.
arch/x86/entry/vdso/.gitignore | 4 +---
arch/x86/entry/vdso/Makefile | 53
++--
On Wed, Aug 26, 2015 at 1:10 PM, Andy Lutomirski wrote:
> On Tue, Aug 25, 2015 at 10:20 PM, Brian Gerst wrote:
>>>>> Thing 2: vdso compilation with binutils that doesn't support .cfi
>>>>> directives
>>>>>
>>>>> Userspace deb
201 - 300 of 669 matches
Mail list logo