All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Peter Anvin <h.peter.anvin@intel.com>,
	kernel test robot <xiaolong.ye@intel.com>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Lutomirski <luto@kernel.org>,
	Borislav Petkov <bp@alien8.de>, Brian Gerst <brgerst@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Anvin <hpa@zytor.com>, tipbuild@zytor.com, LKP <lkp@01.org>
Subject: "interesting" entry in hibernation code was Re: [lkp-robot] [x86/asm] 51bad67ffb: int3:#[##]
Date: Sat, 19 May 2018 09:00:08 +0200	[thread overview]
Message-ID: <20180519070008.GC30676@amd> (raw)
In-Reply-To: <CA+55aFwrT-BAvdujUonX5MvB=8GFopQJT4x6xMhtjNN2G0AxSw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]

Hi!

> Side note: doing some grepping, I find some other sequences that are a bit
> scary, like this:
> 
> arch/x86/kernel/acpi/wakeup_32.S-.data
> arch/x86/kernel/acpi/wakeup_32.S-ALIGN
> arch/x86/kernel/acpi/wakeup_32.S:ENTRY(saved_magic)     .long   0
> arch/x86/kernel/acpi/wakeup_32.S:ENTRY(saved_eip)       .long   0
> 
> so apparently people are using ENTRY() for data too (the same pattern
> exists in wakeup_64.S).
> 
> So we end up having those odd 0x90 bytes (now 0xcc) in the data section as
> "padding" between those two values. Crazy.

Sorry about that. I'm pretty sure intention was simply to use the
variable from C code.. and ENTRY() worked. I was not aware that it has
side effect of padding...

Let me see how this can be improved... (untested).

diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index 0c26b1b..d6f477f 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -89,8 +89,8 @@ ret_point:
 
 .data
 ALIGN
-ENTRY(saved_magic)	.long	0
-ENTRY(saved_eip)	.long	0
+GLOBAL(saved_magic)	.long	0
+saved_eip:	.long	0
 
 # saved registers
 saved_idt:	.long	0,0


									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel@ucw.cz>
To: lkp@lists.01.org
Subject: "interesting" entry in hibernation code was Re: [lkp-robot] [x86/asm] 51bad67ffb: int3:#[##]
Date: Sat, 19 May 2018 09:00:08 +0200	[thread overview]
Message-ID: <20180519070008.GC30676@amd> (raw)
In-Reply-To: <CA+55aFwrT-BAvdujUonX5MvB=8GFopQJT4x6xMhtjNN2G0AxSw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]

Hi!

> Side note: doing some grepping, I find some other sequences that are a bit
> scary, like this:
> 
> arch/x86/kernel/acpi/wakeup_32.S-.data
> arch/x86/kernel/acpi/wakeup_32.S-ALIGN
> arch/x86/kernel/acpi/wakeup_32.S:ENTRY(saved_magic)     .long   0
> arch/x86/kernel/acpi/wakeup_32.S:ENTRY(saved_eip)       .long   0
> 
> so apparently people are using ENTRY() for data too (the same pattern
> exists in wakeup_64.S).
> 
> So we end up having those odd 0x90 bytes (now 0xcc) in the data section as
> "padding" between those two values. Crazy.

Sorry about that. I'm pretty sure intention was simply to use the
variable from C code.. and ENTRY() worked. I was not aware that it has
side effect of padding...

Let me see how this can be improved... (untested).

diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index 0c26b1b..d6f477f 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -89,8 +89,8 @@ ret_point:
 
 .data
 ALIGN
-ENTRY(saved_magic)	.long	0
-ENTRY(saved_eip)	.long	0
+GLOBAL(saved_magic)	.long	0
+saved_eip:	.long	0
 
 # saved registers
 saved_idt:	.long	0,0


									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2018-05-19  7:00 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15  8:00 [lkp-robot] [x86/asm] 51bad67ffb: int3:#[##] kernel test robot
