[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALCETrU4-ew7qNn5TWx=Y0Vizzvf+vPoS8DmQbT=wRQs4_yHsg@mail.gmail.com>
Date: Wed, 26 Feb 2014 11:00:21 -0800
From: Andy Lutomirski <luto@...capital.net>
To: Ren Qiaowei <qiaowei.ren@...el.com>
Cc: "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, X86 ML <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 2/3] x86, mpx: hook #BR exception handler to allocate
bound tables
On Thu, Feb 20, 2014 at 6:44 PM, Ren Qiaowei <qiaowei.ren@...el.com> wrote:
> 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@...el.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);
I wonder if this should go through the force_sig_info path.
--Andy
>
> Thanks,
> Qiaowei
>
--
Andy Lutomirski
AMA Capital Management, LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists