Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1743335ybi; Sat, 27 Jul 2019 17:37:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxV0Xguh57Ig99NanMtZXnqItG43Dc5nQKtchKUx5kNbdRS02zw3bToey7sDnTH2eiQ8/5y X-Received: by 2002:a17:90a:8591:: with SMTP id m17mr106748186pjn.100.1564274246366; Sat, 27 Jul 2019 17:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564274246; cv=none; d=google.com; s=arc-20160816; b=I5M/DIxj7wnaVVNH13O8JFShTiVq3UIZx1sgpU19rzPYxAUb8pW9cI46IaDEBtRldj jel1fi3hKuPufITlg/9SfiYvBTUVgCOwO4y7V3ULyAm8XVUunII6prxMSD2u6+6PmKBO rkff2TGS+5ancEDEN9v6lIc+noZjeaTBRRQWFvp+9jrT27AZA1iwbkvNqcwq85aarsWy ASaCN9UhD44phpgwEMj/bRwVCV6bHy4G8oN+YjSH+kuUbudTQ668zVTSgXTrsjnL4jmP gVDwrntX0X5WFAyy08mj/kqwBolZphOXUuXjw4B4NU4Oct5f7a9sq6290kSj7BBB5dqn lXHQ== 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=LO3v05yzPP+J+c9szJLlDmqjFF3t8pQDMyjndgzGQlo=; b=YXRGNRZblood7idc5uNUhRWWVg0/gB4lLRCo3y3/b9lVHqOJ4JRjTENkp4kjwxaDns LOFy87fpglhjty0S96nmiObCRrWHU5meoi0OGdbXdRnY4qLV+S8yA73TjxzpAvrUUXiy NNPUVE9/IHb1t5HEc1g799YqFuPlfNB2eSG4RA4I3d0Sys9dQ2AlAETgqG/Sb83Fwg+r K0yjn8//xHMcov1MEndfMw4IfBwguRwgCv7axamDqFbvb/Z/2mY1/KpFfGcXeqYB310e PQwh4k2fLaqEm+aPN5je7q4Tcg3Jc4Fg6hCT/AFhWrB5UlMPTfwt3yljAFlIQdbeJXPk 9dCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gRMLtbkK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id u190si23816052pgd.547.2019.07.27.17.37.11; Sat, 27 Jul 2019 17:37:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gRMLtbkK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729010AbfG1Ad6 (ORCPT + 99 others); Sat, 27 Jul 2019 20:33:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:53794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbfG1Ad6 (ORCPT ); Sat, 27 Jul 2019 20:33:58 -0400 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 2717B214C6 for ; Sun, 28 Jul 2019 00:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564274037; bh=J+sOCDsKNWNrzzwtP/DZIjFxr16L8xfSR+ePLcePezo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gRMLtbkKZ+oQeCaZ5YGW7WE9dBLE01ZHuANEphtxXiEfdwvW0ZJ6kUQu7NKN/2RWJ 16pqpOP6r0kG+8ONQaxzKnnPDb+yR6joTa4dynIa00oW8BuX5cWJ17fvOOB70Xrobj B3+muxBKNlxgJsGA9bPxf6gGJmfnoPBIrzwObC7U= Received: by mail-wm1-f47.google.com with SMTP id f17so50470657wme.2 for ; Sat, 27 Jul 2019 17:33:57 -0700 (PDT) X-Gm-Message-State: APjAAAXPqWSfD0vCDW4GFo5dRQBeWsjuI4IwyKiwEX0jU4b8krYdE9r7 6QRNWt/ITQuyCwJTonro2cqXB2zvLiS6dWKg8BiJZQ== X-Received: by 2002:a7b:c4d2:: with SMTP id g18mr92031774wmk.79.1564274035582; Sat, 27 Jul 2019 17:33:55 -0700 (PDT) MIME-Version: 1.0 References: <201907221012.41504DCD@keescook> <201907221135.2C2D262D8@keescook> <201907221620.F31B9A082@keescook> <201907231437.DB20BEBD3@keescook> <201907231636.AD3ED717D@keescook> <20190726180103.GE3188@linux.intel.com> In-Reply-To: From: Andy Lutomirski Date: Sat, 27 Jul 2019 17:33:44 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [5.2 REGRESSION] Generic vDSO breaks seccomp-enabled userspace on i386 To: Thomas Gleixner Cc: Andy Lutomirski , Sean Christopherson , Kees Cook , Vincenzo Frascino , X86 ML , LKML , Paul Bolle , Arnd Bergmann Content-Type: multipart/mixed; boundary="000000000000392e55058eb2eeeb" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000392e55058eb2eeeb Content-Type: text/plain; charset="UTF-8" On Sat, Jul 27, 2019 at 2:52 PM Thomas Gleixner wrote: > > On Sat, 27 Jul 2019, Thomas Gleixner wrote: > > On Sat, 27 Jul 2019, Andy Lutomirski wrote: > > > > > > I think it's getting quite late to start inventing new seccomp > > > features to fix this. I think the right solution for 5.3 is to change > > > the 32-bit vdso fallback to use the old clock_gettime, i.e. > > > clock_gettime32. This is obviously not an acceptable long-term > > > solution. > > > > Sigh. I'll have a look.... > > Completely untested patch below. > > For the record: I have to say that I hate it. Me too. How about something more like the attached. (The attachment obviously won't compile, since it's incomplete. I'm wondering if you think the idea is okay. The idea is to have the vdso calls fall back to the corresponding syscalls rather than internally converting.) --Andy --000000000000392e55058eb2eeeb Content-Type: text/x-patch; charset="US-ASCII"; name="vdso.patch" Content-Disposition: attachment; filename="vdso.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jym8cu970 ZGlmZiAtLWdpdCBhL2xpYi92ZHNvL2dldHRpbWVvZmRheS5jIGIvbGliL3Zkc28vZ2V0dGltZW9m ZGF5LmMKaW5kZXggMmQxYzFmMjQxZmQ5Li5iNzI4NDMzMDAxOGQgMTAwNjQ0Ci0tLSBhL2xpYi92 ZHNvL2dldHRpbWVvZmRheS5jCisrKyBiL2xpYi92ZHNvL2dldHRpbWVvZmRheS5jCkBAIC01MSw3 ICs1MSw3IEBAIHN0YXRpYyBpbnQgZG9faHJlcyhjb25zdCBzdHJ1Y3QgdmRzb19kYXRhICp2ZCwg Y2xvY2tpZF90IGNsaywKIAkJbnMgPSB2ZHNvX3RzLT5uc2VjOwogCQlsYXN0ID0gdmQtPmN5Y2xl X2xhc3Q7CiAJCWlmICh1bmxpa2VseSgoczY0KWN5Y2xlcyA8IDApKQotCQkJcmV0dXJuIGNsb2Nr X2dldHRpbWVfZmFsbGJhY2soY2xrLCB0cyk7CisJCQlyZXR1cm4gLTE7CiAKIAkJbnMgKz0gdmRz b19jYWxjX2RlbHRhKGN5Y2xlcywgbGFzdCwgdmQtPm1hc2ssIHZkLT5tdWx0KTsKIAkJbnMgPj49 IHZkLT5zaGlmdDsKQEAgLTg2LDYgKzg2LDcgQEAgX19jdmRzb19jbG9ja19nZXR0aW1lKGNsb2Nr aWRfdCBjbG9jaywgc3RydWN0IF9fa2VybmVsX3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