Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1222914

Re: [PATCH] arm/xen: Enable user access to the kernel before issuing a privcmd call

From Russell King - ARM Linux <linux@arm.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] arm/xen: Enable user access to the kernel before issuing a privcmd call
Date 2015-09-11 17:30 +0200
Message-ID <q7yr2-5BA-53@gated-at.bofh.it> (permalink)
References <q7xlf-42z-19@gated-at.bofh.it> <q7xuV-4eq-7@gated-at.bofh.it> <q7xOi-4C9-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Sep 11, 2015 at 03:45:29PM +0100, Julien Grall wrote:
> Looking to the uaccess_save macro:
> 
>         .macro  uaccess_save, tmp
> #ifdef CONFIG_CPU_SW_DOMAIN_PAN
>         mrc     p15, 0, \tmp, c3, c0, 0
>         str     \tmp, [sp, #S_FRAME_SIZE]
> #endif
>         .endm
> 
> 
> It's saving the register on the Stack with an offset S_FRAME_SIZE.
> AFAICT, S_FRAME_SIZE is the size of the pt_regs structure.

While in the kernel, the uaccess state will be disabled except for the
specific sites reading or writing userspace.  That means the user-access
part of the DACR is well known.

What isn't known is whether we're executing here in the kernel segment
(set_fs(get_ds())) or not - which allows the kernel to use the userspace
accessors to safely read from its own memory space.

If we can assume that's not in effect, then the DACR value is fully
known at this point, and you can just do a:

	uaccess_enable rtmp
	HVC call
	uaccess_disable rtmp

where rtmp is a register you can afford to be changed by the macro.
I suspect 'ip' would be a good choice there.

Please put the macros as close to __HVC(XEN_IMM) as possible.

Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] arm/xen: Enable user access to the kernel before issuing a privcmd call Julien Grall <julien.grall@citrix.com> - 2015-09-11 16:20 +0200
  Re: [PATCH] arm/xen: Enable user access to the kernel before  issuing a privcmd call Ian Campbell <ian.campbell@citrix.com> - 2015-09-11 16:30 +0200
    Re: [PATCH] arm/xen: Enable user access to the kernel before issuing  a privcmd call Julien Grall <julien.grall@citrix.com> - 2015-09-11 16:50 +0200
      Re: [PATCH] arm/xen: Enable user access to the kernel before issuing  a privcmd call Julien Grall <julien.grall@citrix.com> - 2015-09-11 17:00 +0200
        Re: [PATCH] arm/xen: Enable user access to the kernel before issuing  a privcmd call Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-09-11 17:30 +0200
          Re: [PATCH] arm/xen: Enable user access to the kernel before issuing  a privcmd call Julien Grall <julien.grall@citrix.com> - 2015-09-11 17:40 +0200
      Re: [PATCH] arm/xen: Enable user access to the kernel before  issuing a privcmd call Ian Campbell <ian.campbell@citrix.com> - 2015-09-11 17:00 +0200
      Re: [PATCH] arm/xen: Enable user access to the kernel before issuing  a privcmd call Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-09-11 17:30 +0200
    Re: [PATCH] arm/xen: Enable user access to the kernel before issuing  a privcmd call Julien Grall <julien.grall@citrix.com> - 2015-09-11 18:30 +0200

csiph-web