From patchwork Wed Aug 9 02:51:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 109689 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp282567qge; Tue, 8 Aug 2017 19:52:55 -0700 (PDT) X-Received: by 10.84.215.211 with SMTP id g19mr7056563plj.438.1502247175771; Tue, 08 Aug 2017 19:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502247175; cv=none; d=google.com; s=arc-20160816; b=QobkbaWxkN1tinkiJos0fkSIBWeQ75+xFxqBVT3hmr/ihebpjdLQQyHXExu3HFjfgg fQcxZkQxlw5jPreXAW8oGOgn3YAm52WamcJncoTAnuylTg2xBbTG+MO7sR3Ewk1D882U /xlaCrr6XrT+fjlM7Gp6yPokSj2mg/rM1XFJ/T0x7ObowbwoseR5rnqD3Gb0rSe51sQP FX2TuXwV2V5PELK3RyRiSNkDT0T46fI1ZwEgFtirpvK+UrZmdrBZDVPdSkuiTAH+yGdq 7w0yqZNLKdGe/WRPnpBt8yH7exEAYPEVOr3LO1RwHX7BkcifcU7aMbW1oGJRmrCTs64c g+sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Gq3bRmvHcaHZWUw5yT962ygllDHyu02n/ryR9eZnMnE=; b=wN16fvT7f1dTGkLHxspx67SYWgFcY25a0a13jIL74UJa0zCXehzSH3aJcTKXdBlMv4 c+D2rwRqjqKAlowpDmWe6XFFMm3XAgmLXrcr4EY7fm137kS4j5pV46AfsaCAUuhNljl+ TotqK3VZzdvanOq1roWwW/ky4nWWImLm+URqaeIg4KTqsdb8e+iE4xitI7TuDTsOT7q4 LPDZ19iaCXqfJo10YRJRodhGDcyBeGyUKNbjtN33oiTwyxRugHchN+7MD1AmGgOxrVFg F7aRgdDcp7bovaz+a2OaQePt6fQ5WjpXT9bLzY2BaQS8iVUBbOdInJ1tEXMljRHjVzcu OWhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aKWDdzKT; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si740142plj.451.2017.08.08.19.52.55; Tue, 08 Aug 2017 19:52:55 -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=@linaro.org header.s=google header.b=aKWDdzKT; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752583AbdHICwx (ORCPT + 25 others); Tue, 8 Aug 2017 22:52:53 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:35968 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752602AbdHICwP (ORCPT ); Tue, 8 Aug 2017 22:52:15 -0400 Received: by mail-pf0-f177.google.com with SMTP id c28so22049347pfe.3 for ; Tue, 08 Aug 2017 19:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Gq3bRmvHcaHZWUw5yT962ygllDHyu02n/ryR9eZnMnE=; b=aKWDdzKTr2F9SnPqzkfFXM+5FpJ/mQpz+nQuFOtx+ZIHYoXke3Vvabv02axx/UYJaW MvynBupiMbU8y/kdP4E6LMFFxz0T5pvP8ZagUVM+tj695eWAam/UA5qmGOeaAWut9sv/ 8UvsOweOKD0lMujYtduXLohPntjiYEJJkbx6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Gq3bRmvHcaHZWUw5yT962ygllDHyu02n/ryR9eZnMnE=; b=d+/2NFnSXczczD7n0MQ6SYWdbQavLIdGvlcR/iov5Rl2ivWI8qZXaEeoMhZdstDxR3 ZlY0i1H4dtyIFTethr1ie7qhN2llzQC3/AaryAoL5pALFGFPUtHQBuQ7qeAAH7Wn26Hn oyl7luq/DiPSsJf8mzBYikbyYDiJbS3vgqP12f10p61PwB8oGmb0Yi3KaU4ojYZ58XrY o2XG6tSm5b3MN/C+/VrdUsdcKga+RUWJ0/tgJfXkjDEHLNk9iP7xl7ePeZWwdgI0t/sQ CebIAC0ADJQ5gCuoHWF9pjz4GyThv90lzNV3l8+JHxQ2Z70/BnimDqwHMofYjx8mgcR5 ufZw== X-Gm-Message-State: AHYfb5iKqDJdQ7eTwbgDc2HZmCOn34NGf3OIoh0kIWwutKqa46D3qAcp afn6urjgnQ44wqi3 X-Received: by 10.98.89.66 with SMTP id n63mr6547060pfb.137.1502247135097; Tue, 08 Aug 2017 19:52:15 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id t64sm4435558pgd.80.2017.08.08.19.52.10 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Aug 2017 19:52:14 -0700 (PDT) From: Baolin Wang To: dhowells@redhat.com, davem@davemloft.net Cc: james.l.morris@oracle.com, serge@hallyn.com, marc.dionne@auristor.com, dan.carpenter@oracle.com, Jason@zx2c4.com, arnd@arndb.de, broonie@kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH 2/3] security: keys: Replace time_t with time64_t for struct key_preparsed_payload Date: Wed, 9 Aug 2017 10:51:31 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 'struct key_preparsed_payload' will use 'time_t' which we will try to remove in the kernel, since 'time_t' is not year 2038 safe on 32bits systems. Thus this patch replaces 'time_t' with 'time64_t' which is year 2038 safe on 32 bits system for 'struct key_preparsed_payload', moreover we should use the 'TIME64_MAX' macro to initialize the 'time64_t' type variable. Signed-off-by: Baolin Wang --- include/linux/key-type.h | 2 +- security/keys/key.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) -- 1.7.9.5 diff --git a/include/linux/key-type.h b/include/linux/key-type.h index 8496cf6..4beb006 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h @@ -44,7 +44,7 @@ struct key_preparsed_payload { const void *data; /* Raw data */ size_t datalen; /* Raw datalen */ size_t quotalen; /* Quota length for proposed payload */ - time_t expiry; /* Expiry time of key */ + time64_t expiry; /* Expiry time of key */ }; typedef int (*request_key_actor_t)(struct key_construction *key, diff --git a/security/keys/key.c b/security/keys/key.c index 291a67c..d5c8941 100644 --- a/security/keys/key.c +++ b/security/keys/key.c @@ -446,7 +446,7 @@ static int __key_instantiate_and_link(struct key *key, if (authkey) key_revoke(authkey); - if (prep->expiry != TIME_T_MAX) { + if (prep->expiry != TIME64_MAX) { key->expiry = prep->expiry; key_schedule_gc(prep->expiry + key_gc_delay); } @@ -492,7 +492,7 @@ int key_instantiate_and_link(struct key *key, prep.data = data; prep.datalen = datalen; prep.quotalen = key->type->def_datalen; - prep.expiry = TIME_T_MAX; + prep.expiry = TIME64_MAX; if (key->type->preparse) { ret = key->type->preparse(&prep); if (ret < 0) @@ -834,7 +834,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, prep.data = payload; prep.datalen = plen; prep.quotalen = index_key.type->def_datalen; - prep.expiry = TIME_T_MAX; + prep.expiry = TIME64_MAX; if (index_key.type->preparse) { ret = index_key.type->preparse(&prep); if (ret < 0) { @@ -968,7 +968,7 @@ int key_update(key_ref_t key_ref, const void *payload, size_t plen) prep.data = payload; prep.datalen = plen; prep.quotalen = key->type->def_datalen; - prep.expiry = TIME_T_MAX; + prep.expiry = TIME64_MAX; if (key->type->preparse) { ret = key->type->preparse(&prep); if (ret < 0)