Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp12217pxv; Wed, 21 Jul 2021 14:05:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+7TXXRWq6F9Urf4JejrbHmMTf0J23G9WT27AVoxmJmJ5l+gQFGOyz7YkE+wHEBeOqmIUJ X-Received: by 2002:a02:7f47:: with SMTP id r68mr32607865jac.127.1626901520702; Wed, 21 Jul 2021 14:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626901520; cv=none; d=google.com; s=arc-20160816; b=QonCfNKX/n6j7XkgySqJyI19zPKdDe0f3TvEvqiBtToZrR3UEi9ql0lVVyE0sSQU1V 46TcI7zm5HsrjgF/7u6cMfBD1Hmb6IVP/eb375gDaZKUEEcVZWLAiE6b7rucFjeY6L/H GWRjaM5q0UdWgqOzf3wdcXS+AWapzbJvCZFIAyYU12gEZGXjKxTrM1TIVWVtMseBykZC 7ID991q+j3hGBD6Zn7kU6bbgqDRsVTes6xuTyHcyHvXW8ECFTYfSALNg4MCAxrV3Teh1 iVgmKDlC2ojeoS+Q/x6Qvgf5Kz3CI7uDxnvc8apEGkcfpBBqaB6qwkmwRf8ZhMHMglGt 9aOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=TkdTO/UxdGxI+/KgnvL1pZPS4iHaPv/sef/gzkTwrYg=; b=KstrQhlTgX5Dt9RN3JraYh/rmKmcPqx8Ls3X96c7EZoWirpm+fO0XS55DFK0pGN87P L2RBKw3YfAie4VQVXgJ7416u4kp5yc5rzrr7c16toHpNpHYpPEV665mifG2QLgJ34RsG BfD0ukEAFHR+7fBD804fD8PoiCzAK0e/KHLKFOQmgdn/vCGKt4ZPvEjN/4YhD8mmlRrT wu9/wO81z1Kgz2qAxtvUobux/4fDmPwH/eoP8I1pw/zlIsPslW0YCGvAmyT1cWRc41QM K6on6g5k28HhQ/be0RpiDAwu8PQDFnh1xAiTy8HnyOd6se2+D6CJwqbu+HlqNrft9Ws+ FGnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HT+8xbUv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r6si32779381iov.48.2021.07.21.14.05.08; Wed, 21 Jul 2021 14:05:20 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HT+8xbUv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239153AbhGURsP (ORCPT + 99 others); Wed, 21 Jul 2021 13:48:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40596 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239078AbhGURsN (ORCPT ); Wed, 21 Jul 2021 13:48:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626892128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TkdTO/UxdGxI+/KgnvL1pZPS4iHaPv/sef/gzkTwrYg=; b=HT+8xbUv57kJvwKY0CsNo1OHm/siAwiwaBZrOaOobV/mp4SMgtbv7B8ZOE2FNBX0UknQxb ZIqpT3sDOyJee94JHW0t+DDplnJd+R4qZPmS1rWDpKfpkwx6Lo6zSKtfook9Gq0J9NgAlK 7h8ZjdHC/xS861dbmdcaCBcW8fCVNoE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-167-OZJ_IJG8M8idZr9-uoubBQ-1; Wed, 21 Jul 2021 14:28:46 -0400 X-MC-Unique: OZJ_IJG8M8idZr9-uoubBQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0404BC7401; Wed, 21 Jul 2021 18:28:42 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-113-201.ams2.redhat.com [10.36.113.201]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3AE4610AF; Wed, 21 Jul 2021 18:28:25 +0000 (UTC) From: Florian Weimer To: John Allen Cc: Yu-cheng Yu , 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 , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang Subject: Re: [PATCH v27 24/31] x86/cet/shstk: Handle thread shadow stack References: <20210521221211.29077-1-yu-cheng.yu@intel.com> <20210521221211.29077-25-yu-cheng.yu@intel.com> Date: Wed, 21 Jul 2021 20:28:23 +0200 In-Reply-To: (John Allen's message of "Wed, 21 Jul 2021 13:14:56 -0500") Message-ID: <87h7gnldx4.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * John Allen: > At the very least, it would seem that on some systems, it isn't valid to > rely on the stack_size passed from clone3, though I'm unsure what the > correct behavior should be here. If the passed stack_size =3D=3D 0 and sp= =3D=3D > 0, is this a case where we want to alloc a shadow stack for this thread > with some capped size? Alternatively, is this a case that isn't valid to > alloc a shadow stack and we should simply return 0 instead of -EINVAL? > > I'm running Fedora 34 which satisfies the required versions of gcc, > binutils, and glibc. Fedora 34 doesn't use clone3 yet. You can upgrade to a rawhide build, e.g. glibc-2.33.9000-46.fc35: It's currently not in main rawhide because the Firefox sandbox breaks clone3. The =E2=80=9Cfix=E2=80=9D is that clone3 will fail with ENOSYS und= er the sandbox. I expect that container runtimes turn clone3 into clone in the same way (via ENOSYS), at least for the medium term. So it would make sense to allocate some sort of shadow stack for clone as well, if that's possible to implement in some way. Thanks, Florian