Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp254691ybb; Tue, 31 Mar 2020 22:39:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtyrnOvg/+s859c/8szAuRkb3OfgjRBCPZjFFLnb1cVSsvYnzpxb601dKvPBDFRrSSb+VRD X-Received: by 2002:a9d:6744:: with SMTP id w4mr15724725otm.220.1585719563511; Tue, 31 Mar 2020 22:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585719563; cv=none; d=google.com; s=arc-20160816; b=I2CZrX8vE06eEfgBg8hIKoplz0GWNww2SR7XeCPUlfWpNfgb83wfuGs/6fFpIPT07y jTNhniRsVVSz8oNldXrRQBeZOIip5dUVS/ixwX/k7aWe3JQK6qDaFlcNQyFZgOOoALNy bB/JoTpV9C9ZyhfvaTXEa/4np2d2W+TxITRwNRNro9HB1mG4I+urFhCrK92UkHR0jB2z O/Sn0gqqAoJXtEcHs5uGESuaoyWsMm7rGmtRoD6JINGkxRsG1iJQNdVgbN5rololpq/c sN02rUfdh8Ht/2cJdOoZ1ayYNVH+IeDYi7DSaSgf5GIfzrLFSYHZwutkllNMtsgMpMbI JdcQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VzlrZXajPq/Q9/A0Br6uZT9Mu/rEfEvc46s5pTwJWdc=; b=yg6JdZTL8ViYU+uhZp0ttqWrrEoNWTfURkJ8eJr6GqViXRQwsv52csAyzn4n4fygEA +SC1JL7uWHX/kcidVg6UHzS5fHox59qG+AGFCmf3jPibMaQHSvgCZPiZGLNRGKxyHCIs M1hgwLlAsGG0l6KSrZAv3GF491x81MGTGyfwc+aHoPurHPI6eJ8yrnO9OSiIry/d4HVZ u1VyPOd9KI6rG2wThnFX31wrpzPw3eJ0XF13KGxleo4oI526x9jWOsQQp7z323DBo+ds K98UKE5txnssatbvi421LhrIK+DGfLJLJDX5D/y1LfkYFt41idZI4XpOKf69d8chfYnG g0Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GfSPYsdJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22si370211oto.237.2020.03.31.22.39.03; Tue, 31 Mar 2020 22:39:23 -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=@gmail.com header.s=20161025 header.b=GfSPYsdJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731799AbgDAFif (ORCPT + 99 others); Wed, 1 Apr 2020 01:38:35 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36496 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731589AbgDAFif (ORCPT ); Wed, 1 Apr 2020 01:38:35 -0400 Received: by mail-pl1-f196.google.com with SMTP id g2so9166941plo.3; Tue, 31 Mar 2020 22:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VzlrZXajPq/Q9/A0Br6uZT9Mu/rEfEvc46s5pTwJWdc=; b=GfSPYsdJm+BFpKl5mRbvUih0yWsgEJGXPVEixKGBV+8xNwWX+WJQFbXeLs6FTFUsEh XYQ38kwChg6NSA5gg99BWcB1ZvWUgbXMYyvWwVxonFkImaB0SBCuBGgaRwfX6M2CYUc2 s5Doh5xUew8B5/7ajRsQkd6pD7v8OXSLS2U0plpujWAm+avaaZF7IDfX5S/9TCeOSdx0 xmJYjJucBRs2GUa2PRix5wGJjJkqGoiy1HNoxlUTRv7h41hpFDwj3NuTp/AsgJniQJKF q32PFjiZA4dE0o9V+4+va4+kSCmCV6WFkYWvQJBHnRXvv49PtcMpzVgOAGy+pUG+nSWV S+ow== 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:mime-version:content-transfer-encoding; bh=VzlrZXajPq/Q9/A0Br6uZT9Mu/rEfEvc46s5pTwJWdc=; b=Eq9AxdB9sBTMOZJo4d9+XiHXY9w2WSYeL+Vbe17VcoCNMFBC4rTWAY5/ufbA8hCZ6a ZO6RfwFVdteEdjjcLHejn9dH9GHu/ew5HQvAkaW0VOh2IsaP3CzA8CiL+RUVpgDZzdHL mhJvpNHQdqA6eeUPh6kWuP6jxaKOz6XhrtJxuPJNLUgf1YhGjBN5sPLJqsVcKLD4gLDf iL0lx+5PMpLOa1b7Ub8XhOh3TQixmQ9oBvDPhpRU1BquvG13P8OMnjIMXCNsLJKcP74H SSp6pK6vqZq/dRRM4FtDs6804GSIiV5r9nZFy7tnm5C9clAVRCyK2wSi+c5jd1f4xGEn grig== X-Gm-Message-State: AGi0Pubg4Zd/mic7pmZXfvg9DCsekLDboD3kOGzaQniVFsRLpBr0EPCL cyIC5AEcmYX82UBjQF0NiX4E9JnUjNiv2w== X-Received: by 2002:a17:902:32b:: with SMTP id 40mr7244607pld.22.1585719514388; Tue, 31 Mar 2020 22:38:34 -0700 (PDT) Received: from nickserv.localdomain (c-67-188-225-242.hsd1.ca.comcast.net. [67.188.225.242]) by smtp.gmail.com with ESMTPSA id w69sm683077pfc.52.2020.03.31.22.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 22:38:33 -0700 (PDT) From: Nick Terrell To: Nick Terrell Cc: linux-kernel@vger.kernel.org, Chris Mason , linux-kbuild@vger.kernel.org, x86@kernel.org, gregkh@linuxfoundation.org, Petr Malat , Kees Cook , Kernel Team , Nick Terrell , Adam Borowski , Patrick Williams , rmikey@fb.com, mingo@kernel.org, Patrick Williams , Sedat Dilek Subject: [PATCH v4 2/8] lib: prepare xxhash for preboot environment Date: Tue, 31 Mar 2020 22:39:07 -0700 Message-Id: <20200401053913.216783-3-nickrterrell@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401053913.216783-1-nickrterrell@gmail.com> References: <20200401053913.216783-1-nickrterrell@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Terrell Don't export symbols if XXH_PREBOOT is defined. This change is necessary to get xxhash to work in a preboot environment, which is needed to support zstd-compressed kernels. Reviewed-by: Kees Cook Tested-by: Sedat Dilek Signed-off-by: Nick Terrell --- lib/xxhash.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/xxhash.c b/lib/xxhash.c index aa61e2a3802f..b4364e011392 100644 --- a/lib/xxhash.c +++ b/lib/xxhash.c @@ -80,13 +80,11 @@ void xxh32_copy_state(struct xxh32_state *dst, const struct xxh32_state *src) { memcpy(dst, src, sizeof(*dst)); } -EXPORT_SYMBOL(xxh32_copy_state); void xxh64_copy_state(struct xxh64_state *dst, const struct xxh64_state *src) { memcpy(dst, src, sizeof(*dst)); } -EXPORT_SYMBOL(xxh64_copy_state); /*-*************************** * Simple Hash Functions @@ -151,7 +149,6 @@ uint32_t xxh32(const void *input, const size_t len, const uint32_t seed) return h32; } -EXPORT_SYMBOL(xxh32); static uint64_t xxh64_round(uint64_t acc, const uint64_t input) { @@ -234,7 +231,6 @@ uint64_t xxh64(const void *input, const size_t len, const uint64_t seed) return h64; } -EXPORT_SYMBOL(xxh64); /*-************************************************** * Advanced Hash Functions @@ -251,7 +247,6 @@ void xxh32_reset(struct xxh32_state *statePtr, const uint32_t seed) state.v4 = seed - PRIME32_1; memcpy(statePtr, &state, sizeof(state)); } -EXPORT_SYMBOL(xxh32_reset); void xxh64_reset(struct xxh64_state *statePtr, const uint64_t seed) { @@ -265,7 +260,6 @@ void xxh64_reset(struct xxh64_state *statePtr, const uint64_t seed) state.v4 = seed - PRIME64_1; memcpy(statePtr, &state, sizeof(state)); } -EXPORT_SYMBOL(xxh64_reset); int xxh32_update(struct xxh32_state *state, const void *input, const size_t len) { @@ -334,7 +328,6 @@ int xxh32_update(struct xxh32_state *state, const void *input, const size_t len) return 0; } -EXPORT_SYMBOL(xxh32_update); uint32_t xxh32_digest(const struct xxh32_state *state) { @@ -372,7 +365,6 @@ uint32_t xxh32_digest(const struct xxh32_state *state) return h32; } -EXPORT_SYMBOL(xxh32_digest); int xxh64_update(struct xxh64_state *state, const void *input, const size_t len) { @@ -439,7 +431,6 @@ int xxh64_update(struct xxh64_state *state, const void *input, const size_t len) return 0; } -EXPORT_SYMBOL(xxh64_update); uint64_t xxh64_digest(const struct xxh64_state *state) { @@ -494,7 +485,19 @@ uint64_t xxh64_digest(const struct xxh64_state *state) return h64; } + +#ifndef XXH_PREBOOT +EXPORT_SYMBOL(xxh32_copy_state); +EXPORT_SYMBOL(xxh64_copy_state); +EXPORT_SYMBOL(xxh32); +EXPORT_SYMBOL(xxh64); +EXPORT_SYMBOL(xxh32_reset); +EXPORT_SYMBOL(xxh64_reset); +EXPORT_SYMBOL(xxh32_update); +EXPORT_SYMBOL(xxh32_digest); +EXPORT_SYMBOL(xxh64_update); EXPORT_SYMBOL(xxh64_digest); MODULE_LICENSE("Dual BSD/GPL"); MODULE_DESCRIPTION("xxHash"); +#endif -- 2.26.0