Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2350726pxk; Mon, 14 Sep 2020 10:57:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNpFnWr4XEPRN7nPbb2poMpyuc7MxDs02pL806/XeYRabbLKh/BUPSYcCh4MEsDq0UZb0v X-Received: by 2002:a50:f081:: with SMTP id v1mr19097300edl.161.1600106267720; Mon, 14 Sep 2020 10:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600106267; cv=none; d=google.com; s=arc-20160816; b=rt2hyGD25HyB1Math3YW9Q8WeIZNZYrP1XWkE3J2lu/UrUjctEv0BztTc4h2TNKNHf Bjca3pL+rtEgnxDQ93W/RV+sBzGqxJW6YXUi0oApaSbZDSFuvm/GdSuvXE5EAs86O9le /rCjG6Od4ebObijGYtrY9k3m7MfCCGxXOl1fHbJZJhzOpkYk5tHj7mZntqCvJF/j503O T5y27ks3OOaXaSI0JMu4EfWBdmAaHHGUwQ2s5LNfadRUH1UNTBnFwD1V8jCYFXo5/mMd +vM5sqIxih+o+nIFRzSoWJS8wtlypVh/6JnT1qxTr36+7r+nL/SeSVxgpiOm/0AhUcyJ s7Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=1yv+srSKfxeaUyicwWKfbf3lmLFh6cK6P4lFNakTVGE=; b=n2E19agrYGvskEFLO7RRgpbiWcA7AMYXQgBNdNvaVIqsVhTX0ED960bIRUujhbV+4w moMs08BdnY75wy29zUqLUzz+dZz0Is6XoqzPMaWf15ydYCnbf2UX4cJsBKUcGrdQ+j67 eIRQQglEK1XlEDbcOQSktZyJDW6MB2ebAP8POBD9ocNTx28NS9qlIYgkCHr6uPlHvvZu N/iaA484wZzJvBss6UmAu+lell3I94R7cc09I0bCkXuATwUUH64jmfwt6DDK5gJsHmyk aYfqPtEAAtsdXl9dt5yoZQffDgNBZ2esQ01Anw4qg+C/+dH5ywSdbJv1kG9cQmVvqyWP fAAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ccZKfPi9; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j14si7938139edy.412.2020.09.14.10.57.01; Mon, 14 Sep 2020 10:57:47 -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=@alien8.de header.s=dkim header.b=ccZKfPi9; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726077AbgINR4Q (ORCPT + 99 others); Mon, 14 Sep 2020 13:56:16 -0400 Received: from mail.skyhub.de ([5.9.137.197]:56572 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726065AbgINR4L (ORCPT ); Mon, 14 Sep 2020 13:56:11 -0400 Received: from zn.tnic (p200300ec2f092600691f19cafd1ebd8c.dip0.t-ipconnect.de [IPv6:2003:ec:2f09:2600:691f:19ca:fd1e:bd8c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id D142E1EC0572; Mon, 14 Sep 2020 19:56:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1600106170; 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:in-reply-to:in-reply-to: references:references; bh=1yv+srSKfxeaUyicwWKfbf3lmLFh6cK6P4lFNakTVGE=; b=ccZKfPi9JSAAYs7tnXs6Tm2f/iwZRdz1sJqNqmZ4AClNVHIgf7Ui9FFOLMZpix9NE2cu9p nLbod5mekSAQwiwNao6so4Lr3Wvux1nQAyYTeTp8r8Pr8G6TJC6rotMACS5IYEIXHFP/Fg HypbWQbYxkkLS315C+oRqJpvlB+mnbM= Date: Mon, 14 Sep 2020 19:56:04 +0200 From: Borislav Petkov To: Josh Poimboeuf Cc: x86@kernel.org, Al Viro , linux-kernel@vger.kernel.org, Linus Torvalds , Will Deacon , Dan Williams , Andrea Arcangeli , Waiman Long , Peter Zijlstra , Thomas Gleixner , Andrew Cooper , Andy Lutomirski , Christoph Hellwig , David Laight , Mark Rutland Subject: Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation Message-ID: <20200914175604.GF680@zn.tnic> References: <1d06ed6485b66b9f674900368b63d7ef79f666ca.1599756789.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1d06ed6485b66b9f674900368b63d7ef79f666ca.1599756789.git.jpoimboe@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > +/* > + * Sanitize a user pointer such that it becomes NULL if it's not a valid user > + * pointer. This prevents speculative dereferences of user-controlled pointers > + * to kernel space when access_ok() speculatively returns true. This should be > + * done *after* access_ok(), to avoid affecting error handling behavior. Err, stupid question: can this macro then be folded into access_ok() so that you don't have to touch so many places and the check can happen automatically? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette