From patchwork Mon Oct 30 15:38:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 117495 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2730465qgn; Mon, 30 Oct 2017 08:38:16 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SxuKNIhIgfp2hcYiLbUD5AZUbAvmVfRXWUJ8BJqiZCdReryvy+nzoJ9Kwbv6ywxXmJNDEQ X-Received: by 10.101.82.198 with SMTP id z6mr7966477pgp.387.1509377895895; Mon, 30 Oct 2017 08:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509377895; cv=none; d=google.com; s=arc-20160816; b=TcW8WdVRmv9yDAN2PpiCtRWX4quH8v2Tm7/MzhDKpSGtXLUOS7/HlSSzO8+VbxeV7l e6xNoDeh1l/8BtCR0hBqy2/DHW0wo0wEUfMB2SZk6bVNwgLQ/JiiEnWJ/hDF+zzZQDAM dmpN/SmR9VyWrWQuvQlGLCyqutadZq4hfCzIgK+gKmEyA2e11tb93Hq/Ss911zfeTOkc vDDFK8zWLYJY9nmI7ERRyDMIZldbxoWLj9YYSpSzVVEAtFcLGCQYNOMNRD7zw6yeB4wv KoK/Noims6c10+0ARm/mqLoOuHYzYBrgkCa+t9ClVqS4sCZGSAdQUo5lzD0Dmf7BdS1e um8w== 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:cc:to:from :subject:organization:dmarc-filter:arc-authentication-results; bh=zqTnXNlDo89i7/4+TBb52DYN1goKfsTSGqjo3zvPS40=; b=AaD1QLUCoNvG/UdA8y9vhUTbkkth8MQBJKdumYt0eK5YIyU6p9J4jNrA+tiwD2BXSj OV34EEaoCZOukF1IuhWHOLk7lmFCnAtMpRLN5iWmcSz5gUYkmxTrXqLPF2NQwPrpeGtv TxH11Ldoh31ECkk/8N2glyBl88nAo8p+lqXmNIZYk1pWK5sq+hNSCZlT9XoVtS/tqBJF JUZSzrZJjAbXMvw73FgPwaT49k+KhpghoFSb5/qDELfhUxxK48GMVdVZSJKPkfYWKuws L1hjX8j5Ji7AvV7jv197/trqPe8Fn7VeNhJetb7Op4asYB4rmtcuddPgkrPdXT1rlp4x NplA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d196si11316735pfd.534.2017.10.30.08.38.15; Mon, 30 Oct 2017 08:38:15 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752778AbdJ3PiO (ORCPT + 27 others); Mon, 30 Oct 2017 11:38:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53902 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbdJ3PiM (ORCPT ); Mon, 30 Oct 2017 11:38:12 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B190480C18; Mon, 30 Oct 2017 15:38:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B190480C18 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dhowells@redhat.com Received: from warthog.procyon.org.uk (ovpn-120-62.rdu2.redhat.com [10.10.120.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE96D60240; Mon, 30 Oct 2017 15:38:10 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 3/4] security: keys: Replace time_t with time64_t for struct key_preparsed_payload From: David Howells To: tglx@linutronix.de Cc: dhowells@redhat.com, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org Date: Mon, 30 Oct 2017 15:38:09 +0000 Message-ID: <150937788989.31781.5673897968859253387.stgit@warthog.procyon.org.uk> In-Reply-To: <150937786557.31781.15521097996984061107.stgit@warthog.procyon.org.uk> References: <150937786557.31781.15521097996984061107.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 30 Oct 2017 15:38:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Baolin Wang 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 Reviewed-by: Arnd Bergmann Signed-off-by: David Howells Reviewed-by: James Morris --- include/linux/key-type.h | 2 +- security/keys/key.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/key-type.h b/include/linux/key-type.h index 9520fc3c3b9a..05d8fb5a06c4 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 */ } __randomize_layout; typedef int (*request_key_actor_t)(struct key_construction *key, diff --git a/security/keys/key.c b/security/keys/key.c index 291a67c45b65..d5c8941ae3fd 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)