Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp823307ybl; Wed, 11 Dec 2019 08:03:45 -0800 (PST) X-Google-Smtp-Source: APXvYqzyP/cep1zqewgQpFligJtPT/CZvOlOPdDlQ+xkdaxYCUDU/VGDUfx+wg05v8q73hQ2bPTD X-Received: by 2002:a9d:74c7:: with SMTP id a7mr2884518otl.7.1576080224416; Wed, 11 Dec 2019 08:03:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080224; cv=none; d=google.com; s=arc-20160816; b=C4u0pLfd/rg+kztQOcD/f0P3L1ll3Zw8nTE1MsheYWci1acdRBs2m8bYIePt2xVKL1 RZNS7ysQFG8R2yCyojCLAY5MR8Y+iuQyM2V4778ePZ69Ew/pb8trtqRg0oqY+cebEwUi l8/y9W1gvHxD2MvlulsqMNIIUELN8R5F2DM5CUDMg1CIfCvz9rmPcVrEPTwowcXolGem ny9kCuAn7nFeSRYAcLQFyqU9JlgGNAnOrJPmUPig5rrQ2gulRU2KgmOkgIJjz6s41pZk oe5MbrFexZPFO4ozwheFg1O5DlV+Bt4dRFtR9qC7Damqw1BpjNWOuuoDWcwb/q7UB/aN +wDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pv8tAHVZT9Nvq3bxMcw7Sr53chjFi1gj/Ts5oUV6JdQ=; b=b8bexqVdEpYxHrxIOHhv90jsaEAIfwQKc7QB+gD4zn1OxTMQlk6BR3wuDKMk+wcBbE 2tvfL6v5lNndur+tyPOEFl2I3n/+jqvSAGzlTeg5eLDHkUWg5X5YwrvsseXA+/RlLge7 9ilXxAXh1MGd8KUghB1T2ma6fHG4atFIkndpMt7tzgEuTdnEYkf6qbxc6H91meUa8ypW ZzY2yeqUx26TnlKVW8YFoY4Jvtm+GtdD9/OgdTGRqtkW4c8PnMYivPYXI8nyO3FipjQW 2cDjVY7psT1Ps9VVLTiKBRfwTPDKcm6jSBNPk2+WvPk6MmFPaHsOdNn4ZIYX7/Xljb7O jEDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y2Q196js; 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 l5si1510122otb.26.2019.12.11.08.03.24; Wed, 11 Dec 2019 08:03:44 -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=pass header.i=@kernel.org header.s=default header.b=y2Q196js; 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 S1730671AbfLKPNR (ORCPT + 99 others); Wed, 11 Dec 2019 10:13:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:36294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731373AbfLKPNM (ORCPT ); Wed, 11 Dec 2019 10:13:12 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A00C02464B; Wed, 11 Dec 2019 15:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077192; bh=fqApEpiJswPrQQE2UddJFG1LKaOvkhQp23n/8LhV2U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y2Q196js8RagPb3WngA5flGQu8/gX7bkB3fTCJ9I9BnzAf6SoLyc+Fua53ysR34h6 rQT1A84mbFEIqNxCSgqlGhiyiX9nKYX+0wFaj1WLjNw9PibVrT14RA/rUHhpXGHK9q YFsz57kirW4TsEHQwefbueaPQDEL2xIGeGuum/sw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Hutchings , Dmitry Safonov , Thomas Gleixner Subject: [PATCH 5.3 006/105] time: Zero the upper 32-bits in __kernel_timespec on 32-bit Date: Wed, 11 Dec 2019 16:04:55 +0100 Message-Id: <20191211150222.848046258@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Safonov commit 7b8474466ed97be458c825f34a85f2c2b84c3f95 upstream. On compat interfaces, the high order bits of nanoseconds should be zeroed out. This is because the application code or the libc do not guarantee zeroing of these. If used without zeroing, kernel might be at risk of using timespec values incorrectly. Originally it was handled correctly, but lost during is_compat_syscall() cleanup. Revert the condition back to check CONFIG_64BIT. Fixes: 98f76206b335 ("compat: Cleanup in_compat_syscall() callers") Reported-by: Ben Hutchings Signed-off-by: Dmitry Safonov Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20191121000303.126523-1-dima@arista.com Signed-off-by: Greg Kroah-Hartman --- kernel/time/time.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -881,7 +881,8 @@ int get_timespec64(struct timespec64 *ts ts->tv_sec = kts.tv_sec; /* Zero out the padding for 32 bit systems or in compat mode */ - if (IS_ENABLED(CONFIG_64BIT_TIME) && in_compat_syscall()) + if (IS_ENABLED(CONFIG_64BIT_TIME) && (!IS_ENABLED(CONFIG_64BIT) || + in_compat_syscall())) kts.tv_nsec &= 0xFFFFFFFFUL; ts->tv_nsec = kts.tv_nsec;