commit 594f29a7baaf87c241c525c18acb2613da6715d2 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:58:18 2019 -0400 Package init diff --git a/6000-lib-talloc-Fix-undefined-behavior-in-talloc_memdup.patch b/6000-lib-talloc-Fix-undefined-behavior-in-talloc_memdup.patch new file mode 100644 index 0000000..dab574c --- /dev/null +++ b/6000-lib-talloc-Fix-undefined-behavior-in-talloc_memdup.patch @@ -0,0 +1,39 @@ +From eabe6d534c5c8c6ca38f3dc846f17aad6395da8c Mon Sep 17 00:00:00 2001 +From: Andreas Schneider +Date: Thu, 22 Nov 2018 16:10:39 +0100 +Subject: [PATCH 09/28] lib:talloc: Fix undefined behavior in talloc_memdup + +lib/talloc/talloc.c:2419: runtime error: null pointer passed as argument +2, which is declared to never be null + +Signed-off-by: Andreas Schneider +Reviewed-by: Volker Lendecke +Signed-off-by: root +--- + talloc.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/talloc.c b/talloc.c +index 54be63495ae..073a3e50d4b 100644 +--- a/talloc.c ++++ b/talloc.c +@@ -2413,9 +2413,14 @@ _PUBLIC_ void *_talloc_zero(const void *ctx, size_t size, const char *name) + */ + _PUBLIC_ void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name) + { +- void *newp = _talloc_named_const(t, size, name); ++ void *newp = NULL; + +- if (likely(newp)) { ++ if (likely(size > 0) && unlikely(p == NULL)) { ++ return NULL; ++ } ++ ++ newp = _talloc_named_const(t, size, name); ++ if (likely(newp != NULL) && likely(size > 0)) { + memcpy(newp, p, size); + } + +-- +2.19.1 + diff --git a/6001-talloc-Fix-alignment-issues-for-casting-pointers.patch b/6001-talloc-Fix-alignment-issues-for-casting-pointers.patch new file mode 100644 index 0000000..a9b2038 --- /dev/null +++ b/6001-talloc-Fix-alignment-issues-for-casting-pointers.patch @@ -0,0 +1,106 @@ +From b2c2c4c3e6c4538c62cbcf03923bd7536292f7e9 Mon Sep 17 00:00:00 2001 +From: Andreas Schneider +Date: Fri, 12 Oct 2018 11:58:26 +0200 +Subject: [PATCH 16/28] talloc: Fix alignment issues for casting pointers + +warning: cast from 'char *' to 'struct talloc_chunk *' increases required +alignment from 1 to 8 + +Signed-off-by: Andreas Schneider +Reviewed-by: Volker Lendecke + +Autobuild-User(master): Andreas Schneider +Autobuild-Date(master): Tue Mar 19 12:38:50 UTC 2019 on sn-devel-144 + +Signed-off-by: root +--- + talloc.c | 30 +++++++++++++++++++++++++----- + 1 file changed, 25 insertions(+), 5 deletions(-) + +diff --git a/talloc.c b/talloc.c +index 073a3e50d4b..518ffbdbfdf 100644 +--- a/talloc.c ++++ b/talloc.c +@@ -317,6 +317,11 @@ struct talloc_chunk { + struct talloc_pool_hdr *pool; + }; + ++union talloc_chunk_cast_u { ++ uint8_t *ptr; ++ struct talloc_chunk *chunk; ++}; ++ + /* 16 byte alignment seems to keep everyone happy */ + #define TC_ALIGN16(s) (((s)+15)&~15) + #define TC_HDR_SIZE TC_ALIGN16(sizeof(struct talloc_chunk)) +@@ -611,16 +616,25 @@ struct talloc_pool_hdr { + size_t poolsize; + }; + ++union talloc_pool_hdr_cast_u { ++ uint8_t *ptr; ++ struct talloc_pool_hdr *hdr; ++}; ++ + #define TP_HDR_SIZE TC_ALIGN16(sizeof(struct talloc_pool_hdr)) + + static inline struct talloc_pool_hdr *talloc_pool_from_chunk(struct talloc_chunk *c) + { +- return (struct talloc_pool_hdr *)((char *)c - TP_HDR_SIZE); ++ union talloc_chunk_cast_u tcc = { .chunk = c }; ++ union talloc_pool_hdr_cast_u tphc = { tcc.ptr - TP_HDR_SIZE }; ++ return tphc.hdr; + } + + static inline struct talloc_chunk *talloc_chunk_from_pool(struct talloc_pool_hdr *h) + { +- return (struct talloc_chunk *)((char *)h + TP_HDR_SIZE); ++ union talloc_pool_hdr_cast_u tphc = { .hdr = h }; ++ union talloc_chunk_cast_u tcc = { .ptr = tphc.ptr + TP_HDR_SIZE }; ++ return tcc.chunk; + } + + static inline void *tc_pool_end(struct talloc_pool_hdr *pool_hdr) +@@ -668,6 +682,7 @@ static inline struct talloc_chunk *tc_alloc_pool(struct talloc_chunk *parent, + size_t size, size_t prefix_len) + { + struct talloc_pool_hdr *pool_hdr = NULL; ++ union talloc_chunk_cast_u tcc; + size_t space_left; + struct talloc_chunk *result; + size_t chunk_size; +@@ -698,7 +713,10 @@ static inline struct talloc_chunk *tc_alloc_pool(struct talloc_chunk *parent, + return NULL; + } + +- result = (struct talloc_chunk *)((char *)pool_hdr->end + prefix_len); ++ tcc = (union talloc_chunk_cast_u) { ++ .ptr = ((uint8_t *)pool_hdr->end) + prefix_len ++ }; ++ result = tcc.chunk; + + #if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED) + VALGRIND_MAKE_MEM_UNDEFINED(pool_hdr->end, chunk_size); +@@ -750,7 +768,8 @@ static inline void *__talloc_with_prefix(const void *context, + } + + if (tc == NULL) { +- char *ptr; ++ uint8_t *ptr = NULL; ++ union talloc_chunk_cast_u tcc; + + /* + * Only do the memlimit check/update on actual allocation. +@@ -764,7 +783,8 @@ static inline void *__talloc_with_prefix(const void *context, + if (unlikely(ptr == NULL)) { + return NULL; + } +- tc = (struct talloc_chunk *)(ptr + prefix_len); ++ tcc = (union talloc_chunk_cast_u) { .ptr = ptr + prefix_len }; ++ tc = tcc.chunk; + tc->flags = talloc_magic; + tc->pool = NULL; + +-- +2.19.1 + diff --git a/libtalloc.spec b/libtalloc.spec new file mode 100644 index 0000000..393b3dc --- /dev/null +++ b/libtalloc.spec @@ -0,0 +1,157 @@ +Name: libtalloc +Version: 2.1.14 +Release: 4 +Summary: A memory pool system +License: LGPLv3+ +URL: https://talloc.samba.org/talloc/doc/html/index.html +Source: https://www.samba.org/ftp/talloc/talloc-%{version}.tar.gz + +Patch6000: 6000-lib-talloc-Fix-undefined-behavior-in-talloc_memdup.patch +Patch6001: 6001-talloc-Fix-alignment-issues-for-casting-pointers.patch + +BuildRequires: gcc git docbook-style-xsl python2-devel python3-devel doxygen + +Provides: bundled(libreplace) + +# Patches + +%description +A hierarchical, reference counted memory pool system with destructors + +%package -n libtalloc-devel +Summary: Files for libtalloc development +Requires: libtalloc = %{version}-%{release} + +%description -n libtalloc-devel +Files for libtalloc development + +%package help +Summary: Including man files for libtalloc +Requires: man + +%description help +This contains man files for the using of libtalloc + + +%package -n python2-talloc +Summary: Provide the python rely for libtalloc +Requires: libtalloc = %{version}-%{release} +Provides: pytalloc%{?_isa} = %{version}-%{release} +Provides: pytalloc = %{version}-%{release} +Obsoletes: pytalloc < 2.1.3 +%{?python_provide:%python_provide python2-talloc} + +%description -n python2-talloc +Provide the python 2 when using the libtalloc + +%package -n python2-talloc-devel +Summary: Files for python2-talloc development +Requires: python2-talloc = %{version}-%{release} +Provides: pytalloc-devel%{?_isa} = %{version}-%{release} +Provides: pytalloc-devel = %{version}-%{release} +Obsoletes: pytalloc-devel < 2.1.3 +%{?python_provide:%python_provide python2-talloc-devel} + +%description -n python2-talloc-devel +Files for python2-talloc development + +%package -n python3-talloc +Summary: Provide the python rely for libtalloc +Requires: libtalloc = %{version}-%{release} +%{?python_provide:%python_provide python3-talloc} + +%description -n python3-talloc +Provide the python 3 when using the libtalloc + +%package -n python3-talloc-devel +Summary: Files for python3-talloc development +Requires: python3-talloc = %{version}-%{release} +%{?python_provide:%python_provide python3-talloc-devel} + +%description -n python3-talloc-devel +Files for python3-talloc development + +%prep +%autosetup -n talloc-%{version} -p1 + +%build +export python_LDFLAGS="" + +pathfix.py -n -p -i %{__python2} buildtools/bin/waf + +%configure --disable-rpath \ + --disable-rpath-install \ + --bundled-libraries=NONE \ + --builtin-libraries=replace \ + --disable-silent-rules \ + --extra-python=%{__python3} + +%make_build V=1 +doxygen doxy.config + +%check +%make_build check + +%install +%make_install + +find $RPM_BUILD_ROOT -name "*.so*" -exec chmod -c +x {} \; + +rm -f $RPM_BUILD_ROOT%{_libdir}/libtalloc.a +rm -f $RPM_BUILD_ROOT/usr/share/swig/*/talloc.i + +mkdir -p $RPM_BUILD_ROOT/%{_mandir} + +cp -a doc/man/* $RPM_BUILD_ROOT/%{_mandir} + +%files +%{_libdir}/libtalloc.so.* + +%files devel +%{_includedir}/talloc.h +%{_libdir}/libtalloc.so +%{_libdir}/pkgconfig/talloc.pc + +%files help +%{_mandir}/man3/* + +%files -n python2-talloc +%{_libdir}/libpytalloc-util.so.* +%{python2_sitearch}/talloc.so + +%files -n python2-talloc-devel +%{_includedir}/pytalloc.h +%{_libdir}/pkgconfig/pytalloc-util.pc +%{_libdir}/libpytalloc-util.so + +%files -n python3-talloc +%{_libdir}/libpytalloc-util.cpython*.so.* +%{python3_sitearch}/talloc.cpython*.so + +%files -n python3-talloc-devel +%{_includedir}/pytalloc.h +%{_libdir}/pkgconfig/pytalloc-util.cpython-*.pc +%{_libdir}/libpytalloc-util.cpython*.so + +%ldconfig_scriptlets + +%ldconfig_scriptlets -n python2-talloc + +%ldconfig_scriptlets -n python3-talloc + +%changelog +* Tue Sep 3 2019 shidongdong - 2.1.14-4 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:openEuler Debranding + +* Tue Aug 20 2019 zhanghaibo - 2.1.14-3 +- correct patch name + +* Wed Apr 17 2019 gaoyi - 2.1.14-2.h1 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: backport patches from https://github.com/samba-team/samba +- Package init diff --git a/talloc-2.1.14.tar.gz b/talloc-2.1.14.tar.gz new file mode 100644 index 0000000..8591a71 Binary files /dev/null and b/talloc-2.1.14.tar.gz differ