Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758739AbcDHQAo (ORCPT ); Fri, 8 Apr 2016 12:00:44 -0400 Received: from mail-oi0-f41.google.com ([209.85.218.41]:35940 "EHLO mail-oi0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758695AbcDHQAm (ORCPT ); Fri, 8 Apr 2016 12:00:42 -0400 MIME-Version: 1.0 In-Reply-To: <5707654F.1060407@citrix.com> References: <5707654F.1060407@citrix.com> From: Andy Lutomirski Date: Fri, 8 Apr 2016 09:00:21 -0700 Message-ID: Subject: Re: [Xen-devel] Does __KERNEL_DS serve a purpose? To: Andrew Cooper Cc: Andy Lutomirski , X86 ML , "linux-kernel@vger.kernel.org" , Borislav Petkov , kvm list , xen-devel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 899 Lines: 23 On Fri, Apr 8, 2016 at 1:01 AM, Andrew Cooper wrote: > On 08/04/2016 01:24, Andy Lutomirski wrote: >> I can't see any reason that we need the __KERNEL_DS segment at all -- >> I think that everything that uses __KERNEL_DS could use __USER_DS >> instead. Am I missing anything? This has been bugging me for a >> while. >> >> I mulled over this a bit when trying to understand the sysret_ss_attrs >> bug and then forgot about it. > > Linux doesn't have a separate __KERNEL_SS. For the plain data segments, > the dpl is not interesting. > > However, %ss is also loaded with __KERNEL_DS, and %ss.dpl is somewhat > important. But %ss can be loaded with 0 on 64-bit kernels. (I assume that loading 0 into %ss sets SS.DPL to 0 if done at CPL0, but I'm vague on this, since it only really matters to hypervisor code AFAIK.) 32-bit kernels need __KERNEL_DS, I think. --Andy