Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1996034rdb; Tue, 3 Oct 2023 07:24:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCnmL0bZkHqgQMy12/LjKOYv8/ljAnDGXlx2IQIHiJZC0p69mDBsZ68O3XOXyl+bDyH0wB X-Received: by 2002:a05:6a20:2446:b0:155:1710:664a with SMTP id t6-20020a056a20244600b001551710664amr4172465pzc.18.1696343078870; Tue, 03 Oct 2023 07:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696343078; cv=none; d=google.com; s=arc-20160816; b=EQof8Ng1MzlZeFyRIMSo/QxV8uhgXuDl3nl7xbEf09w1NgHLvtCxXNiouIDlnpKwDs orMslzSwZjLxkjliONB7b/FOjnlMMJPyGf/3AG5I68crt6yXQsgNL/0jonO9x/QtyjIf wRNPdZ5UHsJ17mj3YUfUrli1AbvfK/cgJRF7bBYTMTffILUZGbGYhtU9rS7nQb9/Emnd p6p2mjeWbLYa5BCWbScZxc7CHq4zXkdwLq0n8/kU9e56LFkc1o+Aj7ThD/n/4Qn4qaQH mNxorW8ImtMDV8hjnfrynCbS0KnVtPVN0GZl8iTh8eTb4rP5cSvEW1N2RT1tz26X0nfU heMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Ph1JfW+Nbx9jstfhFEpo7gGQPSM9oEm3mWDDGE05JpQ=; fh=a0ivv6YDerSQJuGkPNCEYvLad1iWINgPjQ2ys9UvjbQ=; b=PgKVaImUdStq3ENFKGillXJJnRQbGcLJPp2Uj8eod7qjLvAZY9P89JqNXOgiuco+Xf C46bfjFkIhQYQVX3zMsN8BLAMJzJ/91ZX4auffrEY2Rs11D4CyDRJoyUWDGwSpXm1sEK 6zIyeggPUw/Vyzq7aJiszYVrB2II8HsSmomye6trXMkY+ADkhhdfXh073fA79hJkTLB1 9jMnOeeshj1lq/z7S5xLi86n0IYxWX5N+eE7kCfBGW3U5fTMUjqG1rxRfmp4MG75r3vg Hjm6/K+ra7/hHsWwp7h4h+aut/0brd/P6MO4mxswSal1jEjnUiHjCTPVlRreo8tCtHJP 4iiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="dKo/UiqQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k17-20020a056a00169100b00690c94b4cd1si1590248pfc.291.2023.10.03.07.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 07:24:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="dKo/UiqQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0D5FD80EE74F; Tue, 3 Oct 2023 07:24:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239944AbjJCOYF (ORCPT + 99 others); Tue, 3 Oct 2023 10:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240001AbjJCOYD (ORCPT ); Tue, 3 Oct 2023 10:24:03 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4EEC9 for ; Tue, 3 Oct 2023 07:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696343038; x=1727879038; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=A61WT88VnkzMQHVjtx4hwP9zSYAWPhVnWpEue6pcglA=; b=dKo/UiqQlR+Ha/6wY6wUbHdcV4K5R8GL1rOP9nAeTBMHP/vWlG2GP/de O0Ix4bxjKVlHwO1SYgGDHNf8V/C3nSVfgbidwqDG/fzrlpfMOs/wyf9tX dPdjQiEb3I9q7090twWHXiRr+aBqiHH1p216fsOC32H1UzmXejlR0c9Mw 8N+Qbq2y4UsF074Zn1zWYDA441SpJrOG9U7gHw67hx2XOg4XgVTfBGFsD FtF8X8hDG82Q/rMa1zrf526/y+Rew0Z5flR4qbLlsg39eDiVythTI7+it 7y7QyPyx0rYWklelObqsNn3Ag4Q2EVd1SZkZV3+q9C5qT+xsu5h96eAeq A==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="469163465" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="469163465" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 07:23:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="866893090" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="866893090" Received: from ddiaz-mobl4.amr.corp.intel.com (HELO [10.209.57.36]) ([10.209.57.36]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 07:23:56 -0700 Message-ID: Date: Tue, 3 Oct 2023 07:23:56 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] x86_64: test that userspace stack is in fact NX Content-Language: en-US To: Alexey Dobriyan Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , linux-kernel@vger.kernel.org, "H. Peter Anvin" References: <4b78a714-5ac3-4783-8256-1dda4673db01@p183> <1d5223b8-0275-619d-db1c-e2aaaddb173e@intel.com> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 07:24:36 -0700 (PDT) On 10/3/23 06:00, Alexey Dobriyan wrote: > On Mon, Oct 02, 2023 at 07:23:10AM -0700, Dave Hansen wrote: >> Basically, could you spend a moment in the changelog to talk about: >> >> 1. 32-bit kernels on NX hardware >> and >> 2. 64-bit kernels on non-NX hardware > > Sure. My logic whas that i386 is dead arch, but this test is easy to > port to i386, only 2 simple functions. I honestly don't feel strongly about it one way or the other. But whatever we do, let's explain it, please. > I don't want to parse /proc/cpuinfo. If someone knows they're shipping > NX-incapable hardware, just let them disable the test. Other than clearcpuid=nx, I don't _think_ we have any way to clear the X86_FEATURE_NX bit right now. That should mean that you can use regular old CPUID to see if the booted kernel supports NX. Perhaps something like what: tools/testing/selftests/x86/amx.c does with CPUID_LEAF1_ECX_XSAVE_MASK. That should be quite a bit easier than parsing /proc/cpuinfo. If someone does use clearcpuid, then I think it's perfectly reasonable to fail the selftest.