public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] device-drivers/uaccess: add a workaround for Intel's SMAP feature
Date: Tue, 15 Mar 2016 17:30:30 +0800	[thread overview]
Message-ID: <56E7D636.9040804@cn.fujitsu.com> (raw)
In-Reply-To: <1458033917-13891-1-git-send-email-wangxg.fnst@cn.fujitsu.com>

hello,

Sorry, I do not have a machine with this SMAP feature, anybody can
help to test this patch, thanks very much.

Regards,
Xiaoguang Wang

On 03/15/2016 05:25 PM, Xiaoguang Wang wrote:
> When Intel's new "Supervisor Mode Access Prevention" (SMAP) feature is
> enabled, kernel will be forbidden to visit user space memory, please
> see url: https://lwn.net/Articles/517475/ for detailed infomation.
> 
> Here, we explicitly call stac()/clac() to enable/disable SMAP feature.
> 
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
>  testcases/kernel/device-drivers/uaccess/ltp_uaccess.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/testcases/kernel/device-drivers/uaccess/ltp_uaccess.c b/testcases/kernel/device-drivers/uaccess/ltp_uaccess.c
> index a9a06e9..35a9aa0 100644
> --- a/testcases/kernel/device-drivers/uaccess/ltp_uaccess.c
> +++ b/testcases/kernel/device-drivers/uaccess/ltp_uaccess.c
> @@ -68,6 +68,9 @@ static ssize_t sys_tcase(struct device *dev,
>  	str = (char *) ptr;
>  	test_result = 0;
>  
> +#ifdef CONFIG_X86_SMAP
> +	stac();
> +#endif
>  	switch (tc) {
>  	case TC_READ_USER:
>  		if (copy_from_user(buffer, str, str_size))
> @@ -90,6 +93,11 @@ static ssize_t sys_tcase(struct device *dev,
>  	break;
>  	}
>  
> +#ifdef CONFIG_X86_SMAP
> +	clac();
> +#endif
> +
> +
>  	return count;
>  }
>  static DEVICE_ATTR(tcase, S_IWUSR, NULL, sys_tcase);
> 




  reply	other threads:[~2016-03-15  9:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15  9:25 [LTP] [PATCH] device-drivers/uaccess: add a workaround for Intel's SMAP feature Xiaoguang Wang
2016-03-15  9:30 ` Xiaoguang Wang [this message]
2016-03-15 11:18   ` Alexey Kodanev
2016-03-15 11:29     ` Alexey Kodanev

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=56E7D636.9040804@cn.fujitsu.com \
    --to=wangxg.fnst@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /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