Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1617031rdb; Mon, 2 Oct 2023 15:45:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEX/TNau2bGx7ix4X5TIMRb8W+whK4MUzKjf9kSmGUYwYNYXbsVDX87MtF7GyLinfXSx/p6 X-Received: by 2002:a05:6a00:2da4:b0:68e:3eab:9e18 with SMTP id fb36-20020a056a002da400b0068e3eab9e18mr12040449pfb.12.1696286754772; Mon, 02 Oct 2023 15:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696286754; cv=none; d=google.com; s=arc-20160816; b=YLiT85V0qAj0i5z01QLr34FEFpoLXfG1lqC3cVU7FceVRx/ZQb/RflA1qAt7goHZ1j C1c7kIqoRYIYNmQpGItA6UFqvQ6QYME1c9C16xS4DFqj/d2Jq3AewArhuJ1q5IGjVQwR tx2hWOMBwE6s877gm/svccJBZgIO+5AJEmYRiSR6MtsqwNnJkD/j8Jm1krtpAeqCMyPG z6WRuyO3sA9K/tB1OJWXH8VZbnf2Ql2pS3tRrbO2sl400LsOGLtVdHSSJTp06N+JcSev St5aXYQ0q06dwOyQFCQ+bVfVnMO9pRRnxbivjht9KPO/aPoh2HdPKF73oUYheu8Mdt1D 63wg== 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=NZ+MMPEENxchCEjndltKiWVUtzyNgUeuhfS8ArgvWoY=; fh=qOC5DB8CDGIuqWK8BSgm0XHHtXea1v7ZLhX9JEAcCnY=; b=O6HXHdbC8zfj7pEtvIMc46nUXgdPTs6aBE72wOmpuidG2PFPFx/kvoJZCNimsnbHA0 LtoorPUlAnnddhVaq9rUYFNI6Fc9qxurbumHeMaabfnrXgv0n8USimbeW9ZjWYek3cTt VItu6IYnSstpRtbDEeJ5Vxx9r3kOzxflJd9iNcmr5T25jfnYWAfT1IU5Ph4kB+U/cstZ sDdyB+OXBzgCK0ECdvKy7Ih2DOpGmdPS05/3Ea4cuV7omuQzYhNB6Djfy0rZ9UiP1bgK pL+m8o5D/bRY6rsTDAGf69gagk5+qIbo31+CsoUMVepHwpgMxakIKGi9JSAFLkv86l+/ kALw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XwWrlBFQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id v7-20020a056a00148700b0068fba252466si2120pfu.169.2023.10.02.15.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:45:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XwWrlBFQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 31DFF8098807; Mon, 2 Oct 2023 07:23:26 -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 S237734AbjJBOXR (ORCPT + 99 others); Mon, 2 Oct 2023 10:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbjJBOXQ (ORCPT ); Mon, 2 Oct 2023 10:23:16 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D21DBAD for ; Mon, 2 Oct 2023 07:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696256593; x=1727792593; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=lUSBW27X5TbkpCfBFIk3FcOkcviHgP3tIGt/RUD5CEA=; b=XwWrlBFQBbnvs2Bb1hidlKFiLUV/nV4fJDDurxHCpUO9+Li3a2adXb4j +Ag3a0GLgcCwWD5FYZl1qA3jgxfzHi15I8FEmttxbDfyryoOD/bL7CFma WN+ELCnPw061NPH2ALDPbda/D3DgtjjF/JCHNR3c50RUOEGYvuvRA5nZj z5D/LZT1vBlyBgER/K+9XRysvpVmuHy1wDcUuDQVfhw6yZtFf1gXaDt9I ZcPootOak77s7723JQSA4QQ3Xb1E3YNd5YmJuEXIPcZn8g61+p/iUdET+ HZZd7jklcPt6vsoMnRf/yamzciWiVkK+T2I8EtelAkfPTUTk70VX7itk4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="446805144" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="446805144" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 07:23:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="1533594" Received: from dbhattac-mobl.amr.corp.intel.com (HELO [10.212.142.100]) ([10.212.142.100]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 07:22:30 -0700 Message-ID: <1d5223b8-0275-619d-db1c-e2aaaddb173e@intel.com> Date: Mon, 2 Oct 2023 07:23:10 -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 , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Cc: linux-kernel@vger.kernel.org, "H. Peter Anvin" References: <4b78a714-5ac3-4783-8256-1dda4673db01@p183> From: Dave Hansen In-Reply-To: <4b78a714-5ac3-4783-8256-1dda4673db01@p183> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 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]); Mon, 02 Oct 2023 07:23:26 -0700 (PDT) On 10/1/23 09:31, Alexey Dobriyan wrote: > Here is how it works: > > * fault and fill the stack from rsp with int3 down until rlimit allows, > * fill upwards with int3 too, overwrite libc stuff, argv, envp, > * try to exec int3 on each page and catch it with either SIGSEGV or > SIGTRAP handler. > > Note: trying to execute _every_ int3 takes 30-40 seconds even on fast > machine, so only 1 int3 per page is tried. > > Tested on F37 kernel and on custom kernel which did > > vm_flags |= VM_EXEC; > > to stack VMA. I guess the subject implies it, but it's probably worth a sentence or two in the changelog about this being 64-bit only. IIRC, there _are_ x86_64 CPUs that don't support NX. It's also entirely possible for a hypervisor to disable NX enumeration for a guest. Those two are (probably) rare enough that they can be ignored for now. But it might mean adding a CPUID check at some point. 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 ?