Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp696648ybt; Mon, 6 Jul 2020 20:51:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJPtzSt3BheXVI3Fl/DDnXpM8KejCgKDWCDzXCYj14nIqQFV3/XPA2OrS68R5sXv8z9Eur X-Received: by 2002:a17:906:2b92:: with SMTP id m18mr48621730ejg.218.1594093890965; Mon, 06 Jul 2020 20:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594093890; cv=none; d=google.com; s=arc-20160816; b=iP8o6rIXJ6rTvbyeGzF890XwC2pAOkm8UtVurUMDuHUrOU18hR8UK7elY5EmEYjIM4 +ZhnBcp+z79F4GwnYXcKvDy3T9jcqEWDi02NcbKPj9w6KzoumSffGdE/EjN4dvc7xEru Lt7rMvHjm0o+gKGvcDd5CzABirCb44gHP1aMHSLPHGpsMQ/ZqFTxCwVMJ4yJYlE/53Gv z0Mbg/J4Lfwr2Uem550m5s+BKQ0jDCb2si0JI4/i4lqeFglcOw0quBEfodaR5QlhLrU1 D8kj+K5CBhAcNBWT5b/W70YekckVdMfnbjKtNaVmptw7W7II8Yljc2ItjGB6BDAO5sQ/ L1aA== 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=hqD+rB+dUqcNH2ubsf4aEAlafa+Qv3ATu6dvlaFdxSg=; b=PHCOic0aPhmXZjUk2kXLp1RkLrvy5x6TWs89e6x7b/eMm2Slif/O35RnW/zfx2hpLW OANlXQsAQhW6FlU9k9nMvxhO0bpwogE4AkbyJbXubO/wDtIZG7e6A+hvEFPlX4iB62G1 Srk8p21jlAuPLU4GqRMdzSOm6Dgrt0NLNe8+vkhlGszB6q0I9RHgfwnhoPs2vXlsRIg4 z0xKQUESwh7BQSgXeOHTcYI/SWAKAyT5u6l5T5EHQvokCEZ6ZhgP76O7a6jXOY6ey5BB qaKdQPbX08pmjJpN+6Jw0qEJh/SFrWsbI4oI3cN7YJOMqpHWIdLPndbM8PTiy8n7kIM8 FMhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XvwFPpfI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n16si14119153edt.25.2020.07.06.20.51.07; Mon, 06 Jul 2020 20:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XvwFPpfI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727995AbgGGDuv (ORCPT + 99 others); Mon, 6 Jul 2020 23:50:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbgGGDuu (ORCPT ); Mon, 6 Jul 2020 23:50:50 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5ABBC061755; Mon, 6 Jul 2020 20:50:50 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id m22so8995369pgv.9; Mon, 06 Jul 2020 20:50:50 -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=hqD+rB+dUqcNH2ubsf4aEAlafa+Qv3ATu6dvlaFdxSg=; b=XvwFPpfIe21QpqVUzA6v/bwjymp/AqL8cQdKlbkw6lk+Qv7RQ1Am9l8CjWhwx1gjCv 1xDsBrK0vkt0uk60UoKIehBkgZ0Zg9O+/5z3+VikeQBDQ1/fcjWeT+oL7QMRUrl5cBt6 ihXapRoBZsjlrxw4PZQgJf4PQOGvzYs5zLBuwuBcdOmGKeduUbz65YKHIR5EPmAOWP0N yyljUJwHY0QHLGfannuhgEIQ7dAFuFH0kT1uu5OYj1j+GAw499pJAIOgLtQ3bA4dpSX0 VOrB/iooGMmmmoyMlKj4aV/zfEs3fPEyd8nTKfgHCfhhiok95tBjrfBkYBLPg85SClPV gNFQ== 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=hqD+rB+dUqcNH2ubsf4aEAlafa+Qv3ATu6dvlaFdxSg=; b=RMmT6eGDjb76qImu7PmZsdbv+LLCFn+TZ/ntsl3tmfEwp8l+pafuub2sYlzl9ungt4 cYa3oXQKhtMWSyiDs8xzZbfqoBZdLmULhdlQSQ/muhz3EzxXje5kqw9xEeL5G11pyny8 M6PGbRdVC5CONBdDpYd8I/tOO8gkDsYZMbTY7Gg/TKHkkYvocoN4lGR1o5RCjUR115J6 PlXODWBjrPhbbs8oCEDhTSpdyDNev7uPoevDpeyFU5ljnlY+3NF+jqMIZfGJIJ0N3PYM QqZPp0GdKOdXS4ttLxR5pr1hpVPqVZ4lH7ER7G3QZlu5lwG23Kqga6c8PZw7JAULlbvl lg1Q== X-Gm-Message-State: AOAM53099b/PT1BmHye8AqaYZCe199+e0M9+nffH26osKYbjYn2wB9JN 5+PdHu+Y6kOip76drKMtf6w= X-Received: by 2002:a63:3d42:: with SMTP id k63mr42829525pga.330.1594093850203; Mon, 06 Jul 2020 20:50:50 -0700 (PDT) Received: from nickserv.localdomain (c-98-33-101-203.hsd1.ca.comcast.net. [98.33.101.203]) by smtp.gmail.com with ESMTPSA id d22sm20466320pfd.105.2020.07.06.20.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2020 20:50:49 -0700 (PDT) From: Nick Terrell To: Borislav Petkov , Thomas Gleixner 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 , Norbert Lange , Andrew Morton , Nick Terrell Subject: [PATCH v6 2/8] lib: prepare xxhash for preboot environment Date: Mon, 6 Jul 2020 20:45:58 -0700 Message-Id: <20200707034604.1539157-3-nickrterrell@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200707034604.1539157-1-nickrterrell@gmail.com> References: <20200707034604.1539157-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.27.0