Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp352865rdb; Sat, 16 Dec 2023 10:45:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPERdSobZx6XukUyIPCGDPc5Fvst+DMFRVhusFKQ9IzkyxusuvcX0XaUxGJw86zISp+Kpw X-Received: by 2002:a50:d793:0:b0:551:d9f9:efd3 with SMTP id w19-20020a50d793000000b00551d9f9efd3mr3864101edi.68.1702752355685; Sat, 16 Dec 2023 10:45:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702752355; cv=none; d=google.com; s=arc-20160816; b=0tjgjX/HJz2VhYveN+vSP2D/1m0fUgesnMDMhsRnxYi9mA0p7W9BnnxBZ7rMADQHSX grZAnsKf5uD49/q+uEjLQ/FSdq9P7D/9L4/K2bSxyJoJF8sKnDEruj/u3eQTzyK16k5p TYJeNusSZJHxj6tJnbSicdBoHmNdEidMaMQg3wsJPW7S/S786gpsmsoxRUFmg68D3JWr iH3dn27t6zFj8+oAFoOUVOfYYNq02ck4feEeociWyg+JixN9JAq0FI90xmvCnsapDWbs H21BNPBsM7DTnphEN2GoNnqX6dP1efk0+jDMEQDBsC1/e6CojdTKdjmpXY5HobvMHL5n gGcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=+SToXMiV9mri8KrKoibWPhYhfPKu1nabLRpzMkuhlN4=; fh=4Kjjs4KzE4mFHRCxIf2L0AcejBCeAo/r6C+yqBxrEYk=; b=m6DqYUrQinfBKJDdxHpp7wxQ+o81w+a0Qa6xc217zucN/kyg24HkBrBMD51CQo4uP0 RP3P9YjH5UHH8XnKL4ssd38TwjGtmQW6r/Zcofq/Si/dId8fL+LHItoaj7tooFwZ1aG0 Hiq1pWrsDvi63UOiVCxXOuTZuJB3ebGdj0wTLO9wp/H6wghIa5Ro9KjHkaQw4DPBjQw9 sUoIdJE6GE7ujB196kA8R/c4sNfK5HsWLoDPss+NHyqMIOJqtetdinkazvu2Xbd55prl CEl+1/Dg/ntiEdlyG2fuJYKBvyKvD090dIPTYPWHHejDvcOgP+v1BvnBZW9Av78Q2PY3 s1kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=WEkX07mc; spf=pass (google.com: domain of linux-kernel+bounces-2326-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b8-20020a056402350800b0054cae753509si8498576edd.412.2023.12.16.10.45.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 10:45:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2326-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=WEkX07mc; spf=pass (google.com: domain of linux-kernel+bounces-2326-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E21501F2403A for ; Sat, 16 Dec 2023 18:40:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 229A02D79D; Sat, 16 Dec 2023 18:40:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WEkX07mc" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5990013FEE for ; Sat, 16 Dec 2023 18:40:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a1fae88e66eso187259966b.3 for ; Sat, 16 Dec 2023 10:40:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1702752026; x=1703356826; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+SToXMiV9mri8KrKoibWPhYhfPKu1nabLRpzMkuhlN4=; b=WEkX07mc1NPEwoZYih4zScLS2sispBD4dAiz3JQcNLE5+sqv3naP/t3hxU5K/Ru609 JtLeIqBcCwFmR2Uc3ggGTVOcvnVRdb72xDyNeTka0C4NGxdJI/YF/5tsC11EH0R7XPyU t88/YuvbP3O5Su0L2YBsmRxkpNglYVQfzDvKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702752026; x=1703356826; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+SToXMiV9mri8KrKoibWPhYhfPKu1nabLRpzMkuhlN4=; b=la8V2pBwQbxuOB4YoP+qMClohLYNvQsz4NdVNei2EwIRxK+DRtjNOaPG8BcmoKVeu+ U9Z+FQn5RHyLabrkF7FjlzkX6sd1LX0MeT38BYlpeee0q/TGYqJrTOrdNYIpMRhSdgJf YWG2Mw2AHjRGlZPCSzlj19UobB/sJWDrwkaKoV7aqUBHvU7eWG/Z+HZuhgubgZbAdPJ4 0qtHDGpFaXJmK2+VyE4LR7Mim6c6yRGsHOCsobSfw171eV16y6yH27/xNg4/kQT5LLUk zqlp1p4VJhRL/noCGj1SiSVcO3Atli/LUMQUIf4fUQGbx+i1zxNVwv+/VApqgecl28Mw 7UJg== X-Gm-Message-State: AOJu0YwEiOoyvSksEBy8GgW7SYpsNDSOd0xJmT08EKlLVxTLAVtbGLSB LDei/FiGA/+nu+aJ3fPiaHztgFTBeNHY8xhs7wmSqkXs X-Received: by 2002:a17:906:51d7:b0:a23:3efb:d40a with SMTP id v23-20020a17090651d700b00a233efbd40amr58687ejk.12.1702752026396; Sat, 16 Dec 2023 10:40:26 -0800 (PST) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com. [209.85.218.49]) by smtp.gmail.com with ESMTPSA id vt6-20020a170907a60600b00a1ce98016b6sm12260329ejc.97.2023.12.16.10.40.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Dec 2023 10:40:25 -0800 (PST) Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a23350cd51cso23093166b.2 for ; Sat, 16 Dec 2023 10:40:25 -0800 (PST) X-Received: by 2002:a17:906:298f:b0:a00:aa23:34d0 with SMTP id x15-20020a170906298f00b00a00aa2334d0mr5960531eje.68.1702752025530; Sat, 16 Dec 2023 10:40:25 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231213163443.70490-1-brgerst@gmail.com> <20231213163443.70490-2-brgerst@gmail.com> In-Reply-To: From: Linus Torvalds Date: Sat, 16 Dec 2023 10:40:08 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] x86: Move TSS and LDT to end of the GDT To: Vegard Nossum Cc: Brian Gerst , linux-kernel@vger.kernel.org, x86@kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , "H . Peter Anvin" , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" On Sat, 16 Dec 2023 at 10:25, Vegard Nossum wrote: > > While preparing the patch I also came across some things that are > unclear to me: > > - why do we want some segments with the A (accessed) bit set and some > with it cleared -- is there an actual reason for the difference, or > could we just set it for all of them? I think it's random, and an effect of just having hardcoded numbers and not having any structure to it. But I do think you're right that we should just start with all kernel-created segment descriptors marked as accessed. I do not believe that we have any actual *use* for the descriptor access bit. > - why does setup_percpu_segment() want the DB (size) flag clear? This > seems to indicate that it's a 16-bit segment -- is this correct? I think it's nonsensical and doesn't matter, and is another mistake from us just having random numbers. I don't think the DB bit matters except for when it's used for the code or stack segment (or, apparently, if it's a grow-down segment). So I think your patch looks good, and I would keep it in that form if it makes it easier to just verify that it generates an identical kernel image. And then as a separate patch, I would remove that DB bit clear thing. Anyway, I do like your patch, and I think the fact that you found those oddities is a good argument *for* the patch, but at the same time I think I'll just bow to the x86 maintainers who may think that this is churn in an area that they'd rather not touch any more. So consider that an "ack" from me, but with that caveat of yes, I think a binary diff would be a good thing because this is *so* odd and low-level and maybe people just think it's not worth it. Thanks, Linus