2018-05-15  8:00 ` kernel test robot
2018-05-15 21:07 ` Alexey Dobriyan
2018-05-15 21:07   ` Alexey Dobriyan
2018-05-15 21:25   ` Anvin, H Peter
2018-05-15 21:43     ` Alexey Dobriyan
2018-05-15 21:43       ` Alexey Dobriyan
2018-05-15 22:22       ` Josh Poimboeuf
2018-05-15 22:22         ` Josh Poimboeuf
2018-05-15 22:26         ` Thomas Gleixner
2018-05-15 22:26           ` Thomas Gleixner
2018-05-15 22:28         ` Linus Torvalds
2018-05-15 22:28           ` Linus Torvalds
2018-05-15 22:43           ` Josh Poimboeuf
2018-05-15 22:43             ` Josh Poimboeuf
2018-05-15 22:52             ` Linus Torvalds
2018-05-15 22:52               ` Linus Torvalds
2018-05-15 23:05               ` Linus Torvalds
2018-05-15 23:05                 ` Linus Torvalds
2018-05-16  3:30                 ` Josh Poimboeuf
2018-05-16  3:30                   ` Josh Poimboeuf
2018-05-17 13:49                   ` [PATCH] objtool: Detect assembly code falling through to INT3 padding Josh Poimboeuf
2018-05-17 13:49                     ` Josh Poimboeuf
2018-05-17 14:01                     ` Peter Zijlstra
2018-05-17 14:01                       ` Peter Zijlstra
2018-05-18  7:24                       ` Ingo Molnar
2018-05-18  7:24                         ` Ingo Molnar
2018-05-18  7:18                     ` Ingo Molnar
2018-05-18  7:18                       ` Ingo Molnar
2018-05-18  7:27                       ` H. Peter Anvin
2018-05-18 16:06                         ` Borislav Petkov
2018-05-18 16:06                           ` Borislav Petkov
2018-05-18  7:27                       ` Ingo Molnar
2018-05-18  7:27                         ` Ingo Molnar
2018-05-18 17:51                       ` Alexey Dobriyan
2018-05-18 17:51                         ` Alexey Dobriyan
2018-05-19  8:18                         ` hpa
2018-05-19  7:00                 ` Pavel Machek [this message]
2018-05-19  7:00                   ` "interesting" entry in hibernation code was Re: [lkp-robot] [x86/asm] 51bad67ffb: int3:#[##] Pavel Machek
2018-05-19  8:35                   ` Rafael J. Wysocki
2018-05-19  8:35                     ` Rafael J. Wysocki
2018-05-18  7:15               ` Ingo Molnar
2018-05-18  7:15                 ` Ingo Molnar
2018-05-15 22:25       ` Thomas Gleixner
2018-05-15 22:25         ` Thomas Gleixner
2018-05-15 22:29         ` Andy Lutomirski
2018-05-15 22:29           ` Andy Lutomirski
2018-05-15 22:27       ` Linus Torvalds
2018-05-15 22:27         ` Linus Torvalds
2018-05-15 22:50         ` Alexey Dobriyan
2018-05-15 22:50           ` Alexey Dobriyan
2018-05-15 22:58           ` [PATCH v2] x86/asm: Pad assembly functions with INT3 instructions Alexey Dobriyan
2018-05-15 22:58             ` Alexey Dobriyan
2018-05-15 23:28             ` Linus Torvalds
2018-05-15 23:28               ` Linus Torvalds
2018-05-18  7:36             ` Ingo Molnar
2018-05-18  7:36               ` Ingo Molnar
2018-05-18 13:02               ` Josh Poimboeuf
2018-05-18 13:02                 ` Josh Poimboeuf
2018-05-18 17:34                 ` Alexey Dobriyan
2018-05-18 17:34                   ` Alexey Dobriyan

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=20180519070008.GC30676@amd \
    --to=pavel@ucw.cz \
    --cc=adobriyan@gmail.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=h.peter.anvin@intel.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    --cc=tipbuild@zytor.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xiaolong.ye@intel.com \
    /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.