Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp836269ybg; Tue, 28 Jul 2020 21:57:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDIUCxi8IJMuPoQEXqolXrhYfTOzNC4jTvkCyt4Qnj7lFlh70PHLsoclZh1HNMZbfZOR54 X-Received: by 2002:aa7:d9d7:: with SMTP id v23mr9541050eds.112.1595998657052; Tue, 28 Jul 2020 21:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595998657; cv=none; d=google.com; s=arc-20160816; b=h8EEO5Smb8qD1eXLbgl9YICKr/fFyr/Mdbx4UNfB8Oq+U3Vg4WoLIx7yzJq4offcRE jAjKUbOuG06088ZaPibg7wgdKH29XaTk/0AVus42RpfXuUhAxK89cp7fVrMF0moiByvQ 39bm/Kr8LOvHmhUylWv7aFodohY1iPseRLG+/AarBLtEj1MmWFJGazOSXewvT86kVERR PHUG0sU0GVXxdCmdDkBcLs7GPADCAtlyY84+Yz4vP5Fa3WIbmMy5DREZiwDNHHtdnqnT VvVVQRuJMLzMsI5rYDWhYQx/zkU+7qCCCtt42hs/dLxfhTheazBtYMyuY9OUM7PSVam+ bMoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=yG7XELX7evS19PJtvNHgUxXvv/vFpBPD2UvoqKWuM/o=; b=NpY5Cot3G2edk9r2raP5SUsWEh9LR7c89a8Jmjo5Z922pqgBsoDAhLYK/iNdO/Yd3s 3lBylaHDKet3BameiqbJ46303TJy5Qwq7+5Qgpc59zD1ZV8Ctcf/9J3Uz775dQAPuarQ KzpAOt9BcTssZyTP0n/pMO+VLhGnxoiSMsV2KecPfsA07BMYN+hJyo36VAj11nZWzIUH bLGM91iPs5zj0JCso+ugqJKax4j6/qN0eAOvzIF3K4K85WaLWglw6PdprlS6RnhM24Wb ElJm6nUgJbdMlGIaU7iwTO+JSAwO+JSlhWV3GHTwp51BMM2TmB1RZ5ejGOfHdgg4oRge nPpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Cfv14R5C; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b24si543887edw.188.2020.07.28.21.57.15; Tue, 28 Jul 2020 21:57:37 -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=@kernel.org header.s=default header.b=Cfv14R5C; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726314AbgG2Ey1 (ORCPT + 99 others); Wed, 29 Jul 2020 00:54:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:43378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725986AbgG2Ey0 (ORCPT ); Wed, 29 Jul 2020 00:54:26 -0400 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45EDB2076E for ; Wed, 29 Jul 2020 04:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595998466; bh=qKrraR9NNIslZgxj1wQ1vHsohPP6apLoeUeP34L0yeQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Cfv14R5CD6tKHCHGjEyPsAyF8wtQbXgcnmvDXcadFj4JPwx6LISfOyCWtF7hm5Xeg SeevyVBc9yAut7QwO2S1LfhUEHc10ueO9C6NJ1Ls0wMnCXlF882Wosz1Ujp9MQxwzp lZFb9VCHZkmJhu1FfPYuC4w3uiVeQ4UNca+bVpMQ= Received: by mail-wr1-f50.google.com with SMTP id r4so17309873wrx.9 for ; Tue, 28 Jul 2020 21:54:26 -0700 (PDT) X-Gm-Message-State: AOAM531pV+vjzeJXA1RodSx8i1AEac87MBRZBDZ2W3lQfpQpLoeq2Tbp fWXiAI+5YZSnzkpYZQkBJxyR3TtusKDniEUivBMxCQ== X-Received: by 2002:a5d:5712:: with SMTP id a18mr23117753wrv.184.1595998464923; Tue, 28 Jul 2020 21:54:24 -0700 (PDT) MIME-Version: 1.0 References: <20200728202229.1195682-1-krisman@collabora.com> <20200728202229.1195682-4-krisman@collabora.com> In-Reply-To: <20200728202229.1195682-4-krisman@collabora.com> From: Andy Lutomirski Date: Tue, 28 Jul 2020 21:54:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/6] arch: x86: Wrap TIF_X32 checks To: Gabriel Krisman Bertazi Cc: Andrew Lutomirski , Thomas Gleixner , Kees Cook , X86 ML , LKML , kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 28, 2020 at 1:22 PM Gabriel Krisman Bertazi wrote: > > In preparation to remove TIF_X32, add a wrapper that checks the process > is using the X32 ABI without using the flag directly. I'm not sure what the right solution here is, but all three of these functions are in the ELF loading path, and the callers of all three have access to the full ELF info. Let's instead either stick enough information into bprm to figure out what ABI is being loaded or pass in a pointer to the ELF headers. The latter might be a bit nasty due to the way that the ELF headers have a different type for compat. In any case, sticking this into per-task state (task_struct or anything in it) is silly. The full ABI info is on the call stack, and there's no need to keep this particular bit around forever. --Andy