Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp449807ybr; Fri, 22 May 2020 10:22:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx24oY34j+Qum2geUowgmFnHpwiSvSp3sPrFh6n7uQUtB8WFuuJJWSu0lice3wIy+OfYECM X-Received: by 2002:a17:907:2486:: with SMTP id zg6mr2483389ejb.225.1590168154945; Fri, 22 May 2020 10:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590168154; cv=none; d=google.com; s=arc-20160816; b=uyCegcgJp9nZPmOOfly3cgFdrQINTNoqrW6diipyLw7gLQ8oVut4C7BBwOMzaC8uly ax/genaomvJUfA34RcqawL1o4vAIl+rY4JFDY5UTptiknBOdxFT+Ly7mTM2F5wfTVqo6 8NXhjZylzjK3InHzXHxpvF9cesA3oouj/Hn5y7i//IMRmWu/XOLtfSy2qai2/NHcxBtA IrtMZY/LZCvefFWqZ3tOpz9ggstJCzRZGOX4pboabNW94XlrHeA7mP8nh1I1k1aK+Ck9 +uJX7fmKJq62Byun4Qa0IRtzVC5L4Y7LvT19u4VW3CgEdRIdldG/ChfliyxkmzP1Ykx4 HNmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:ironport-sdr:ironport-sdr; bh=eEkX5mDKCzWpsWrYlqc9O2J8/gqvnG4I1Ep0TwBgasM=; b=lnIBd569QaQq7RxlsVIGUc3Fd8UkLwPJjXs5zH0HJG2RFuK6b+fBobJiqXT1wVcoO2 bw2nthwE1M/WDu9qHnxA7m1zQSzedMEaL0Et1GpDmCG0qBaTW4FDbK43n9mrctz9ZPXD h3b7xggqAr4nzvfN3SgqJyyS3c7y3VSBVgvjguHX2fTEkYJ9x4j4qPMu71TyIkHuLze+ PCh3ePDIUUZswCpoI/qnjvrb7nOHLIVM3gkeS8H+s1quuVfuqXwp6GMxS7Pd7BO3+HMF j43wZ3pCBPfcAmERzOqzaanhK3yE/eCCXKtasXNXBXC4Fv5CBTHxTb0zDT+7Zi7cbsao IWgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu28si5114899edb.189.2020.05.22.10.22.12; Fri, 22 May 2020 10:22:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730764AbgEVRSr (ORCPT + 99 others); Fri, 22 May 2020 13:18:47 -0400 Received: from mga07.intel.com ([134.134.136.100]:59514 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730471AbgEVRSq (ORCPT ); Fri, 22 May 2020 13:18:46 -0400 IronPort-SDR: jO9IP0+y+Oznd/UltpuCkIyMoEeQg/vjvRcVi12o9A2rUYuPFSsuK6edUuUNNhP2ZUG6jeRB9+ HBAwiqaGD6jA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2020 10:18:45 -0700 IronPort-SDR: NXUfNJ68BjtyRCcOBPmLk8Z0wQMkH7dKhewmdbuP2bGwLxETp4+qAGhtLYXEmKviVPQKYA5ptO aZJA38nl90ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,422,1583222400"; d="scan'208";a="467245771" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by fmsmga005.fm.intel.com with ESMTP; 22 May 2020 10:18:45 -0700 Message-ID: Subject: Re: [PATCH v10 26/26] x86/cet/shstk: Add arch_prctl functions for shadow stack From: Yu-cheng Yu To: Kees Cook Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang Date: Fri, 22 May 2020 10:17:43 -0700 In-Reply-To: <202005211528.A12B4AD@keescook> References: <20200429220732.31602-1-yu-cheng.yu@intel.com> <20200429220732.31602-27-yu-cheng.yu@intel.com> <202005211528.A12B4AD@keescook> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-05-21 at 15:42 -0700, Kees Cook wrote: > On Wed, Apr 29, 2020 at 03:07:32PM -0700, Yu-cheng Yu wrote: [...] > > + > > +int prctl_cet(int option, u64 arg2) > > +{ > > + struct cet_status *cet; > > + > > + if (!IS_ENABLED(CONFIG_X86_INTEL_CET)) > > + return -EINVAL; > > Using -EINVAL here means userspace can't tell the difference between an > old kernel and a kernel not built with CONFIG_X86_INTEL_CET. Perhaps > -ENOTSUPP? Looked into this. The kernel and GLIBC are not in sync. So maybe we still use EINVAL here? Yu-cheng In kernel: ---------- #define EOPNOTSUPP 95 #define ENOTSUPP 524 In GLIBC: --------- printf("ENOTSUP=%d\n", ENOTSUP); printf("EOPNOTSUPP=%d\n", EOPNOTSUPP); printf("%s=524\n", strerror(524)); ENOTSUP=95 EOPNOTSUPP=95 Unknown error 524=524