From patchwork Thu Sep 21 02:32:03 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: 113180 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1485401qgf; Wed, 20 Sep 2017 19:33:12 -0700 (PDT) X-Received: by 10.99.163.67 with SMTP id v3mr4116470pgn.206.1505961192385; Wed, 20 Sep 2017 19:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505961192; cv=none; d=google.com; s=arc-20160816; b=TCbLO6dKJbHglzKsscT4EdtQHYfyBnfFttJwYWsKS2h5904eFmYO0JjrHsCrJIQEvq dKCvJmvjV3uIg4ksWL2ugPjdolVx5LwJsRC9HzXHeWuLP8n41lgL/BskCbL5chViPh2M 4Aff8eDlroOY8FchqEpuX58udn8RPbb2Nj20IksjVioqmMUlm1FNCdKEhDwEjwXrEe02 RXO2FOS94yfbfiDn8Q0vU8RwEFKX/SH2/b1l6wHVHXhlJV/+CQgwxJUcskccGcrnwu6B HrH4pMKIiW2+gNZ8xsDCCVYFeTeuiUy8ZtgFaspcS2o89eEs+/rGzb8MXaxLSvJ3+GZh FsdQ== 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=tVIHvBV4coE/mlPwwVc0ankgsTizCJifp2126pNWpr4=; b=BiQv/t8NfIpGamo5L27U86fFvXzx/8jU6gL3DtbTlJnma5Kc5LBUE4oAG28LesKomg upXfvJXoX9SFW9ZO3z5pJvO+zkJLDdoug1uHWPQ0Qx1uD0ZiiR190Ye95wTWNX7wYipQ kg4eg2+hkFkhI73SBZpq52v3dAx63Py+0H+maipa/oqcljkZ1U/zoQPxEribyr8pEyV5 rw2W2W45Nm9w0L/n0ddhd2LwFmNYskNpvNqIKjAE/gI4AP1VuIPJGm7dyNpwFgkmKfvp eYzvPqh7R3G1zyBHtzXzHnUq6Yo+9Yj+y/lojiXorIDDgHvJm9kbxqPMvvhwTz/PRRmX CbFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i4TD/5mP; 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 u27si292979pfl.97.2017.09.20.19.33.12; Wed, 20 Sep 2017 19:33:12 -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=i4TD/5mP; 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 S1751661AbdIUCdK (ORCPT + 26 others); Wed, 20 Sep 2017 22:33:10 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:54476 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751640AbdIUCdG (ORCPT ); Wed, 20 Sep 2017 22:33:06 -0400 Received: by mail-pf0-f179.google.com with SMTP id d187so2495297pfg.11 for ; Wed, 20 Sep 2017 19:33:06 -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=tVIHvBV4coE/mlPwwVc0ankgsTizCJifp2126pNWpr4=; b=i4TD/5mP98yHUGPAzbPBCg++x8v6zUOvAvwfNR9g3fLexpS93Fm7W7Owg54eclEsAh bffaz1v8OmUXU1olm8rTSOyMFzoYg57lHfTLpv3PMhNy3CBHVHyeXItnn3V4F23OAqOT vxfUJPFfasYNTH5+Z7kTHRzX4uswtBYO8nrlw= 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=tVIHvBV4coE/mlPwwVc0ankgsTizCJifp2126pNWpr4=; b=sTsGafZYAr0IKyyaC414IutnZvoun+x6fgZJ8OTjUHn4hqF/VD3bt9CcYPRdjvecfX Oa0C8yNDAi1JJLrVvN843cP//lJwVIauamZgVavXm/eNVMobG/oWkrQKHj26LWTBjB0R IVhgqbiw6qPeNMUVZmNwEn1F1Mg5mUSsvRBtb/i6j1E8WAPxOqsyEMAgJGrBOr9A9DrR RJiYEIjm+H0cew2gfE2q9hUn/uRPeu9sdz+uMWEqWP37SfZnwmPllS0IW4z02DVGlHPS i+/HNFV59Q0oZgJWLZTWyx6WIi/pjHM9unp9c27vUpZYHes9436mQW1Yjus7O5K1CoO3 EXvg== X-Gm-Message-State: AHPjjUjfyhOruZEDpjVJn2UqE1lLAeGF8a45ebZkEKICMJmj7/irrqS5 VGPDpiO1eRxxHRBwBI2rnDei+w== X-Google-Smtp-Source: AOwi7QAqcKYJuXb9oH4yP9W2fQxa/J1Hj709zqbgnFUegObmLUhZU7t1mWjmMxgbGYC+NTHoP5qUUA== X-Received: by 10.99.95.204 with SMTP id t195mr4185327pgb.135.1505961186281; Wed, 20 Sep 2017 19:33:06 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id b22sm328291pfh.175.2017.09.20.19.33.03 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 19:33:05 -0700 (PDT) From: Baolin Wang To: dhowells@redhat.com Cc: james.l.morris@oracle.com, serge@hallyn.com, arnd@arndb.de, broonie@kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH v2 2/2] security: keys: Replace time_t with time64_t for struct key_preparsed_payload Date: Thu, 21 Sep 2017 10:32:03 +0800 Message-Id: <0f08ea5fb66780d40f104244d5fcaa8c610ffe30.1505960744.git.baolin.wang@linaro.org> 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 Reviewed-by: Arnd Bergmann --- 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 9520fc3..05d8fb5 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 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)