Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp650621pxa; Thu, 27 Aug 2020 11:57:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS2NmHw5yjMNH95634ndcgNk/gF2X1RUNOkBSnePQp7bpGo0TqK9/BF5MwnWd6yVrn/1qu X-Received: by 2002:a05:6402:a51:: with SMTP id bt17mr20938238edb.382.1598554677785; Thu, 27 Aug 2020 11:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598554677; cv=none; d=google.com; s=arc-20160816; b=zjOpRcxtPV1+kgTTKpXbMaWakkSq6Dqk5PwO4OMrZxaqFEexrZjqeWmIZ+lJkS994C LmKEj2W/hyGH8pyXW6s3ucO7K1doSY95PbWMWe44b8wuYO2b1LJMTzAJkHdrlj8j+XGQ o8OtA7awsMN35LgntoKpL+j2HdYJ+1I9uHHW+9p2ojX+FK88Q1wPR1BBLnHvzY05Lst8 MfelZzzDI0RS6Cm/QD2SsrB7oz9CGQcWAVKM9ST1g2/p+Pi1U2FId2hCO16sByEhN4fU Tg0yFZdYQYjaJQ5YvTqk/EDfY+kLP9M5O+RKue6XJSgNjrIIAuBfelWSJ/3Sst6ZC836 LiBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=qvX+0t4taP46QXZOUzH9jS+RyGYBYFHPCCevAMrrHDg=; b=ScFxxPltR+eJOp+xef9Y02lHezM2aFPPk0SZzHPvnLumw6YbPXxQJl1/cWnz/NVvJe LzX6vq3A1dezs237608ZN89okD7cUnC2VuvkWdqimanLayd+WAIo9tsRcwvahDmtpJPv vUWc6KxXfe7WT5HPLqK6PeEAH3/vnp8xUygAWtM2k05pGTMjNrsodDDNIHIJ1wTuVI5C gbz79iMnH3rT43Rug50lo6bs/fzY5sWJTSQ/7h1DOjUoptTLnl/FAXZIwMFWTnMTqYy5 XyV2CdY3MzCBueWutXbP6ikR1JOGp1a2/B6umLF1+KfDqqXxYY4KUDJoS6lPC4aWGqrj pbDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=1qJZF1j7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si1890072ejj.109.2020.08.27.11.57.34; Thu, 27 Aug 2020 11:57:57 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=1qJZF1j7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726246AbgH0S4v (ORCPT + 99 others); Thu, 27 Aug 2020 14:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0S4u (ORCPT ); Thu, 27 Aug 2020 14:56:50 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6836FC061232 for ; Thu, 27 Aug 2020 11:56:50 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id 2so3111943pjx.5 for ; Thu, 27 Aug 2020 11:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=qvX+0t4taP46QXZOUzH9jS+RyGYBYFHPCCevAMrrHDg=; b=1qJZF1j7aP9/gm8JJKCOiOmY8yDhder5SBu4XDeJXypfw+jqz30KJKC2TixCvPVViK xlyPbT0mk9IkEZAohEpohg9pTxIu+yU+8I99UYuFfB2+W6d1yn9K/s/ZEdAeYNwEFrh7 uIEw6O9Sv5M7d82YW0k2n7hJ42sUVJ+0AyoHw/pBvsJg0JfJkhZLOV0kygxS5bRK7lwp hnZ4sJgY33aokxqI9jOqk7Ssge/vXqhthQtrILVuuzdVHv1aHxPjsnxK2HiRQfrXnTEO n/GkIFN8FvZ2rmUMRWcnfMJIwbR8JUj0xzI1/BNVZ2o8q0vatriR3W41ZXJSnyJeurqg 8wYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=qvX+0t4taP46QXZOUzH9jS+RyGYBYFHPCCevAMrrHDg=; b=NNIBsReIaZaeBvEMzgvgnv+s4XQcjMMgDJlM8q7wZD9uhxpbaUBm57MEIoFZcAzzvU iEEb0T/bDbufgB04n43u28igoZZeeO+lkySF/kpoLgMhvtfuKeslXt/fEP3aw/sAHWqb esv+au8YIpHAjIti2lToJ76FsT8KnvpVCCfXyyZIWAqejQiU4Fnf0gonD4W5nDITiPRO kqDIn2pGr4ZjlVC3zIfYev1f4tdQ1W5bS3p75OXK8GG3eUhHJHg2Xl9tuYdiAzbA5+0S 5p/VjKToV3+SJx2HGewLA5BDWioN4CN2lPEYKI5KevBToDOpMarsqpmJLVBfVEC7mFlC HM6g== X-Gm-Message-State: AOAM531YC5CnooWTkVkkD0FdwsQBTmgDQvqT7X1K67jn5bqXTo3nl9ij tkwY6v09qV/GbOaTzg01AuKi9w== X-Received: by 2002:a17:90a:ec03:: with SMTP id l3mr200548pjy.193.1598554609609; Thu, 27 Aug 2020 11:56:49 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:f108:b6a3:155e:4f99? ([2601:646:c200:1ef2:f108:b6a3:155e:4f99]) by smtp.gmail.com with ESMTPSA id y203sm3847139pfb.58.2020.08.27.11.56.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Aug 2020 11:56:48 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack Date: Thu, 27 Aug 2020 11:56:44 -0700 Message-Id: <4BDFD364-798C-4537-A88E-F94F101F524B@amacapital.net> References: Cc: Florian Weimer , "H.J. Lu" , Dave Martin , Dave Hansen , Andy Lutomirski , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , "open list:DOCUMENTATION" , Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Weijiang Yang In-Reply-To: To: "Yu, Yu-cheng" X-Mailer: iPhone Mail (17G80) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Aug 27, 2020, at 11:13 AM, Yu, Yu-cheng wrote: >=20 > =EF=BB=BFOn 8/27/2020 6:36 AM, Florian Weimer wrote: >> * H. J. Lu: >>>> On Thu, Aug 27, 2020 at 6:19 AM Florian Weimer wro= te: >>>>>=20 >>>>> * Dave Martin: >>>>>=20 >>>>>> You're right that this has implications: for i386, libc probably pull= s >>>>>> more arguments off the stack than are really there in some situations= . >>>>>> This isn't a new problem though. There are already generic prctls wi= th >>>>>> fewer than 4 args that are used on x86. >>>>>=20 >>>>> As originally posted, glibc prctl would have to know that it has to pu= ll >>>>> an u64 argument off the argument list for ARCH_X86_CET_DISABLE. But >>>>> then the u64 argument is a problem for arch_prctl as well. >>>>>=20 >>>=20 >>> Argument of ARCH_X86_CET_DISABLE is int and passed in register. >> The commit message and the C source say otherwise, I think (not sure >> about the C source, not a kernel hacker). >=20 > H.J. Lu suggested that we fix x86 arch_prctl() to take four arguments, and= then keep MMAP_SHSTK as an arch_prctl(). Because now the map flags and siz= e are all in registers, this also solves problems being pointed out earlier.= Without a wrapper, the shadow stack mmap call (from user space) will be: >=20 > syscall(_NR_arch_prctl, ARCH_X86_CET_MMAP_SHSTK, size, MAP_32BIT). I admit I don=E2=80=99t see a show stopping technical reason we can=E2=80=99= t add arguments to an existing syscall, but I=E2=80=99m pretty sure it=E2=80= =99s unprecedented, and it doesn=E2=80=99t seem like a good idea.