public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ren Qiaowei <qiaowei.ren@intel.com>
To: Andy Lutomirski <luto@amacapital.net>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/3] x86, mpx: hook #BR exception handler to allocate bound tables
Date: Fri, 21 Feb 2014 10:44:29 +0800	[thread overview]
Message-ID: <5306BD8D.3030606@intel.com> (raw)
In-Reply-To: <52FBD74F.7050203@mit.edu>

On 02/13/2014 04:19 AM, Andy Lutomirski wrote:
> On 02/12/2014 10:36 AM, Qiaowei Ren wrote:
>> An access to an invalid bound directory entry will cause a #BR
>> exception. This patch hook #BR exception handler to allocate
>> one bound table and bind it with that buond directory entry.
>>
>> This will avoid the need of forwarding the #BR exception
>> to the user space when bound directory has invalid entry.
>>
>> Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
>> ---
>> +void do_mpx_bt_fault(struct xsave_struct *xsave_buf)
>> +{
>> +	unsigned long status;
>> +	unsigned long bd_entry, bd_base;
>> +	unsigned long bd_size = 1UL << (MPX_L1_BITS+MPX_L1_SHIFT);
>> +
>> +	bd_base = xsave_buf->bndcsr.cfg_reg_u & MPX_BNDCFG_ADDR_MASK;
>> +	status = xsave_buf->bndcsr.status_reg;
>> +
>> +	bd_entry = status & MPX_BNDSTA_ADDR_MASK;
>> +	if ((bd_entry >= bd_base) && (bd_entry < bd_base + bd_size))
>> +		allocate_bt(bd_entry);
>> +}
>
> This still just loops on failure, right?
>
Seems like that SIGBUS should be raised if the allocation fail.

	if (!do_mpx_bt_fault(xsave_buf))
		force_sig(SIGBUS, tsk);

Thanks,
Qiaowei


  reply	other threads:[~2014-02-21  2:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 18:36 [PATCH v4 0/3] Intel MPX support Qiaowei Ren
2014-02-12 18:36 ` [PATCH v4 1/3] x86, mpx: add documentation on Intel MPX Qiaowei Ren
2014-02-12 18:36 ` [PATCH v4 2/3] x86, mpx: hook #BR exception handler to allocate bound tables Qiaowei Ren
2014-02-12 20:19   ` Andy Lutomirski
2014-02-21  2:44     ` Ren Qiaowei [this message]
2014-02-26 19:00       ` Andy Lutomirski
2014-02-12 18:36 ` [PATCH v4 3/3] x86, mpx: extend siginfo structure to include bound violation information Qiaowei Ren

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=5306BD8D.3030606@intel.com \
    --to=qiaowei.ren@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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