From 03506c65b5e967e2a00aa9084dfcb28d62c69e5f Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 6 Feb 2018 17:58:04 +0100 Subject: [PATCH] fixed FTBS with gcc8 --- libvma-8.0.1-gcc8.patch | 177 ++++++++++++++++++++++++++++++++++++++++ libvma.spec | 9 +- 2 files changed, 183 insertions(+), 3 deletions(-) create mode 100644 libvma-8.0.1-gcc8.patch diff --git a/libvma-8.0.1-gcc8.patch b/libvma-8.0.1-gcc8.patch new file mode 100644 index 0000000..176b695 --- /dev/null +++ b/libvma-8.0.1-gcc8.patch @@ -0,0 +1,177 @@ +diff -up libvma-8.0.1/src/stats/stats_publisher.cpp.me libvma-8.0.1/src/stats/stats_publisher.cpp +--- libvma-8.0.1/src/stats/stats_publisher.cpp.me 2018-02-06 17:39:15.618093186 +0100 ++++ libvma-8.0.1/src/stats/stats_publisher.cpp 2018-02-06 17:39:54.488171577 +0100 +@@ -268,7 +268,7 @@ shmem_error: + g_sh_mem_info.fd_sh_stats = -1; + g_sh_mem_info.p_sh_stats = MAP_FAILED; + g_sh_mem = &g_local_sh_mem; +- memset(g_sh_mem, 0, sizeof(*g_sh_mem)); ++ memset(static_cast(g_sh_mem), 0, sizeof(*g_sh_mem)); + *p_p_vma_log_level = &g_sh_mem->log_level; + *p_p_vma_log_details = &g_sh_mem->log_details_level; + BULLSEYE_EXCLUDE_BLOCK_END +@@ -332,7 +332,7 @@ void vma_stats_instance_create_socket_bl + + out: + if (p_skt_stats) { +- memset(p_skt_stats, 0, sizeof(*p_skt_stats)); ++ memset(static_cast(p_skt_stats), 0, sizeof(*p_skt_stats)); + p_skt_stats->mc_grp_map.reset(); + g_p_stats_data_reader->add_data_reader(local_stats_addr, p_skt_stats, sizeof(socket_stats_t)); + } +diff -up libvma-8.0.1/src/stats/stats_reader.cpp.me libvma-8.0.1/src/stats/stats_reader.cpp +--- libvma-8.0.1/src/stats/stats_reader.cpp.me 2018-02-06 15:59:12.754199479 +0100 ++++ libvma-8.0.1/src/stats/stats_reader.cpp 2018-02-06 16:39:38.406905488 +0100 +@@ -1525,8 +1525,10 @@ int init_print_process_stats(sh_mem_inf + sh_mem_t* sh_mem; + int pid = sh_mem_info.pid; + +- snprintf(sh_mem_info.filename_sh_stats, sizeof(sh_mem_info.filename_sh_stats), "%s/vmastat.%d", g_vma_shmem_dir, pid); +- ++ //snprintf(sh_mem_info.filename_sh_stats, sizeof(sh_mem_info.filename_sh_stats), "%s/vmastat.%d", g_vma_shmem_dir, pid); ++ const char ib_path_format[] = "%s/vmastat.%d"; ++ snprintf(sh_mem_info.filename_sh_stats, sizeof(sh_mem_info.filename_sh_stats), ib_path_format, g_vma_shmem_dir, pid); ++ + if (user_params.write_auth) + sh_mem_info.fd_sh_stats = open(sh_mem_info.filename_sh_stats,O_RDWR, S_IRWXU|S_IROTH); + else +diff -up libvma-8.0.1/src/vma/dev/buffer_pool.cpp.me libvma-8.0.1/src/vma/dev/buffer_pool.cpp +--- libvma-8.0.1/src/vma/dev/buffer_pool.cpp.me 2018-02-06 17:18:48.792336254 +0100 ++++ libvma-8.0.1/src/vma/dev/buffer_pool.cpp 2018-02-06 17:18:25.927276800 +0100 +@@ -166,7 +166,7 @@ buffer_pool::buffer_pool(size_t buffer_c + for (size_t i = 0; i < buffer_count; ++i) { + + mem_buf_desc_t* ptr_desc_mbdt = (mem_buf_desc_t*)ptr_desc; +- memset(ptr_desc_mbdt, 0, sizeof (*ptr_desc_mbdt)); ++ memset(static_cast(ptr_desc_mbdt), 0, sizeof (*ptr_desc_mbdt)); + mem_buf_desc_t *desc = new (ptr_desc) mem_buf_desc_t(ptr_buff, buf_size); + desc->serial_num = i; + desc->p_desc_owner = owner; +diff -up libvma-8.0.1/src/vma/infra/subject_observer.cpp.me libvma-8.0.1/src/vma/infra/subject_observer.cpp +--- libvma-8.0.1/src/vma/infra/subject_observer.cpp.me 2018-02-06 17:38:01.739951162 +0100 ++++ libvma-8.0.1/src/vma/infra/subject_observer.cpp 2018-02-06 17:38:43.712031849 +0100 +@@ -52,11 +52,11 @@ bool subject::register_observer(IN const + } + + auto_unlocker lock(m_lock); +- if (m_observers.count((observer * const)new_observer) > 0) { ++ if (m_observers.count((observer *)new_observer) > 0) { + // sub_obs_logdbg("[%s] Observer is already registered (%p)", to_str(), new_observer); + return false; + } +- m_observers.insert((observer * const)new_observer); ++ m_observers.insert((observer *)new_observer); + // sub_obs_logdbg("[%s] Successfully registered new_observer %s", to_str(), new_observer->to_str()); + return true; + } +@@ -69,7 +69,7 @@ bool subject::unregister_observer(IN con + } + + auto_unlocker lock(m_lock); +- m_observers.erase((observer * const)old_observer); ++ m_observers.erase((observer *)old_observer); + // sub_obs_logdbg("[%s] Successfully unregistered old_observer %s",to_str(), old_observer->to_str()); + return true; + } +diff -up libvma-8.0.1/src/vma/proto/L2_address.h.me libvma-8.0.1/src/vma/proto/L2_address.h +--- libvma-8.0.1/src/vma/proto/L2_address.h.me 2018-02-06 16:40:59.152129368 +0100 ++++ libvma-8.0.1/src/vma/proto/L2_address.h 2018-02-06 16:49:34.787559057 +0100 +@@ -59,7 +59,7 @@ public: + void set(address_t const address, addrlen_t const len); + + addrlen_t get_addrlen() const { return m_len; }; +- address_t get_address() const { return (const address_t)m_p_raw_address; }; ++ address_t get_address() const { return (address_t) m_p_raw_address; }; + + virtual bool compare(L2_address const& other) const; + +diff -up libvma-8.0.1/src/vma/proto/mem_buf_desc.h.me libvma-8.0.1/src/vma/proto/mem_buf_desc.h +diff -up libvma-8.0.1/src/vma/proto/route_rule_table_key.h.me libvma-8.0.1/src/vma/proto/route_rule_table_key.h +--- libvma-8.0.1/src/vma/proto/route_rule_table_key.h.me 2018-02-06 17:17:44.241168404 +0100 ++++ libvma-8.0.1/src/vma/proto/route_rule_table_key.h 2018-02-06 17:34:50.072582707 +0100 +@@ -36,6 +36,7 @@ + + #include + #include ++#include + + #include "vma/util/to_str.h" + #include "vma/util/vtypes.h" +@@ -53,13 +54,18 @@ public: + + const std::string to_str() const + { +- char s[100]; ++ char s[100] = {0}; + sprintf(s, "Destination IP:%d.%d.%d.%d", NIPQUAD(m_dst_ip)); +- if (m_src_ip) +- sprintf(s, "%s Source IP:%d.%d.%d.%d", s, NIPQUAD(m_src_ip)); +- if (m_tos) +- sprintf(s, "%s TOS:%u", s, m_tos); +- ++ if (m_src_ip) { ++ char sx[40] = {0}; ++ sprintf(sx, " Source IP:%d.%d.%d.%d", NIPQUAD(m_src_ip)); ++ strcat(s, sx); ++ } ++ if (m_tos) { ++ char sx[20] = {0}; ++ sprintf(sx, " TOS:%u", m_tos); ++ strcat(s, sx); ++ } + return(std::string(s)); + } + +@@ -85,16 +91,22 @@ public: + size_t operator()(const route_rule_table_key &key) const + { + hash_hash; +- char s[40]; ++ char s[40] = {0}; + /* + Build string from exist parameter (destination IP, source IP, TOS) + which is unique for different route-rule entries. + */ + sprintf(s, "%d.%d.%d.%d", NIPQUAD(key.get_dst_ip())); +- if (key.get_src_ip()) +- sprintf(s, "%s %d.%d.%d.%d", s, NIPQUAD(key.get_src_ip())); +- if (key.get_tos()) +- sprintf(s, "%s %u", s, key.get_tos()); ++ if (key.get_src_ip()) { ++ char sx[20] = {0}; ++ sprintf(sx, " %d.%d.%d.%d", NIPQUAD(key.get_src_ip())); ++ strcat(s, sx); ++ } ++ if (key.get_tos()) { ++ char sx[20] = {0}; ++ sprintf(sx, " %u", key.get_tos()); ++ strcat(s, sx); ++ } + return _hash(std::string(s));// Use built in hash function for string input. + } + }; +diff -up libvma-8.0.1/src/vma/sock/pipeinfo.cpp.me libvma-8.0.1/src/vma/sock/pipeinfo.cpp +--- libvma-8.0.1/src/vma/sock/pipeinfo.cpp.me 2018-02-06 17:36:50.905814995 +0100 ++++ libvma-8.0.1/src/vma/sock/pipeinfo.cpp 2018-02-06 17:37:33.543896959 +0100 +@@ -72,7 +72,7 @@ pipeinfo::pipeinfo(int fd) : socket_fd_a + // pi_logdbg("Got NULL from mce_stats_instance_create_socket_block, using local member"); + m_p_socket_stats = &m_socket_stats; + } +- memset(m_p_socket_stats, 0, sizeof(*m_p_socket_stats)); ++ memset(static_cast(m_p_socket_stats), 0, sizeof(*m_p_socket_stats)); + m_p_socket_stats->fd = m_fd; + m_p_socket_stats->b_blocking = m_b_blocking; + m_p_socket_stats->n_rx_ready_pkt_count = 0; +diff -up libvma-8.0.1/src/vma/sock/sockinfo.cpp.me libvma-8.0.1/src/vma/sock/sockinfo.cpp +--- libvma-8.0.1/src/vma/sock/sockinfo.cpp.me 2018-02-06 17:35:47.210692547 +0100 ++++ libvma-8.0.1/src/vma/sock/sockinfo.cpp 2018-02-06 17:36:07.360731283 +0100 +@@ -85,7 +85,7 @@ sockinfo::sockinfo(int fd): + + m_p_socket_stats = &m_socket_stats; // Save stats as local copy and allow state publisher to copy from this location + vma_stats_instance_create_socket_block(m_p_socket_stats); +- memset(m_p_socket_stats, 0, sizeof(*m_p_socket_stats)); ++ memset(static_cast(m_p_socket_stats), 0, sizeof(*m_p_socket_stats)); + m_p_socket_stats->fd = m_fd; + m_p_socket_stats->inode = fd2inode(m_fd); + m_p_socket_stats->b_blocking = m_b_blocking; +diff -up libvma-8.0.1/src/vma/util/sys_vars.h.me libvma-8.0.1/src/vma/util/sys_vars.h diff --git a/libvma.spec b/libvma.spec index 8d31ff2..2b1537b 100644 --- a/libvma.spec +++ b/libvma.spec @@ -9,11 +9,14 @@ Source: http://www.mellanox.com/downloads/Accelerator/%{name}-%{version}.tar.gz #arm is excluded since libvma fails to compile on arm. #Reason: libvma uses assembly commands that are not supported by arm. Patch0: libvma-8.0.1-gcc7.patch +Patch1: libvma-8.0.1-gcc8.patch ExcludeArch: %{arm} Requires: pam Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig - +# rdma-core doesn't not exist on s390x. need to check later +# disable it temporary +ExcludeArch: s390x BuildRequires: rdma-core-devel libnl3-devel BuildRequires: automake autoconf libtool @@ -45,6 +48,7 @@ Tools for collecting and analyzing libvma statistic. %prep %setup -q %patch0 -p1 -b .gcc7 +%patch1 -p1 -b .gcc8 %build ./autogen.sh @@ -76,8 +80,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la %changelog * Mon Feb 05 2018 Than Ngo - 8.0.1-5 -- fixed FTBS with gcc7 -- drop BR on dead packages libibverbs,librdmacm, add BR on rdma-core-devel +- fixed FTBS with gcc7/gcc8 * Thu Aug 03 2017 Fedora Release Engineering - 8.0.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild