All of lore.kernel.org
 help / color / mirror / Atom feed
From: "François Legal" <devel@thom.fr.eu.org>
To: Philippe Gerum <rpm@xenomai.org>
Cc: "Greg Gallagher" <greg@embeddedgreg.com>,
	"Jan Kiszka" <jan.kiszka@siemens.com>,
	"Xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: Strange switching [threadname] to  secondary mode after exception #0 in kernel-space at 0x80272444
Date: Fri, 16 Oct 2020 11:45:19 +0200	[thread overview]
Message-ID: <1176-5f896b80-125-12dbaa60@116735130> (raw)
In-Reply-To: <87mu0m8s1g.fsf@xenomai.org>

Le Vendredi, Octobre 16, 2020 10:59 CEST, Philippe Gerum <rpm@xenomai.org> a écrit:

>
> François Legal <devel@thom.fr.eu.org> writes:
>
> > Le Mercredi, Octobre 14, 2020 16:16 CEST, Greg Gallagher <greg@embeddedgreg.com> a écrit:
> >
> >> On Wed, Oct 14, 2020 at 5:37 AM Jan Kiszka <jan.kiszka@siemens.com> wrote:
> >> >
> >> > On 14.10.20 10:43, François Legal via Xenomai wrote:
> >> > > Anybody can help on this ?
> >> > >
> >> >
> >> > I'm unfortunately not familiar with the armv7 details of copy-from-user,
> >> > not too speak of how spectre contributed to it. Greg, Philippe, did you
> >> > come across this already?
> >> >
> >> > Jan
> >> >
> >> I'll take a look tonight but I haven't hit this in my testing.  This
> >> was found on 4.4? Have you tried the 4.19 kernels?
> >>
> >> -Greg
> >
> > So I tried the same case on 4.19.121, with the same result, and I guess for the same reason.
> > Could anybody explain why, on ARMv7, we need to copy the message header at the syscall entry, and not let the xxxmsg routine do it on its own ?
> > Also, I could not find how those COBALT_SYSCALL32emu logic work.
>
> There is no way an armv7 system would run the sys32emu code in
> Cobalt. This code path is specific to architectures which support mixed
> ABI models. Only Cobalt/x86 supports this so far, issuing x86_32
> syscalls to an x86_64 kernel. You may want to check
> CONFIG_XENO_ARCH_SYS3264, it is set to "def_bool n" in the Kconfig
> stuff.
>

Maybe I don't use the right terms here, but what I can see from the code is (in linux tree kernel/xenomai/posix/syscall32.c)
COBALT_SYSCALL32emu(sendmsg, handover,
		    (int fd, struct compat_msghdr __user *umsg, int flags))
{
	struct user_msghdr m;
	int ret;

	ret = sys32_get_msghdr(&m, umsg);

	return ret ?: rtdm_fd_sendmsg(fd, &m, flags);
}

And the problem regarding SPECTRE mitigation is with the "ret = sys32_get_msghdr(&m, umsg);" line, as af_packet (in my case, but I believe the other handlers should do the same) will also call copy_from_user on the "msghdr" argument, and the SPECTRE mitigation will check that this pointer is in the userland MM area.

> Converting long/pointer data conforming to a 32bit ABI to their 64bit
> representation is the reason why the sys32/compat wrappers exist and are
> compiled in when CONFIG_XENO_ARCH_SYS3264 is set. Aggregates arguments
> such as msg headers do contain such data.
>
> > Can anybody point me to some documentation ?
> >
>
> There is none, I'm afraid.
>
> --
> Philippe.



  reply	other threads:[~2020-10-16  9:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 13:46 Strange switching [threadname] to secondary mode after exception #0 in kernel-space at 0x80272444 François Legal
2020-08-21 18:04 ` Jan Kiszka
2020-08-24  9:44   ` François Legal
2020-08-24 11:28     ` Jan Kiszka
2020-09-25 16:11   ` François Legal
2020-09-30  6:42     ` François Legal
2020-09-30  8:48       ` François Legal
2020-09-30 15:14         ` François Legal
2020-10-14  8:43           ` François Legal
2020-10-14  9:37             ` Jan Kiszka
2020-10-14 14:16               ` Greg Gallagher
2020-10-16  7:14                 ` François Legal
2020-10-16  8:59                   ` Philippe Gerum
2020-10-16  9:45                     ` François Legal [this message]
2020-10-16 12:03                       ` Philippe Gerum
2020-10-16 14:05                         ` François Legal
2020-10-16 16:24                           ` Philippe Gerum
2020-10-19  6:17                             ` François Legal
2020-10-31 16:48                               ` Philippe Gerum
2020-11-02  8:08                                 ` François Legal
2020-11-20 16:06                                   ` François Legal
2020-12-03 13:52                                     ` Philippe Gerum
2020-10-22 12:22                             ` François Legal

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=1176-5f896b80-125-12dbaa60@116735130 \
    --to=devel@thom.fr.eu.org \
    --cc=greg@embeddedgreg.com \
    --cc=jan.kiszka@siemens.com \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.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.