Received: by 10.223.185.116 with SMTP id b49csp493891wrg; Fri, 16 Feb 2018 02:26:02 -0800 (PST) X-Google-Smtp-Source: AH8x227eb6aCxkbJootnNfFfX3oiIxANk9MOlKIY/W7aC+31qlu1acFWc/HKy+vE7mhsGSv47ARN X-Received: by 2002:a17:902:52ed:: with SMTP id a100-v6mr5328293pli.75.1518776762554; Fri, 16 Feb 2018 02:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518776762; cv=none; d=google.com; s=arc-20160816; b=BCGfpBnG/Suph94yj9gmri5/MH+VleA7N34FZHhN3ZJVL20QPNPmSt2QDPd0FRiIni v+UOidrls0JbD55gEUDL/qEWfU35pU0u8fXFVL+tj+TV9ATjshCfIN2XwrfiAZUZQphe Ch2F9+9ahr+3/MX8hLiON1LkJ4xrc6MqevboQi4mKqaXhizUxSSbvhrmAy955YymNjNL gY6l5clqEb/6uuqZv/yOtt6v4bs9+9/JcuJ+qxTtyQB9cyJCeAAi6BwxiRn67TlCv8FP RgzsFmo2Y9pDjlHCIUIJqFHf8zP9zmVfipTqh9375X74yIjBzns/Ah6HNuqotSUZoPtf 73vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=4YXxPWfjuq+KyuzQJXqWPMl2McDtaA/udlsBN82meo0=; b=ywJsCJnbuSk6Cehgr7BJEIbQyTO1QwUZZzNLjgYUWk8ifeAE96NM+zAOwVAvRBtUKv XIOZd4chdkWxiP8i4pjB76Ceorx0lvvLrJSuC7LrhKCJA620HjdwlkLe2gCaq6Hb+GBz gzBvso9KRvS1YIXUuE80fC6zDYCTc1F3PIJZDNdSsv74f6ek/BPcE2A2TLDoH8WEtFbY BGklwRLauntquUvUOCrs2cVZJP4zK14maV+EiZT0BiE6iHlqLzM7sj5P+OD2V9yHh0mE j2yRml+7mPVKbM/xYKYmjrH0td51SedSggbYcW/GRcHqfIiFsBRUGnjafebJEQdNUIfk dG2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=TVjzbFkA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o190si4021954pga.553.2018.02.16.02.25.47; Fri, 16 Feb 2018 02:26:02 -0800 (PST) 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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=TVjzbFkA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1426852AbeBORBY (ORCPT + 99 others); Thu, 15 Feb 2018 12:01:24 -0500 Received: from merlin.infradead.org ([205.233.59.134]:49896 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423498AbeBORBU (ORCPT ); Thu, 15 Feb 2018 12:01:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4YXxPWfjuq+KyuzQJXqWPMl2McDtaA/udlsBN82meo0=; b=TVjzbFkASMR2XFkrpecbszUV4 gccuxN90KfK3eSAGSE5bmVpwQhpeEL+IxcWzfTAYyY/deVXcNGgzsQOnFBzxWp6dVmkz6YuCGXaZe L7DjkmRptNa45ELjYT23vTEbh9V5uY8GtgkGAtxe6c5DUIr+D6V1lRG1EW4mcWwBH8z6FQtIvYbcW Eh6/wHk9/o4mNHHQPU3aiZMicSJHH9tIigGiTeGax8b1A7v36EwaIuxFCCUhqAaIsuI59p1x8GN4R YNCLHtaj+kbEjRjJT1OqWCtN56OFy2qDzWbUNVGm9vOdjh3/D4onS1DmaycVykitYTOeUXNegDDgT dlHnitwhg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1emMu9-0005P9-U2; Thu, 15 Feb 2018 17:01:06 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B9F5B20587C43; Thu, 15 Feb 2018 18:01:04 +0100 (CET) Date: Thu, 15 Feb 2018 18:01:04 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: Dan Williams , Rasmus Villemoes , LKML , Ingo Molnar , Linus Torvalds , David Woodhouse , Greg KH Subject: Re: [PATCH V2] posix-timers: Protect posix clock array access against speculation Message-ID: <20180215170104.GC25181@hirez.programming.kicks-ass.net> References: <45f8dece-e235-0831-4fe5-89ee7d27b959@prevas.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 15, 2018 at 05:21:55PM +0100, Thomas Gleixner wrote: > The clockid argument of clockid_to_kclock() comes straight from user space > via various syscalls and is used as index into the posix_clocks array. > > Protect it against spectre v1 array out of bounds speculation. Remove the > redundant check for !posix_clock[id] as this is another source for > speculation and does not provide any advantage over the return > posix_clock[id] path which returns NULL in that case anyway. > > Signed-off-by: Thomas Gleixner > Cc: stable@vger.kernel.org Acked-by: Peter Zijlstra (Intel) It might also be useful to figure out why the automation didn't flag this one, its about as trivial as it gets.