Compare commits
10 Commits
560c773a7a
...
f3522f24eb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3522f24eb | ||
|
|
849aa15cdd | ||
|
|
97a67288e5 | ||
|
|
0bbaf4515d | ||
|
|
ede1479bb0 | ||
|
|
796af7ebfb | ||
|
|
316ad04cca | ||
|
|
2e4233441e | ||
|
|
54b19e2873 | ||
|
|
6d089c5519 |
@ -1,39 +0,0 @@
|
|||||||
From eabe6d534c5c8c6ca38f3dc846f17aad6395da8c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andreas Schneider <asn@samba.org>
|
|
||||||
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 <asn@samba.org>
|
|
||||||
Reviewed-by: Volker Lendecke <vl@samba.org>
|
|
||||||
Signed-off-by: root <root@localhost.localdomain>
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
||||||
@ -1,106 +0,0 @@
|
|||||||
From b2c2c4c3e6c4538c62cbcf03923bd7536292f7e9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andreas Schneider <asn@samba.org>
|
|
||||||
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 <asn@samba.org>
|
|
||||||
Reviewed-by: Volker Lendecke <vl@samba.org>
|
|
||||||
|
|
||||||
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
|
|
||||||
Autobuild-Date(master): Tue Mar 19 12:38:50 UTC 2019 on sn-devel-144
|
|
||||||
|
|
||||||
Signed-off-by: root <root@localhost.localdomain>
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
||||||
@ -1,19 +1,14 @@
|
|||||||
Name: libtalloc
|
Name: libtalloc
|
||||||
Version: 2.1.14
|
Version: 2.3.4
|
||||||
Release: 4
|
Release: 1
|
||||||
Summary: A memory pool system
|
Summary: A memory pool system
|
||||||
License: LGPLv3+
|
License: LGPLv3+
|
||||||
URL: https://talloc.samba.org/talloc/doc/html/index.html
|
URL: https://talloc.samba.org/talloc/doc/html/index.html
|
||||||
Source: https://www.samba.org/ftp/talloc/talloc-%{version}.tar.gz
|
Source0: 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
|
|
||||||
|
|
||||||
|
BuildRequires: gcc git docbook-style-xsl python3-devel doxygen
|
||||||
Provides: bundled(libreplace)
|
Provides: bundled(libreplace)
|
||||||
|
Obsoletes: python2-talloc, python2-talloc-devel
|
||||||
# Patches
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
A hierarchical, reference counted memory pool system with destructors
|
A hierarchical, reference counted memory pool system with destructors
|
||||||
@ -32,29 +27,6 @@ Requires: man
|
|||||||
%description help
|
%description help
|
||||||
This contains man files for the using of libtalloc
|
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
|
%package -n python3-talloc
|
||||||
Summary: Provide the python rely for libtalloc
|
Summary: Provide the python rely for libtalloc
|
||||||
Requires: libtalloc = %{version}-%{release}
|
Requires: libtalloc = %{version}-%{release}
|
||||||
@ -72,19 +44,13 @@ Requires: python3-talloc = %{version}-%{release}
|
|||||||
Files for python3-talloc development
|
Files for python3-talloc development
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n talloc-%{version} -p1
|
%autosetup -n talloc-%{version} -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export python_LDFLAGS=""
|
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
|
||||||
%configure --disable-rpath \
|
|
||||||
--disable-rpath-install \
|
|
||||||
--bundled-libraries=NONE \
|
|
||||||
--builtin-libraries=replace \
|
|
||||||
--disable-silent-rules \
|
|
||||||
--extra-python=%{__python3}
|
|
||||||
|
|
||||||
%make_build V=1
|
%make_build V=1
|
||||||
doxygen doxy.config
|
doxygen doxy.config
|
||||||
@ -113,16 +79,7 @@ cp -a doc/man/* $RPM_BUILD_ROOT/%{_mandir}
|
|||||||
%{_libdir}/pkgconfig/talloc.pc
|
%{_libdir}/pkgconfig/talloc.pc
|
||||||
|
|
||||||
%files help
|
%files help
|
||||||
%{_mandir}/man3/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%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
|
%files -n python3-talloc
|
||||||
%{_libdir}/libpytalloc-util.cpython*.so.*
|
%{_libdir}/libpytalloc-util.cpython*.so.*
|
||||||
@ -134,12 +91,24 @@ cp -a doc/man/* $RPM_BUILD_ROOT/%{_mandir}
|
|||||||
%{_libdir}/libpytalloc-util.cpython*.so
|
%{_libdir}/libpytalloc-util.cpython*.so
|
||||||
|
|
||||||
%ldconfig_scriptlets
|
%ldconfig_scriptlets
|
||||||
|
|
||||||
%ldconfig_scriptlets -n python2-talloc
|
|
||||||
|
|
||||||
%ldconfig_scriptlets -n python3-talloc
|
%ldconfig_scriptlets -n python3-talloc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 09 2022 tianlijing <tianlijing@kylinos.cn> - 2.3.4-1
|
||||||
|
- update to 2.3.4
|
||||||
|
|
||||||
|
* Wed Nov 17 2021 Wenchao Hao <haowenchao@huawei.com> - 2.3.3-1
|
||||||
|
- update to v2.3.3 version
|
||||||
|
|
||||||
|
* Thu Jul 16 2020 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 2.3.1-1
|
||||||
|
- update to v2.3.1 version
|
||||||
|
|
||||||
|
* Mon Feb 10 2020 Ruijun Ge <geruijun@huawei.com> - 2.3.0-0
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:update package
|
||||||
|
|
||||||
* Tue Sep 3 2019 shidongdong <shidongdong5@huawei.com> - 2.1.14-4
|
* Tue Sep 3 2019 shidongdong <shidongdong5@huawei.com> - 2.1.14-4
|
||||||
- Type:enhancement
|
- Type:enhancement
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
4
libtalloc.yaml
Normal file
4
libtalloc.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version_control: github
|
||||||
|
src_repo: nccgroup/libtalloc
|
||||||
|
tag_prefix: talloc-
|
||||||
|
seperator: "."
|
||||||
Binary file not shown.
BIN
talloc-2.3.4.tar.gz
Normal file
BIN
talloc-2.3.4.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user