From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
syzbot <syzbot+488ddf8087564d6de6e2@syzkaller.appspotmail.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk,
will@kernel.org, x86@kernel.org
Subject: Re: [syzbot] upstream test error: KASAN: invalid-access Read in __entry_tramp_text_end
Date: Tue, 28 Sep 2021 18:36:37 -0700 [thread overview]
Message-ID: <20210929013637.bcarm56e4mqo3ndt@treble> (raw)
In-Reply-To: <20210928103543.GF1924@C02TD0UTHF1T.local>
On Tue, Sep 28, 2021 at 11:35:43AM +0100, Mark Rutland wrote:
> > In the other x86 thread Josh Poimboeuf suggested to use asm goto to a
> > cold part of the function instead of .fixup:
> > https://lore.kernel.org/lkml/20210927234543.6waods7rraxseind@treble/
> > This sounds like a more reliable solution that will cause less
> > maintenance burden. Would it work for arm64 as well?
>
> Maybe we can use that when CC_HAS_ASM_GOTO_OUTPUT is avaiable, but in
> general we can't rely on asm goto supporting output arguments (and IIRC
> GCC doesn't support that at all), so we'd still have to support the
> current fixup scheme.
Even without CC_HAS_ASM_GOTO_OUTPUT it should still be possible to hack
something together if you split the original insn asm and the extable
asm into separate statements, like:
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 6b52182e178a..8f62469f2027 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -137,20 +139,21 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
{
DECLARE_ARGS(val, low, high);
- asm volatile("2: rdmsr ; xor %[err],%[err]\n"
- "1:\n\t"
- ".section .fixup,\"ax\"\n\t"
- "3: mov %[fault],%[err]\n\t"
- "xorl %%eax, %%eax\n\t"
- "xorl %%edx, %%edx\n\t"
- "jmp 1b\n\t"
- ".previous\n\t"
- _ASM_EXTABLE(2b, 3b)
- : [err] "=r" (*err), EAX_EDX_RET(val, low, high)
- : "c" (msr), [fault] "i" (-EIO));
+ *err = 0;
+ asm volatile("417: rdmsr\n"
+ : EAX_EDX_RET(val, low, high)
+ : "c" (msr));
+ asm_volatile_goto(_ASM_EXTABLE(417b, %l[Efault]) :::: Efault);
+
+done:
if (tracepoint_enabled(read_msr))
do_trace_read_msr(msr, EAX_EDX_VAL(val, low, high), *err);
return EAX_EDX_VAL(val, low, high);
+
+Efault:
+ *err = -EIO;
+ ZERO_ARGS(val, low, high);
+ goto done;
}
/* Can be uninlined because referenced by paravirt */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-09-29 1:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <000000000000a3cf8605cb2a1ec0@google.com>
2021-09-17 15:03 ` [syzbot] upstream test error: KASAN: invalid-access Read in __entry_tramp_text_end Dmitry Vyukov
2021-09-21 16:51 ` Mark Rutland
2021-09-27 14:27 ` Dmitry Vyukov
2021-09-27 14:30 ` Dmitry Vyukov
2021-09-27 17:01 ` Mark Rutland
2021-09-27 17:18 ` Mark Rutland
2021-09-28 10:19 ` Dmitry Vyukov
2021-09-28 10:35 ` Mark Rutland
2021-09-29 1:36 ` Josh Poimboeuf [this message]
2021-09-29 7:39 ` Peter Zijlstra
2021-09-29 8:50 ` Mark Rutland
2021-09-29 9:59 ` Peter Zijlstra
2021-09-29 10:37 ` Mark Rutland
2021-09-29 11:43 ` Peter Zijlstra
2021-09-30 19:26 ` Josh Poimboeuf
2021-10-01 12:27 ` Mark Rutland
2021-10-02 5:10 ` Josh Poimboeuf
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=20210929013637.bcarm56e4mqo3ndt@treble \
--to=jpoimboe@redhat.com \
--cc=dvyukov@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=syzbot+488ddf8087564d6de6e2@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=viro@zeniv.linux.org.uk \
--cc=will@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).