mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/fix-coverity-build'
* origin/topic/jsiwek/fix-coverity-build: Remove inline from some static KeyedHash members Improve Func.h inclusion
This commit is contained in:
commit
02476453bc
17 changed files with 97 additions and 42 deletions
21
CHANGES
21
CHANGES
|
@ -1,4 +1,25 @@
|
|||
|
||||
3.2.0-dev.749 | 2020-06-08 11:22:45 -0700
|
||||
|
||||
* Remove inline from some static KeyedHash members (Jon Siwek, Corelight)
|
||||
|
||||
Coverity Scan builds currently encounter catastrophic error, claiming
|
||||
alignas requires use on both declaration and definition, so appears to
|
||||
actually not understand "static inline" in combo with alignas.
|
||||
|
||||
* Improve Func.h inclusion (Jon Siwek, Corelight)
|
||||
|
||||
Now forward declares some Broker types since Broker/CAF headers
|
||||
generally slow things down and also Coverity Scan currently has a
|
||||
catastrophic error on some CAF headers.
|
||||
|
||||
Also a few other changes to EventHandler/BifReturnVal to reduce number
|
||||
of places that depend on Func.h.
|
||||
|
||||
* Rename aux/ to auxil/ (Jon Siwek, Corelight)
|
||||
|
||||
Since "aux" is not an allowed file/dir name on Windows.
|
||||
|
||||
3.2.0-dev.744 | 2020-06-04 15:11:56 -0700
|
||||
|
||||
* Fix use-after-move of proc_status_file breaking -U flag (Jon Siwek, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
3.2.0-dev.744
|
||||
3.2.0-dev.749
|
||||
|
|
11
src/BifReturnVal.cc
Normal file
11
src/BifReturnVal.cc
Normal file
|
@ -0,0 +1,11 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#include "BifReturnVal.h"
|
||||
#include "Val.h"
|
||||
|
||||
BifReturnVal::BifReturnVal(std::nullptr_t) noexcept
|
||||
{}
|
||||
|
||||
BifReturnVal::BifReturnVal(Val* v) noexcept
|
||||
: rval(AdoptRef{}, v)
|
||||
{}
|
28
src/BifReturnVal.h
Normal file
28
src/BifReturnVal.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "IntrusivePtr.h"
|
||||
|
||||
class Val;
|
||||
|
||||
/**
|
||||
* A simple wrapper class to use for the return value of BIFs so that
|
||||
* they may return either a Val* or IntrusivePtr<Val> (the former could
|
||||
* potentially be deprecated).
|
||||
*/
|
||||
class BifReturnVal {
|
||||
public:
|
||||
|
||||
template <typename T>
|
||||
BifReturnVal(IntrusivePtr<T> v) noexcept
|
||||
: rval(AdoptRef{}, v.release())
|
||||
{ }
|
||||
|
||||
BifReturnVal(std::nullptr_t) noexcept;
|
||||
|
||||
[[deprecated("Remove in v4.1. Return an IntrusivePtr instead.")]]
|
||||
BifReturnVal(Val* v) noexcept;
|
||||
|
||||
IntrusivePtr<Val> rval;
|
||||
};
|
|
@ -218,6 +218,7 @@ set(MAIN_SRCS
|
|||
Anon.cc
|
||||
Attr.cc
|
||||
Base64.cc
|
||||
BifReturnVal.cc
|
||||
Brofiler.cc
|
||||
BroString.cc
|
||||
CCL.cc
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "zeek-config.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
|
|
@ -44,6 +44,12 @@ const IntrusivePtr<FuncType>& EventHandler::GetType(bool check_export)
|
|||
return type;
|
||||
}
|
||||
|
||||
void EventHandler::SetFunc(IntrusivePtr<Func> f)
|
||||
{ local = std::move(f); }
|
||||
|
||||
void EventHandler::SetLocalHandler(Func* f)
|
||||
{ SetFunc({NewRef{}, f}); }
|
||||
|
||||
void EventHandler::Call(zeek::Args* vl, bool no_remote)
|
||||
{
|
||||
#ifdef PROFILE_BRO_FUNCTIONS
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
#include "BroList.h"
|
||||
#include "ZeekArgs.h"
|
||||
#include "Type.h"
|
||||
#include "Func.h"
|
||||
|
||||
#include <unordered_set>
|
||||
#include <string>
|
||||
|
||||
class Func;
|
||||
|
||||
class EventHandler {
|
||||
public:
|
||||
explicit EventHandler(std::string name);
|
||||
|
@ -28,12 +29,10 @@ public:
|
|||
FuncType* FType(bool check_export = true)
|
||||
{ return GetType().get(); }
|
||||
|
||||
void SetFunc(IntrusivePtr<Func> f)
|
||||
{ local = std::move(f); }
|
||||
void SetFunc(IntrusivePtr<Func> f);
|
||||
|
||||
[[deprecated("Remove in v4.1. Use SetFunc().")]]
|
||||
void SetLocalHandler(Func* f)
|
||||
{ SetFunc({NewRef{}, f}); }
|
||||
void SetLocalHandler(Func* f);
|
||||
|
||||
void AutoPublish(std::string topic)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "EventRegistry.h"
|
||||
#include "EventHandler.h"
|
||||
#include "Func.h"
|
||||
#include "RE.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
|
|
|
@ -892,10 +892,3 @@ function_ingredients::function_ingredients(IntrusivePtr<Scope> scope, IntrusiveP
|
|||
priority = (attrs ? get_func_priority(*attrs) : 0);
|
||||
this->body = std::move(body);
|
||||
}
|
||||
|
||||
BifReturnVal::BifReturnVal(std::nullptr_t) noexcept
|
||||
{ }
|
||||
|
||||
BifReturnVal::BifReturnVal(Val* v) noexcept
|
||||
: rval(AdoptRef{}, v)
|
||||
{ }
|
||||
|
|
35
src/Func.h
35
src/Func.h
|
@ -9,15 +9,13 @@
|
|||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
#include <broker/data.hh>
|
||||
#include <broker/expected.hh>
|
||||
|
||||
#include "BroList.h"
|
||||
#include "Obj.h"
|
||||
#include "IntrusivePtr.h"
|
||||
#include "Type.h" /* for function_flavor */
|
||||
#include "TraverseTypes.h"
|
||||
#include "ZeekArgs.h"
|
||||
#include "BifReturnVal.h"
|
||||
|
||||
class Val;
|
||||
class ListExpr;
|
||||
|
@ -28,6 +26,16 @@ class ID;
|
|||
class CallExpr;
|
||||
class Scope;
|
||||
|
||||
namespace caf {
|
||||
template <class> class expected;
|
||||
}
|
||||
|
||||
namespace broker {
|
||||
class data;
|
||||
using vector = std::vector<data>;
|
||||
using caf::expected;
|
||||
}
|
||||
|
||||
class Func : public BroObj {
|
||||
public:
|
||||
static inline const IntrusivePtr<Func> nil;
|
||||
|
@ -205,27 +213,6 @@ private:
|
|||
bool weak_closure_ref = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* A simple wrapper class to use for the return value of BIFs so that
|
||||
* they may return either a Val* or IntrusivePtr<Val> (the former could
|
||||
* potentially be deprecated).
|
||||
*/
|
||||
class BifReturnVal {
|
||||
public:
|
||||
|
||||
template <typename T>
|
||||
BifReturnVal(IntrusivePtr<T> v) noexcept
|
||||
: rval(AdoptRef{}, v.release())
|
||||
{ }
|
||||
|
||||
BifReturnVal(std::nullptr_t) noexcept;
|
||||
|
||||
[[deprecated("Remove in v4.1. Return an IntrusivePtr instead.")]]
|
||||
BifReturnVal(Val* v) noexcept;
|
||||
|
||||
IntrusivePtr<Val> rval;
|
||||
};
|
||||
|
||||
using built_in_func = BifReturnVal (*)(Frame* frame, const zeek::Args* args);
|
||||
|
||||
class BuiltinFunc final : public Func {
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
#include "highwayhash/highwayhash_target.h"
|
||||
#include "highwayhash/instruction_sets.h"
|
||||
|
||||
alignas(32) uint64_t KeyedHash::shared_highwayhash_key[4];
|
||||
alignas(32) uint64_t KeyedHash::cluster_highwayhash_key[4];
|
||||
alignas(16) unsigned long long KeyedHash::shared_siphash_key[2];
|
||||
|
||||
// we use the following lines to not pull in the highwayhash headers in Hash.h - but to check the types did not change underneath us.
|
||||
static_assert(std::is_same<hash64_t, highwayhash::HHResult64>::value, "Highwayhash return values must match hash_x_t");
|
||||
static_assert(std::is_same<hash128_t, highwayhash::HHResult128>::value, "Highwayhash return values must match hash_x_t");
|
||||
|
|
|
@ -186,11 +186,11 @@ public:
|
|||
|
||||
private:
|
||||
// actually HHKey. This key changes each start (unless a seed is specified)
|
||||
alignas(32) inline static uint64_t shared_highwayhash_key[4];
|
||||
alignas(32) static uint64_t shared_highwayhash_key[4];
|
||||
// actually HHKey. This key is installation specific and sourced from the digest_salt script-level const.
|
||||
alignas(32) inline static uint64_t cluster_highwayhash_key[4];
|
||||
alignas(32) static uint64_t cluster_highwayhash_key[4];
|
||||
// actually HH_U64, which has the same type. This key changes each start (unless a seed is specified)
|
||||
alignas(16) inline static unsigned long long shared_siphash_key[2];
|
||||
alignas(16) static unsigned long long shared_siphash_key[2];
|
||||
// This key changes each start (unless a seed is specified)
|
||||
inline static uint8_t shared_hmac_md5_key[16];
|
||||
inline static bool seeds_initialized = false;
|
||||
|
|
|
@ -7,3 +7,4 @@
|
|||
#include "Reporter.h"
|
||||
#include "ID.h"
|
||||
#include "EventRegistry.h"
|
||||
#include "BifReturnVal.h"
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "file_analysis/Manager.h"
|
||||
|
||||
#include <broker/error.hh>
|
||||
#include <broker/expected.hh>
|
||||
#include <broker/data.hh>
|
||||
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
|
2
testing/external/commit-hash.zeek-testing
vendored
2
testing/external/commit-hash.zeek-testing
vendored
|
@ -1 +1 @@
|
|||
d242bb7e8a231f01fa2af5027e938bbd4fe6ecba
|
||||
807dce8fd94d59e571994c033e333691f7ef27ba
|
||||
|
|
|
@ -1 +1 @@
|
|||
b77a24eb48231f0ca34ca06465e22a4e5053d8a2
|
||||
fa5c4dc4ea3481c7b273f0cfcc77497c0d32aa7c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue