From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp1040.oracle.com ([156.151.31.81]:46569 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751756AbbG3Sgu (ORCPT ); Thu, 30 Jul 2015 14:36:50 -0400 Message-ID: <55BA6E6B.7040102@oracle.com> Date: Thu, 30 Jul 2015 14:35:23 -0400 From: Boris Ostrovsky MIME-Version: 1.0 To: Andy Lutomirski CC: Andy Lutomirski , Peter Zijlstra , Steven Rostedt , "security@kernel.org" , X86 ML , Borislav Petkov , Sasha Levin , "linux-kernel@vger.kernel.org" , Konrad Rzeszutek Wilk , Andrew Cooper , Jan Beulich , xen-devel , stable Subject: Re: [PATCH v5 2/4] x86/ldt: Make modify_ldt synchronous References: <1f1e8e0367408585694132a0e8693d157959ce30.1438061139.git.luto@kernel.org> <55BA6534.2080407@oracle.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 07/30/2015 02:14 PM, Andy Lutomirski wrote: > On Thu, Jul 30, 2015 at 10:56 AM, Boris Ostrovsky > wrote: >> On 07/28/2015 01:29 AM, Andy Lutomirski wrote: >> >>> + >>> +static inline void load_mm_ldt(struct mm_struct *mm) >>> +{ >>> + struct ldt_struct *ldt; >>> + DEBUG_LOCKS_WARN_ON(!irqs_disabled()); >> >> >> I thought this was supposed to be checking preemptible()? > v6 fixes that. Check your future inbox :) I'm goint to rework the > Xen bit too based on the long discussion. > > Is that the only failure you're seeing? Yes. > ldt_gdt_32 passes on 64-bit for me With your patch: root@haswell> uname -a Linux dhcp-burlington7-2nd-B-east-10-152-55-89.usdhcp.oraclecorp.com 4.2.0-rc4 #107 SMP Thu Jul 30 11:05:19 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux root@haswell> cd tmp/linux/tools/testing/selftests/x86/ root@haswell> ls -l ldt_gdt_32 -rwxr-xr-x 1 root root 25975 Jul 30 11:48 ldt_gdt_32 root@haswell> ./ldt_gdt_32 [OK] LDT entry 0 has AR 0x0040FA00 and limit 0x0000000A [OK] LDT entry 0 has AR 0x00C0FA00 and limit 0x0000AFFF [OK] LDT entry 1 is invalid [OK] LDT entry 2 has AR 0x00C0FA00 and limit 0x0000AFFF [OK] LDT entry 1 is invalid [OK] LDT entry 2 has AR 0x00C0FA00 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D0FA00 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D07A00 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00907A00 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D07200 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D07000 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D07400 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00507600 and limit 0x0000000A [OK] LDT entry 2 has AR 0x00507E00 and limit 0x0000000A [OK] LDT entry 2 has AR 0x00507C00 and limit 0x0000000A [OK] LDT entry 2 has AR 0x00507A00 and limit 0x0000000A [OK] LDT entry 2 has AR 0x00507800 and limit 0x0000000A [RUN] Test fork [OK] LDT entry 2 has AR 0x00507800 and limit 0x0000000A [OK] LDT entry 1 is invalid [OK] Child succeeded [RUN] Test size [DONE] Size test [OK] modify_ldt failure 22 [OK] LDT entry 0 has AR 0x0000F200 and limit 0x00000000 [OK] LDT entry 0 has AR 0x00007200 and limit 0x00000000 [OK] LDT entry 0 has AR 0x0000F000 and limit 0x00000000 [OK] LDT entry 0 has AR 0x00007200 and limit 0x00000000 [OK] LDT entry 0 has AR 0x00007000 and limit 0x00000001 [OK] LDT entry 0 has AR 0x00007000 and limit 0x00000000 [OK] LDT entry 0 is invalid [OK] LDT entry 0 has AR 0x0040F200 and limit 0x00000000 [OK] LDT entry 0 is invalid [RUN] Cross-CPU LDT invalidation Segmentation fault (core dumped) root@haswell> dmesg | grep -i xen [ 2.953815] xenfs: not registering filesystem on non-xen platform [ 17.495141] IPv6: ADDRCONF(NETDEV_UP): xenbr0: link is not ready [ 20.913839] xenbr0: port 1(eth0) entered forwarding state [ 20.913907] xenbr0: port 1(eth0) entered forwarding state [ 20.914044] IPv6: ADDRCONF(NETDEV_CHANGE): xenbr0: link becomes ready On a slightly older kernel: root@haswell> uname -a Linux dhcp-burlington7-2nd-B-east-10-152-55-89.usdhcp.oraclecorp.com 4.1.0-rc2 #111 SMP Fri Jun 19 16:28:46 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux root@haswell> cd tmp/linux/tools/testing/selftests/x86/ root@haswell> ls -l ldt_gdt_32 -rwxr-xr-x 1 root root 25975 Jul 30 11:48 ldt_gdt_32 root@haswell> ./ldt_gdt_32 [OK] LDT entry 0 has AR 0x0040FA00 and limit 0x0000000A [OK] LDT entry 0 has AR 0x00C0FA00 and limit 0x0000AFFF [OK] LDT entry 1 is invalid [OK] LDT entry 2 has AR 0x00C0FA00 and limit 0x0000AFFF [OK] LDT entry 1 is invalid [OK] LDT entry 2 has AR 0x00C0FA00 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D0FA00 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D07A00 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00907A00 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D07200 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D07000 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00D07400 and limit 0x0000AFFF [OK] LDT entry 2 has AR 0x00507600 and limit 0x0000000A [OK] LDT entry 2 has AR 0x00507E00 and limit 0x0000000A [OK] LDT entry 2 has AR 0x00507C00 and limit 0x0000000A [OK] LDT entry 2 has AR 0x00507A00 and limit 0x0000000A [OK] LDT entry 2 has AR 0x00507800 and limit 0x0000000A [RUN] Test fork [OK] LDT entry 2 has AR 0x00507800 and limit 0x0000000A [OK] LDT entry 1 is invalid [OK] Child succeeded [RUN] Test size [DONE] Size test [OK] modify_ldt failure 22 [OK] LDT entry 0 has AR 0x0000F200 and limit 0x00000000 [OK] LDT entry 0 has AR 0x00007200 and limit 0x00000000 [OK] LDT entry 0 has AR 0x0000F000 and limit 0x00000000 [OK] LDT entry 0 has AR 0x00007200 and limit 0x00000000 [OK] LDT entry 0 has AR 0x00007000 and limit 0x00000001 [OK] LDT entry 0 has AR 0x00007000 and limit 0x00000000 [OK] LDT entry 0 is invalid [OK] LDT entry 0 has AR 0x0040F200 and limit 0x00000000 [OK] LDT entry 0 is invalid [RUN] Cross-CPU LDT invalidation [FAIL] 5 of 5 iterations failed root@haswell> dmesg | grep -i xen [ 2.971167] xenfs: not registering filesystem on non-xen platform [ 17.144879] IPv6: ADDRCONF(NETDEV_UP): xenbr0: link is not ready [ 20.588663] xenbr0: port 1(eth0) entered forwarding state [ 20.588706] xenbr0: port 1(eth0) entered forwarding state [ 20.588802] IPv6: ADDRCONF(NETDEV_CHANGE): xenbr0: link becomes ready