From: Brian Gerst <brgerst@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
Andy Lutomirski <luto@amacapital.net>,
Borislav Petkov <bp@suse.de>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 1/4] x86: Save return value from kernel_thread
Date: Sat, 21 May 2016 12:04:48 -0400 [thread overview]
Message-ID: <1463846691-18498-2-git-send-email-brgerst@gmail.com> (raw)
In-Reply-To: <1463846691-18498-1-git-send-email-brgerst@gmail.com>
Kernel threads should always return zero on success after calling do_execve(). The
two existing cases in the kernel (kernel_init() and call_usermodehelper_exec_async())
correctly do this. Save a few bytes by storing EAX/RAX instead of an immediate zero.
Also fix the 64-bit case which should save the full 64-bits.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
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.S
+++ b/arch/x86/entry/entry_32.S
@@ -221,7 +221,7 @@ ENTRY(ret_from_kernel_thread)
popl %eax
movl PT_EBP(%esp), %eax
call *PT_EBX(%esp)
- movl $0, PT_EAX(%esp)
+ movl %eax, PT_EAX(%esp)
/*
* Kernel threads return to userspace as if returning from a syscall.
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 9ee0da1..ab9f8c8 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -387,7 +387,7 @@ ENTRY(ret_from_fork)
*/
movq RBP(%rsp), %rdi
call *RBX(%rsp)
- movl $0, RAX(%rsp)
+ movq %rax, RAX(%rsp)
/*
* Fall through as though we're exiting a syscall. This makes a
--
2.5.5
next prev parent reply other threads:[~2016-05-21 16:06 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-21 16:04 [PATCH 0/4] x86: Rewrite switch_to() Brian Gerst
2016-05-21 16:04 ` Brian Gerst [this message]
2016-05-22 1:44 ` [PATCH 1/4] x86: Save return value from kernel_thread Andy Lutomirski
2016-05-22 2:19 ` Brian Gerst
2016-05-21 16:04 ` [PATCH 2/4] x86-32, kgdb: Don't use thread.ip in sleeping_thread_to_gdb_regs() Brian Gerst
2016-05-23 17:05 ` Andy Lutomirski
2016-05-21 16:04 ` [PATCH 3/4] x86: Rewrite switch_to() code Brian Gerst
2016-05-22 17:59 ` Andy Lutomirski
2016-05-22 19:31 ` Brian Gerst
2016-05-22 21:07 ` Andy Lutomirski
2016-05-23 2:34 ` Josh Poimboeuf
2016-05-23 4:47 ` Andy Lutomirski
2016-05-23 11:40 ` Josh Poimboeuf
2016-05-23 11:49 ` Brian Gerst
2016-05-23 12:05 ` Josh Poimboeuf
2016-05-23 11:14 ` Brian Gerst
2016-05-23 11:47 ` Josh Poimboeuf
2016-05-23 11:49 ` Josh Poimboeuf
2016-05-23 16:46 ` Josh Poimboeuf
2016-05-23 17:03 ` Andy Lutomirski
2016-05-23 18:44 ` Josh Poimboeuf
2016-07-12 14:16 ` Josh Poimboeuf
2016-06-15 1:31 ` Andy Lutomirski
2016-06-15 8:03 ` Ingo Molnar
2016-06-15 11:52 ` Brian Gerst
2016-05-21 16:04 ` [PATCH 4/4] x86: Pass kernel thread parameters in fork_frame Brian Gerst
2016-05-22 18:01 ` Andy Lutomirski
2016-05-22 19:21 ` Brian Gerst
2016-05-23 15:23 ` Josh Poimboeuf
2016-05-23 15:36 ` Andy Lutomirski
2016-05-23 21:04 ` Brian Gerst
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=1463846691-18498-2-git-send-email-brgerst@gmail.com \
--to=brgerst@gmail.com \
--cc=bp@suse.de \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox