Hello community, here is the log from the commit of package talloc for openSUSE:Factory checked in at 2015-10-28 17:29:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/talloc (Old) and /work/SRC/openSUSE:Factory/.talloc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "talloc" Changes: -------- --- /work/SRC/openSUSE:Factory/talloc/talloc.changes 2015-09-19 06:53:40.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.talloc.new/talloc.changes 2015-10-28 17:30:00.000000000 +0100 @@ -1,0 +2,19 @@ +Sat Oct 24 21:19:20 UTC 2015 - lmue...@suse.com + +- Add python3-talloc and python3-talloc-devel; (bsc#951911). + +------------------------------------------------------------------- +Thu Oct 22 20:41:47 UTC 2015 - lmue...@suse.com + +- Rename pytalloc to python-talloc. + +------------------------------------------------------------------- +Thu Oct 22 18:07:41 UTC 2015 - lmue...@suse.com + +- Update to 2.1.4; (bsc#951660). + + Test that talloc magic differs between processes. + + Increment minor version due to added talloc_test_get_magic. + + Provide tests access to talloc_magic. + + Test magic protection measures. + +------------------------------------------------------------------- Old: ---- talloc-2.1.3.tar.asc talloc-2.1.3.tar.gz New: ---- talloc-2.1.4.tar.asc talloc-2.1.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ talloc.spec ++++++ --- /var/tmp/diff_new_pack.VVsHHt/_old 2015-10-28 17:30:01.000000000 +0100 +++ /var/tmp/diff_new_pack.VVsHHt/_new 2015-10-28 17:30:01.000000000 +0100 @@ -17,6 +17,12 @@ %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%{!?py3_soflags: %global py3_soflags cpython-%{python3_version_nodots}m} +%if 0%{?suse_version} > 1310 || 0%{?fedora_version} > 20 +%define with_python3 1 +%else +%define with_python3 0 +%endif Name: talloc %if 0%{?suse_version} == 0 || 0%{?suse_version} > 1140 @@ -33,11 +39,14 @@ BuildRequires: pkgconfig %endif BuildRequires: python-devel +%if %{with_python3} +BuildRequires: python3-devel +%endif %if 0%{?suse_version} > 1100 #!BuildIgnore: python %endif Url: http://talloc.samba.org/ -Version: 2.1.3 +Version: 2.1.4 Release: 0 PreReq: /sbin/ldconfig Summary: Samba talloc Library @@ -90,30 +99,61 @@ Libraries and Header Files to Develop Programs with talloc2 Support -%package -n pytalloc +%package -n python-talloc Summary: Python bindings for the Talloc library Group: Development/Libraries/Python Requires: %{libtalloc_name} = %{version} PreReq: /sbin/ldconfig +Provides: pytalloc = %{version} +Obsoletes: pytalloc < %{version} -%description -n pytalloc +%description -n python-talloc This package contains the python bindings for the Talloc library. -%package -n pytalloc-devel +%package -n python-talloc-devel Summary: Developer tools for the Talloc library Group: Development/Libraries/Python -Requires: pytalloc = %{version} +Requires: python-talloc = %{version} %if 0%{?suse_version} > 1020 Requires: pkg-config %else Requires: pkgconfig %endif +Provides: pytalloc-devel = %{version} +Obsoletes: pytalloc-devel < %{version} +Conflicts: python3-talloc-devel + +%description -n python-talloc-devel +Libraries and Header Files to Develop Programs with python-talloc Support + + +%if %{with_python3} +%package -n python3-talloc +Summary: Python3 bindings for the Talloc library +Group: Development/Libraries/Python +Requires: %{libtalloc_name} = %{version} +PreReq: /sbin/ldconfig -%description -n pytalloc-devel -Libraries and Header Files to Develop Programs with pytalloc Support +%description -n python3-talloc +This package contains the python3 bindings for the Talloc library. +%package -n python3-talloc-devel +Summary: Developer tools for the Talloc library +Group: Development/Libraries/Python +Requires: python3-talloc = %{version} +%if 0%{?suse_version} > 1020 +Requires: pkg-config +%else +Requires: pkgconfig +%endif +Conflicts: python-talloc-devel + +%description -n python3-talloc-devel +Libraries and Header Files to Develop Programs with python3-talloc Support +%endif + %prep %setup -n talloc-%{version} -q @@ -131,6 +171,9 @@ --disable-rpath \ --bundled-libraries=NONE \ --builtin-libraries=replace \ +%if %{with_python3} + --extra-python=/usr/bin/python3 \ +%endif " ./configure ${CONFIGURE_OPTIONS} %{__make} %{build_make_smp_mflags} \ @@ -147,9 +190,15 @@ %postun -n %{libtalloc_name} -p /sbin/ldconfig -%post -n pytalloc -p /sbin/ldconfig +%post -n python-talloc -p /sbin/ldconfig -%postun -n pytalloc -p /sbin/ldconfig +%postun -n python-talloc -p /sbin/ldconfig + +%if %{with_python3} +%post -n python3-talloc -p /sbin/ldconfig + +%postun -n python3-talloc -p /sbin/ldconfig +%endif %files -n %{libtalloc_name} %defattr(-,root,root) @@ -164,15 +213,28 @@ %{_mandir}/man3/talloc.3* %endif -%files -n pytalloc +%files -n python-talloc %defattr(-,root,root) %{_libdir}/libpytalloc-util.so.* %{python_sitearch}/talloc.so -%files -n pytalloc-devel -%defattr(-,root,root,-) +%files -n python-talloc-devel +%defattr(-,root,root) %{_includedir}/pytalloc.h %{_libdir}/pkgconfig/pytalloc-util.pc %{_libdir}/libpytalloc-util.so +%if %{with_python3} +%files -n python3-talloc +%defattr(-,root,root) +%{_libdir}/libpytalloc-util.%{py3_soflags}.so.* +%{python3_sitearch}/talloc.%{py3_soflags}.so + +%files -n python3-talloc-devel +%defattr(-,root,root) +%{_includedir}/pytalloc.h +%{_libdir}/pkgconfig/pytalloc-util.pc +%{_libdir}/libpytalloc-util.%{py3_soflags}.so +%endif + %changelog ++++++ baselibs.conf ++++++ --- /var/tmp/diff_new_pack.VVsHHt/_old 2015-10-28 17:30:01.000000000 +0100 +++ /var/tmp/diff_new_pack.VVsHHt/_new 2015-10-28 17:30:01.000000000 +0100 @@ -1,2 +1,4 @@ libtalloc2 -pytalloc +python-talloc + obsoletes "pytalloc-<targettype> < <version>" +python3-talloc ++++++ talloc-2.1.3.tar.gz -> talloc-2.1.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/ABI/pytalloc-util-2.1.4.sigs new/talloc-2.1.4/ABI/pytalloc-util-2.1.4.sigs --- old/talloc-2.1.3/ABI/pytalloc-util-2.1.4.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.4/ABI/pytalloc-util-2.1.4.sigs 2015-10-13 14:20:30.000000000 +0200 @@ -0,0 +1,6 @@ +pytalloc_CObject_FromTallocPtr: PyObject *(void *) +pytalloc_Check: int (PyObject *) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/ABI/talloc-2.1.4.sigs new/talloc-2.1.4/ABI/talloc-2.1.4.sigs --- old/talloc-2.1.3/ABI/talloc-2.1.4.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.4/ABI/talloc-2.1.4.sigs 2015-10-13 14:20:30.000000000 +0200 @@ -0,0 +1,65 @@ +_talloc: void *(const void *, size_t) +_talloc_array: void *(const void *, size_t, unsigned int, const char *) +_talloc_free: int (void *, const char *) +_talloc_get_type_abort: void *(const void *, const char *, const char *) +_talloc_memdup: void *(const void *, const void *, size_t, const char *) +_talloc_move: void *(const void *, const void *) +_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) +_talloc_realloc: void *(const void *, void *, size_t, const char *) +_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_reference_loc: void *(const void *, const void *, const char *) +_talloc_set_destructor: void (const void *, int (*)(void *)) +_talloc_steal_loc: void *(const void *, const void *, const char *) +_talloc_zero: void *(const void *, size_t, const char *) +_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) +talloc_asprintf: char *(const void *, const char *, ...) +talloc_asprintf_append: char *(char *, const char *, ...) +talloc_asprintf_append_buffer: char *(char *, const char *, ...) +talloc_autofree_context: void *(void) +talloc_check_name: void *(const void *, const char *) +talloc_disable_null_tracking: void (void) +talloc_enable_leak_report: void (void) +talloc_enable_leak_report_full: void (void) +talloc_enable_null_tracking: void (void) +talloc_enable_null_tracking_no_autofree: void (void) +talloc_find_parent_byname: void *(const void *, const char *) +talloc_free_children: void (void *) +talloc_get_name: const char *(const void *) +talloc_get_size: size_t (const void *) +talloc_increase_ref_count: int (const void *) +talloc_init: void *(const char *, ...) +talloc_is_parent: int (const void *, const void *) +talloc_named: void *(const void *, size_t, const char *, ...) +talloc_named_const: void *(const void *, size_t, const char *) +talloc_parent: void *(const void *) +talloc_parent_name: const char *(const void *) +talloc_pool: void *(const void *, size_t) +talloc_realloc_fn: void *(const void *, void *, size_t) +talloc_reference_count: size_t (const void *) +talloc_reparent: void *(const void *, const void *, const void *) +talloc_report: void (const void *, FILE *) +talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) +talloc_report_depth_file: void (const void *, int, int, FILE *) +talloc_report_full: void (const void *, FILE *) +talloc_set_abort_fn: void (void (*)(const char *)) +talloc_set_log_fn: void (void (*)(const char *)) +talloc_set_log_stderr: void (void) +talloc_set_memlimit: int (const void *, size_t) +talloc_set_name: const char *(const void *, const char *, ...) +talloc_set_name_const: void (const void *, const char *) +talloc_show_parents: void (const void *, FILE *) +talloc_strdup: char *(const void *, const char *) +talloc_strdup_append: char *(char *, const char *) +talloc_strdup_append_buffer: char *(char *, const char *) +talloc_strndup: char *(const void *, const char *, size_t) +talloc_strndup_append: char *(char *, const char *, size_t) +talloc_strndup_append_buffer: char *(char *, const char *, size_t) +talloc_test_get_magic: int (void) +talloc_total_blocks: size_t (const void *) +talloc_total_size: size_t (const void *) +talloc_unlink: int (const void *, void *) +talloc_vasprintf: char *(const void *, const char *, va_list) +talloc_vasprintf_append: char *(char *, const char *, va_list) +talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) +talloc_version_major: int (void) +talloc_version_minor: int (void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/configure_file.py new/talloc-2.1.4/buildtools/wafsamba/configure_file.py --- old/talloc-2.1.3/buildtools/wafsamba/configure_file.py 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/configure_file.py 2015-10-03 11:13:50.000000000 +0200 @@ -7,12 +7,8 @@ '''substiture @VAR@ style variables in a file''' env = task.env - src = task.inputs[0].srcpath(env) - tgt = task.outputs[0].bldpath(env) + s = task.inputs[0].read() - f = open(src, 'r') - s = f.read() - f.close() # split on the vars a = re.split('(@\w+@)', s) out = [] @@ -27,9 +23,7 @@ v = SUBST_VARS_RECURSIVE(task.env[vname], task.env) out.append(v) contents = ''.join(out) - f = open(tgt, 'w') - s = f.write(contents) - f.close() + task.outputs[0].write(contents) return 0 def CONFIGURE_FILE(bld, in_file, **kwargs): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/pkgconfig.py new/talloc-2.1.4/buildtools/wafsamba/pkgconfig.py --- old/talloc-2.1.3/buildtools/wafsamba/pkgconfig.py 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/pkgconfig.py 2015-10-03 11:13:50.000000000 +0200 @@ -5,12 +5,8 @@ def subst_at_vars(task): '''substiture @VAR@ style variables in a file''' - src = task.inputs[0].srcpath(task.env) - tgt = task.outputs[0].bldpath(task.env) - f = open(src, 'r') - s = f.read() - f.close() + s = task.inputs[0].read() # split on the vars a = re.split('(@\w+@)', s) out = [] @@ -37,9 +33,7 @@ break out.append(v) contents = ''.join(out) - f = open(tgt, 'w') - s = f.write(contents) - f.close() + task.outputs[0].write(contents) return 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_abi.py new/talloc-2.1.4/buildtools/wafsamba/samba_abi.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_abi.py 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_abi.py 2015-10-03 11:13:50.000000000 +0200 @@ -147,12 +147,10 @@ def abi_process_file(fname, version, symmap): '''process one ABI file, adding new symbols to the symmap''' - f = open(fname, mode='r') - for line in f: + for line in Utils.readf(fname).splitlines(): symname = line.split(":")[0] if not symname in symmap: symmap[symname] = version - f.close() def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_autoconf.py new/talloc-2.1.4/buildtools/wafsamba/samba_autoconf.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_autoconf.py 2015-06-13 03:01:31.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_autoconf.py 2015-10-03 11:13:50.000000000 +0200 @@ -657,9 +657,23 @@ if not IN_LAUNCH_DIR(conf): return - if conf.CHECK_CFLAGS(['-fstack-protector']) and conf.CHECK_LDFLAGS(['-fstack-protector']): - conf.ADD_CFLAGS('-fstack-protector') - conf.ADD_LDFLAGS('-fstack-protector') + # we need to build real code that can't be optimized away to test + if conf.check(fragment=''' + #include <stdio.h> + + int main(void) + { + char t[100000]; + while (fgets(t, sizeof(t), stdin)); + return 0; + } + ''', + execute=0, + ccflags='-fstack-protector', + ldflags='-fstack-protector', + msg='Checking if toolchain accepts -fstack-protector'): + conf.ADD_CFLAGS('-fstack-protector') + conf.ADD_LDFLAGS('-fstack-protector') if Options.options.debug: conf.ADD_CFLAGS('-g', testflags=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_conftests.py new/talloc-2.1.4/buildtools/wafsamba/samba_conftests.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_conftests.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_conftests.py 2015-10-03 11:13:50.000000000 +0200 @@ -216,9 +216,7 @@ os.makedirs(subdir) - dest = open(os.path.join(subdir, 'liblc1.c'), 'w') - dest.write('#include <stdio.h>\nint lib_func(void) { FILE *f = fopen("foo", "r");}\n') - dest.close() + Utils.writef(os.path.join(subdir, 'liblc1.c'), '#include <stdio.h>\nint lib_func(void) { FILE *f = fopen("foo", "r");}\n') bld = Build.BuildContext() bld.log = conf.log @@ -291,13 +289,8 @@ os.makedirs(subdir) - dest = open(os.path.join(subdir, 'lib1.c'), 'w') - dest.write('int lib_func(void) { return 42; }\n') - dest.close() - - dest = open(os.path.join(dir, 'main.c'), 'w') - dest.write('int main(void) {return !(lib_func() == 42);}\n') - dest.close() + Utils.writef(os.path.join(subdir, 'lib1.c'), 'int lib_func(void) { return 42; }\n') + Utils.writef(os.path.join(dir, 'main.c'), 'int main(void) {return !(lib_func() == 42);}\n') bld = Build.BuildContext() bld.log = conf.log @@ -311,9 +304,7 @@ ldflags = [] if version_script: ldflags.append("-Wl,--version-script=%s/vscript" % bld.path.abspath()) - dest = open(os.path.join(dir,'vscript'), 'w') - dest.write('TEST_1.0A2 { global: *; };\n') - dest.close() + Utils.writef(os.path.join(dir,'vscript'), 'TEST_1.0A2 { global: *; };\n') bld(features='cc cshlib', source='libdir/lib1.c', @@ -383,15 +374,13 @@ if not os.path.exists(bdir): os.makedirs(bdir) - dest = open(os.path.join(bdir, 'Makefile.PL'), 'w') - dest.write(""" + Utils.writef(os.path.join(bdir, 'Makefile.PL'), """ use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'WafTest', 'EXE_FILES' => [ 'WafTest' ] ); """) - dest.close() back = os.path.abspath('.') os.chdir(bdir) proc = Utils.pproc.Popen(['perl', 'Makefile.PL'], @@ -406,9 +395,7 @@ return if section: - f = open(os.path.join(bdir,'Makefile'), 'r') - man = f.read() - f.close() + man = Utils.readf(os.path.join(bdir,'Makefile')) m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man) if not m: conf.check_message_2('not found', color='YELLOW') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_deps.py new/talloc-2.1.4/buildtools/wafsamba/samba_deps.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_deps.py 2015-07-21 22:32:32.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_deps.py 2015-10-03 11:13:50.000000000 +0200 @@ -47,7 +47,7 @@ # module_name = rpc_epmapper (a module within the dcerpc_server subsystem) # module = rpc_epmapper (a module object within the dcerpc_server subsystem) - subsystem = bld.name_to_obj(subsystem_name, bld.env) + subsystem = bld.get_tgen_by_name(subsystem_name) bld.ASSERT(subsystem is not None, "Unable to find subsystem %s" % subsystem_name) for d in subsystem_list[subsystem_name]: module_name = d['TARGET'] @@ -101,7 +101,7 @@ self.uselib = list(self.final_syslibs) self.uselib.extend(list(self.direct_syslibs)) for lib in self.final_libs: - t = self.bld.name_to_obj(lib, self.bld.env) + t = self.bld.get_tgen_by_name(lib) self.uselib.extend(list(t.final_syslibs)) self.uselib = unique_list(self.uselib) @@ -150,7 +150,7 @@ inc_abs = [] for d in inc_deps: - t = bld.name_to_obj(d, bld.env) + t = bld.get_tgen_by_name(d) bld.ASSERT(t is not None, "Unable to find dependency %s for %s" % (d, self.sname)) inclist = getattr(t, 'samba_includes_extended', [])[:] if getattr(t, 'local_include', True): @@ -214,6 +214,9 @@ if m is not None: modules.append(m) + if 'pyembed' in self.features: + return + sentinel = getattr(self, 'init_function_sentinel', 'NULL') targets = LOCAL_CACHE(bld, 'TARGET_TYPE') @@ -282,7 +285,7 @@ if not targets[t.sname] in [ 'LIBRARY', 'BINARY', 'PYTHON' ]: continue for obj in t.add_objects: - t2 = t.bld.name_to_obj(obj, bld.env) + t2 = t.bld.get_tgen_by_name(obj) source_set = getattr(t2, 'samba_source_set', set()) for s in source_set: if not s in subsystems: @@ -346,7 +349,7 @@ for t in tgt_list: tdeps = getattr(t, 'add_objects', []) + getattr(t, 'uselib_local', []) for d in tdeps: - t2 = bld.name_to_obj(d, bld.env) + t2 = bld.get_tgen_by_name(d) if t2 is None: continue map1 = grp_map[t.samba_group] @@ -429,7 +432,7 @@ global_deps = bld.env.GLOBAL_DEPENDENCIES global_deps_exclude = set() for dep in global_deps: - t = bld.name_to_obj(dep, bld.env) + t = bld.get_tgen_by_name(dep) for d in t.samba_deps: # prevent loops from the global dependencies list global_deps_exclude.add(d) @@ -469,7 +472,7 @@ implied, t.sname, targets[implied])) sys.exit(1) continue - t2 = bld.name_to_obj(d, bld.env) + t2 = bld.get_tgen_by_name(d) if t2 is None: Logs.error("no task %s of type %s in %s" % (d, targets[d], t.sname)) sys.exit(1) @@ -507,7 +510,7 @@ dependency_loop(loops, t, obj) continue chain.add(obj) - t2 = bld.name_to_obj(obj, bld.env) + t2 = bld.get_tgen_by_name(obj) r2 = indirect_libs(bld, t2, chain, loops) chain.remove(obj) ret = ret.union(t2.direct_libs) @@ -518,7 +521,7 @@ dependency_loop(loops, t, obj) continue chain.add(obj) - t2 = bld.name_to_obj(obj, bld.env) + t2 = bld.get_tgen_by_name(obj) r2 = indirect_libs(bld, t2, chain, loops) chain.remove(obj) ret = ret.union(t2.direct_libs) @@ -545,7 +548,7 @@ dependency_loop(loops, t, lib) continue chain.add(lib) - t2 = bld.name_to_obj(lib, bld.env) + t2 = bld.get_tgen_by_name(lib) r2 = indirect_objects(bld, t2, chain, loops) chain.remove(lib) ret = ret.union(t2.direct_objects) @@ -573,7 +576,7 @@ for lib in t.final_libs: if lib in chain: continue - t2 = bld.name_to_obj(lib, bld.env) + t2 = bld.get_tgen_by_name(lib) chain.add(lib) r2 = extended_objects(bld, t2, chain) chain.remove(lib) @@ -601,7 +604,7 @@ dependency_loop(inc_loops, t, obj) continue chain.add(obj) - t2 = bld.name_to_obj(obj, bld.env) + t2 = bld.get_tgen_by_name(obj) r2 = includes_objects(bld, t2, chain, inc_loops) chain.remove(obj) ret = ret.union(t2.direct_objects) @@ -612,7 +615,7 @@ dependency_loop(inc_loops, t, lib) continue chain.add(lib) - t2 = bld.name_to_obj(lib, bld.env) + t2 = bld.get_tgen_by_name(lib) if t2 is None: targets = LOCAL_CACHE(bld, 'TARGET_TYPE') Logs.error('Target %s of type %s not found in direct_libs for %s' % ( @@ -665,7 +668,7 @@ # expand indirect subsystem and library loops for loop in loops.copy(): - t = bld.name_to_obj(loop, bld.env) + t = bld.get_tgen_by_name(loop) if t.samba_type in ['SUBSYSTEM']: loops[loop] = loops[loop].union(t.indirect_objects) loops[loop] = loops[loop].union(t.direct_objects) @@ -677,7 +680,7 @@ # expand indirect includes loops for loop in inc_loops.copy(): - t = bld.name_to_obj(loop, bld.env) + t = bld.get_tgen_by_name(loop) inc_loops[loop] = inc_loops[loop].union(t.includes_objects) if loop in inc_loops[loop]: inc_loops[loop].remove(loop) @@ -723,7 +726,7 @@ # if we will indirectly link to a target then we don't need it new = t.final_objects.copy() for l in t.final_libs: - t2 = bld.name_to_obj(l, bld.env) + t2 = bld.get_tgen_by_name(l) t2_obj = extended_objects(bld, t2, set()) dup = new.intersection(t2_obj) if t.sname in rely_on: @@ -743,7 +746,7 @@ # add back in any objects that were relied upon by the reduction rules for r in rely_on: - t = bld.name_to_obj(r, bld.env) + t = bld.get_tgen_by_name(r) t.final_objects = t.final_objects.union(rely_on[r]) return True @@ -752,7 +755,7 @@ def show_library_loop(bld, lib1, lib2, path, seen): '''show the detailed path of a library loop between lib1 and lib2''' - t = bld.name_to_obj(lib1, bld.env) + t = bld.get_tgen_by_name(lib1) if not lib2 in getattr(t, 'final_libs', set()): return @@ -791,7 +794,7 @@ # replace lib deps with objlist deps for l in t.final_libs: objname = l + '.objlist' - t2 = bld.name_to_obj(objname, bld.env) + t2 = bld.get_tgen_by_name(objname) if t2 is None: Logs.error('ERROR: subsystem %s not found' % objname) sys.exit(1) @@ -807,7 +810,7 @@ objname = module_name else: continue - t2 = bld.name_to_obj(objname, bld.env) + t2 = bld.get_tgen_by_name(objname) if t2 is None: Logs.error('ERROR: subsystem %s not found' % objname) sys.exit(1) @@ -819,7 +822,7 @@ for t in tgt_list: if t.samba_type in ['LIBRARY', 'PYTHON']: for l in t.final_libs.copy(): - t2 = bld.name_to_obj(l, bld.env) + t2 = bld.get_tgen_by_name(l) if t.sname in t2.final_libs: if getattr(bld.env, "ALLOW_CIRCULAR_LIB_DEPENDENCIES", False): # we could break this in either direction. If one of the libraries @@ -853,7 +856,7 @@ diff.remove(t.sname) # make sure we don't recreate the loop again! for d in diff.copy(): - t2 = bld.name_to_obj(d, bld.env) + t2 = bld.get_tgen_by_name(d) if t2.samba_type == 'LIBRARY': if t.sname in t2.final_libs: debug('deps: removing expansion %s from %s', d, t.sname) @@ -878,12 +881,12 @@ continue syslibs = set() for d in t.final_objects: - t2 = bld.name_to_obj(d, bld.env) + t2 = bld.get_tgen_by_name(d) syslibs = syslibs.union(t2.direct_syslibs) # this adds the indirect syslibs as well, which may not be needed # depending on the linker flags for d in t.final_libs: - t2 = bld.name_to_obj(d, bld.env) + t2 = bld.get_tgen_by_name(d) syslibs = syslibs.union(t2.direct_syslibs) t.final_syslibs = syslibs @@ -893,7 +896,7 @@ for t in tgt_list: if t.samba_type in ['LIBRARY', 'PYTHON']: for l in t.final_libs.copy(): - t2 = bld.name_to_obj(l, bld.env) + t2 = bld.get_tgen_by_name(l) if t.sname in t2.final_libs: Logs.error('ERROR: Unresolved library loop %s from %s' % (t.sname, t2.sname)) lib_loop_error = True @@ -909,7 +912,7 @@ if target in seen: return - t = bld.name_to_obj(target, bld.env) + t = bld.get_tgen_by_name(target) if t is None: Logs.error("ERROR: Unable to find target '%s'" % target) sys.exit(1) @@ -938,7 +941,7 @@ if not targets[t.sname] in [ 'LIBRARY', 'PYTHON' ]: continue for n in getattr(t, 'final_objects', set()): - t2 = bld.name_to_obj(n, bld.env) + t2 = bld.get_tgen_by_name(n) if not n in used_by: used_by[n] = set() used_by[n].add(t.sname) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_optimisation.py new/talloc-2.1.4/buildtools/wafsamba/samba_optimisation.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_optimisation.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_optimisation.py 2015-10-03 11:13:50.000000000 +0200 @@ -165,7 +165,7 @@ try: return cache[name] except KeyError: - ret = cache[name] = 'cstaticlib' in self.bld.name_to_obj(name, self.env).features + ret = cache[name] = 'cstaticlib' in self.bld.get_tgen_by_name(name).features return ret TaskGen.task_gen.is_this_a_static_lib = is_this_a_static_lib @@ -215,7 +215,7 @@ if lib_name in seen: continue - y = self.name_to_obj(lib_name) + y = self.get_tgen_by_name(lib_name) if not y: raise Utils.WafError('object %r was not found in uselib_local (required by %r)' % (lib_name, self.name)) y.post() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_patterns.py new/talloc-2.1.4/buildtools/wafsamba/samba_patterns.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_patterns.py 2015-06-13 03:00:10.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_patterns.py 2015-10-03 11:13:50.000000000 +0200 @@ -8,14 +8,11 @@ def write_version_header(task): '''print version.h contents''' src = task.inputs[0].srcpath(task.env) - tgt = task.outputs[0].bldpath(task.env) version = samba_version_file(src, task.env.srcdir, env=task.env, is_install=task.env.is_install) string = str(version) - f = open(tgt, 'w') - s = f.write(string) - f.close() + task.outputs[0].write(string) return 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_pidl.py new/talloc-2.1.4/buildtools/wafsamba/samba_pidl.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_pidl.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_pidl.py 2015-10-03 11:13:50.000000000 +0200 @@ -118,7 +118,7 @@ def collect(self): pidl_headers = LOCAL_CACHE(self.bld, 'PIDL_HEADERS') for (name, hd) in pidl_headers.items(): - y = self.bld.name_to_obj(name, self.env) + y = self.bld.get_tgen_by_name(name) self.bld.ASSERT(y is not None, 'Failed to find PIDL header %s' % name) y.post() for node in hd: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_utils.py new/talloc-2.1.4/buildtools/wafsamba/samba_utils.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_utils.py 2015-06-13 03:00:10.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_utils.py 2015-10-03 11:13:50.000000000 +0200 @@ -66,7 +66,7 @@ def needs_private_lib(bld, target): '''return True if a target links to a private library''' for lib in getattr(target, "final_libs", []): - t = bld.name_to_obj(lib, bld.env) + t = bld.get_tgen_by_name(lib) if t and getattr(t, 'private_library', False): return True return False @@ -173,7 +173,7 @@ if getattr(self , 'depends_on', None): lst = self.to_list(self.depends_on) for x in lst: - y = self.bld.name_to_obj(x, self.env) + y = self.bld.get_tgen_by_name(x) self.bld.ASSERT(y is not None, "Failed to find dependency %s of %s" % (x, self.name)) y.post() if getattr(y, 'more_includes', None): @@ -644,7 +644,7 @@ type = targets[tgt] if not type in ['SUBSYSTEM', 'MODULE', 'BINARY', 'LIBRARY', 'ASN1', 'PYTHON']: continue - t = bld.name_to_obj(tgt, bld.env) + t = bld.get_tgen_by_name(tgt) if t is None: Logs.error("Target %s of type %s has no task generator" % (tgt, type)) sys.exit(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/samba_version.py new/talloc-2.1.4/buildtools/wafsamba/samba_version.py --- old/talloc-2.1.3/buildtools/wafsamba/samba_version.py 2015-06-13 03:00:10.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/samba_version.py 2015-10-03 11:13:50.000000000 +0200 @@ -42,12 +42,10 @@ def distversion_version_summary(path): #get version from .distversion file - f = open(path + '/.distversion', 'r') suffix = None fields = {} - for line in f: - line = line.strip() + for line in Utils.readf(path + '/.distversion').splitlines(): if line == '': continue if line.startswith("#"): @@ -64,7 +62,6 @@ except: print("Failed to parse line %s from .distversion file." % (line)) raise - f.close() if "COMMIT_TIME" in fields: fields["COMMIT_TIME"] = int(fields["COMMIT_TIME"]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/symbols.py new/talloc-2.1.4/buildtools/wafsamba/symbols.py --- old/talloc-2.1.3/buildtools/wafsamba/symbols.py 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/symbols.py 2015-10-03 11:13:50.000000000 +0200 @@ -251,7 +251,7 @@ bld.env.public_symbols[name] = t.public_symbols if t.samba_type == 'LIBRARY': for dep in t.add_objects: - t2 = bld.name_to_obj(dep, bld.env) + t2 = bld.get_tgen_by_name(dep) bld.ASSERT(t2 is not None, "Library '%s' has unknown dependency '%s'" % (name, dep)) bld.env.public_symbols[name] = bld.env.public_symbols[name].union(t2.public_symbols) @@ -264,7 +264,7 @@ bld.env.used_symbols[name] = t.used_symbols if t.samba_type == 'LIBRARY': for dep in t.add_objects: - t2 = bld.name_to_obj(dep, bld.env) + t2 = bld.get_tgen_by_name(dep) bld.ASSERT(t2 is not None, "Library '%s' has unknown dependency '%s'" % (name, dep)) bld.env.used_symbols[name] = bld.env.used_symbols[name].union(t2.used_symbols) @@ -362,7 +362,7 @@ if targets[depname[0]] in [ 'SYSLIB' ]: deps.add(depname[0]) continue - t2 = bld.name_to_obj(depname[0], bld.env) + t2 = bld.get_tgen_by_name(depname[0]) if len(t2.in_library) != 1: deps.add(depname[0]) continue @@ -385,7 +385,7 @@ for t in tgt_list: if t.samba_type in [ 'LIBRARY' ]: for obj in t.samba_deps_extended: - t2 = bld.name_to_obj(obj, bld.env) + t2 = bld.get_tgen_by_name(obj) if t2 and t2.samba_type in [ 'SUBSYSTEM', 'ASN1' ]: if not t.sname in t2.in_library: t2.in_library.append(t.sname) @@ -402,7 +402,7 @@ Logs.warn("WARNING: Target '%s' in multiple libraries: %s" % (t.sname, t.in_library)) for dep in t.autodeps: - t2 = bld.name_to_obj(dep, bld.env) + t2 = bld.get_tgen_by_name(dep) if t2 is None: continue for dep2 in t2.autodeps: @@ -435,7 +435,7 @@ def check_dependencies(bld, t): '''check for depenencies that should be changed''' - if bld.name_to_obj(t.sname + ".objlist", bld.env): + if bld.get_tgen_by_name(t.sname + ".objlist"): return targets = LOCAL_CACHE(bld, 'TARGET_TYPE') @@ -475,7 +475,7 @@ def check_syslib_dependencies(bld, t): '''check for syslib depenencies''' - if bld.name_to_obj(t.sname + ".objlist", bld.env): + if bld.get_tgen_by_name(t.sname + ".objlist"): return sname = real_name(t.sname) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/wafsamba.py new/talloc-2.1.4/buildtools/wafsamba/wafsamba.py --- old/talloc-2.1.3/buildtools/wafsamba/wafsamba.py 2015-07-21 22:32:32.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/wafsamba.py 2015-10-03 11:13:50.000000000 +0200 @@ -95,9 +95,7 @@ def generate_empty_file(task): - target_fname = installed_location=task.outputs[0].bldpath(task.env) - target_file = open(installed_location, 'w') - target_file.close() + task.outputs[0].write('') return 0 ################################################################# diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/buildtools/wafsamba/wscript new/talloc-2.1.4/buildtools/wafsamba/wscript --- old/talloc-2.1.3/buildtools/wafsamba/wscript 2015-06-13 03:00:10.000000000 +0200 +++ new/talloc-2.1.4/buildtools/wafsamba/wscript 2015-10-13 14:20:30.000000000 +0200 @@ -361,6 +361,40 @@ cflags=conf.env.VISIBILITY_CFLAGS, define='HAVE_VISIBILITY_ATTR', addmain=False) + # check HAVE_CONSTRUCTOR_ATTRIBUTE + conf.CHECK_CODE(''' + void test_constructor_attribute(void) __attribute__ ((constructor)); + + void test_constructor_attribute(void) + { + return; + } + + int main(void) { + return 0; + } + ''', + 'HAVE_CONSTRUCTOR_ATTRIBUTE', + addmain=False, + msg='Checking for library constructor support') + + # check HAVE_DESTRUCTOR_ATTRIBUTE + conf.CHECK_CODE(''' + void test_destructor_attribute(void) __attribute__ ((destructor)); + + void test_destructor_attribute(void) + { + return; + } + + int main(void) { + return 0; + } + ''', + 'HAVE_DESTRUCTOR_ATTRIBUTE', + addmain=False, + msg='Checking for library destructor support') + if sys.platform.startswith('aix'): conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True) # Might not be needed if ALL_SOURCE is defined diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/lib/replace/replace.c new/talloc-2.1.4/lib/replace/replace.c --- old/talloc-2.1.3/lib/replace/replace.c 2015-07-21 22:32:32.000000000 +0200 +++ new/talloc-2.1.4/lib/replace/replace.c 2015-10-13 14:20:30.000000000 +0200 @@ -475,6 +475,26 @@ } #endif +#ifndef HAVE_STRSEP +char *rep_strsep(char **pps, const char *delim) +{ + char *ret = *pps; + char *p = *pps; + + if (p == NULL) { + return NULL; + } + p += strcspn(p, delim); + if (*p == '\0') { + *pps = NULL; + } else { + *p = '\0'; + *pps = p + 1; + } + return ret; +} +#endif + #ifndef HAVE_STRTOK_R /* based on GLIBC version, copyright Free Software Foundation */ char *rep_strtok_r(char *s, const char *delim, char **save_ptr) @@ -518,6 +538,7 @@ } #else #ifdef HAVE_BSD_STRTOLL +#undef strtoll long long int rep_strtoll(const char *str, char **endptr, int base) { long long int nb = strtoll(str, endptr, base); @@ -808,7 +829,7 @@ struct timeval tval; switch (clk_id) { case 0: /* CLOCK_REALTIME :*/ -#ifdef HAVE_GETTIMEOFDAY_TZ +#if defined(HAVE_GETTIMEOFDAY_TZ) || defined(HAVE_GETTIMEOFDAY_TZ_VOID) gettimeofday(&tval,NULL); #else gettimeofday(&tval); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/lib/replace/replace.h new/talloc-2.1.4/lib/replace/replace.h --- old/talloc-2.1.3/lib/replace/replace.h 2014-10-01 11:22:21.000000000 +0200 +++ new/talloc-2.1.4/lib/replace/replace.h 2015-08-04 10:58:20.000000000 +0200 @@ -349,6 +349,11 @@ char *rep_strcasestr(const char *haystack, const char *needle); #endif +#ifndef HAVE_STRSEP +#define strsep rep_strsep +char *rep_strsep(char **pps, const char *delim); +#endif + #ifndef HAVE_STRTOK_R #define strtok_r rep_strtok_r char *rep_strtok_r(char *s, const char *delim, char **save_ptr); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/lib/replace/wscript new/talloc-2.1.4/lib/replace/wscript --- old/talloc-2.1.3/lib/replace/wscript 2015-06-13 03:01:31.000000000 +0200 +++ new/talloc-2.1.4/lib/replace/wscript 2015-10-13 14:20:30.000000000 +0200 @@ -240,7 +240,7 @@ conf.CHECK_FUNCS('lstat getpgrp utime utimes setuid seteuid setreuid setresuid setgid setegid') conf.CHECK_FUNCS('setregid setresgid chroot strerror vsyslog setlinebuf mktime') conf.CHECK_FUNCS('ftruncate chsize rename waitpid wait4') - conf.CHECK_FUNCS('initgroups pread pwrite strndup strcasestr') + conf.CHECK_FUNCS('initgroups pread pwrite strndup strcasestr strsep') conf.CHECK_FUNCS('strtok_r mkdtemp dup2 dprintf vdprintf isatty chown lchown') conf.CHECK_FUNCS('link readlink symlink realpath snprintf vsnprintf') conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen strtoull __strtoull') @@ -502,7 +502,14 @@ addmain=False, msg='Checking for working strptime') - conf.CHECK_CODE('gettimeofday(NULL, NULL)', 'HAVE_GETTIMEOFDAY_TZ', execute=False) + conf.CHECK_C_PROTOTYPE('gettimeofday', + 'int gettimeofday(struct timeval *tv, struct timezone *tz)', + define='HAVE_GETTIMEOFDAY_TZ', headers='sys/time.h') + + conf.CHECK_C_PROTOTYPE('gettimeofday', + 'int gettimeofday(struct timeval *tv, void *tz)', + define='HAVE_GETTIMEOFDAY_TZ_VOID', + headers='sys/time.h') conf.CHECK_CODE('#include "test/snprintf.c"', define="HAVE_C99_VSNPRINTF", @@ -630,7 +637,7 @@ 'memmove', 'strdup', 'setlinebuf', 'vsyslog', 'strnlen', 'strndup', 'waitpid', 'seteuid', 'setegid', 'chroot', 'mkstemp', 'mkdtemp', 'pread', 'pwrite', 'strcasestr', - 'strtok_r', 'strtoll', 'strtoull', 'setenv', 'unsetenv', + 'strsep', 'strtok_r', 'strtoll', 'strtoull', 'setenv', 'unsetenv', 'utime', 'utimes', 'dup2', 'chown', 'link', 'readlink', 'symlink', 'lchown', 'realpath', 'memmem', 'vdprintf', 'dprintf', 'get_current_dir_name', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/talloc.c new/talloc-2.1.4/talloc.c --- old/talloc-2.1.3/talloc.c 2015-03-10 13:28:31.000000000 +0100 +++ new/talloc-2.1.4/talloc.c 2015-10-13 14:20:30.000000000 +0200 @@ -33,6 +33,10 @@ #include "replace.h" #include "talloc.h" +#ifdef HAVE_SYS_AUXV_H +#include <sys/auxv.h> +#endif + #ifdef TALLOC_BUILD_VERSION_MAJOR #if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR) #error "TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR" @@ -60,20 +64,26 @@ #define MAX_TALLOC_SIZE 0x10000000 -#define TALLOC_MAGIC_BASE 0xe814ec70 -#define TALLOC_MAGIC ( \ - TALLOC_MAGIC_BASE + \ - (TALLOC_VERSION_MAJOR << 12) + \ - (TALLOC_VERSION_MINOR << 4) \ -) #define TALLOC_FLAG_FREE 0x01 #define TALLOC_FLAG_LOOP 0x02 #define TALLOC_FLAG_POOL 0x04 /* This is a talloc pool */ #define TALLOC_FLAG_POOLMEM 0x08 /* This is allocated in a pool */ +/* + * Bits above this are random, used to make it harder to fake talloc + * headers during an attack. Try not to change this without good reason. + */ +#define TALLOC_FLAG_MASK 0x0F + #define TALLOC_MAGIC_REFERENCE ((const char *)1) +#define TALLOC_MAGIC_BASE 0xe814ec70 +static unsigned int talloc_magic = ( + TALLOC_MAGIC_BASE + + (TALLOC_VERSION_MAJOR << 12) + + (TALLOC_VERSION_MINOR << 4)); + /* by default we abort when given a bad pointer (such as when talloc_free() is called on a pointer that came from malloc() */ #ifndef TALLOC_ABORT @@ -249,13 +259,13 @@ struct talloc_pool_hdr; struct talloc_chunk { + unsigned flags; struct talloc_chunk *next, *prev; struct talloc_chunk *parent, *child; struct talloc_reference_handle *refs; talloc_destructor_t destructor; const char *name; size_t size; - unsigned flags; /* * limit semantics: @@ -290,6 +300,11 @@ return TALLOC_VERSION_MINOR; } +_PUBLIC_ int talloc_test_get_magic(void) +{ + return talloc_magic; +} + static void (*talloc_log_fn)(const char *message); _PUBLIC_ void talloc_set_log_fn(void (*log_fn)(const char *message)) @@ -297,6 +312,50 @@ talloc_log_fn = log_fn; } +#ifdef HAVE_CONSTRUCTOR_ATTRIBUTE +void talloc_lib_init(void) __attribute__((constructor)); +void talloc_lib_init(void) +{ + uint32_t random_value; +#if defined(HAVE_GETAUXVAL) && defined(AT_RANDOM) + uint8_t *p; + /* + * Use the kernel-provided random values used for + * ASLR. This won't change per-exec, which is ideal for us + */ + p = (uint8_t *) getauxval(AT_RANDOM); + if (p) { + /* + * We get 16 bytes from getauxval. By calling rand(), + * a totally insecure PRNG, but one that will + * deterministically have a different value when called + * twice, we ensure that if two talloc-like libraries + * are somehow loaded in the same address space, that + * because we choose different bytes, we will keep the + * protection against collision of multiple talloc + * libs. + * + * This protection is important because the effects of + * passing a talloc pointer from one to the other may + * be very hard to determine. + */ + int offset = rand() % (16 - sizeof(random_value)); + memcpy(&random_value, p + offset, sizeof(random_value)); + } else +#endif + { + /* + * Otherwise, hope the location we are loaded in + * memory is randomised by someone else + */ + random_value = ((uintptr_t)talloc_lib_init & 0xFFFFFFFF); + } + talloc_magic = random_value & ~TALLOC_FLAG_MASK; +} +#else +#warning "No __attribute__((constructor)) support found on this platform, additional talloc security measures not available" +#endif + static void talloc_log(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); static void talloc_log(const char *fmt, ...) { @@ -345,12 +404,6 @@ static void talloc_abort_magic(unsigned magic) { - unsigned striped = magic - TALLOC_MAGIC_BASE; - unsigned major = (striped & 0xFFFFF000) >> 12; - unsigned minor = (striped & 0x00000FF0) >> 4; - talloc_log("Bad talloc magic[0x%08X/%u/%u] expected[0x%08X/%u/%u]\n", - magic, major, minor, - TALLOC_MAGIC, TALLOC_VERSION_MAJOR, TALLOC_VERSION_MINOR); talloc_abort("Bad talloc magic value - wrong talloc version used/mixed"); } @@ -369,9 +422,9 @@ { const char *pp = (const char *)ptr; struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE); - if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) { - if ((tc->flags & (~0xFFF)) == TALLOC_MAGIC_BASE) { - talloc_abort_magic(tc->flags & (~0xF)); + if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~TALLOC_FLAG_MASK)) != talloc_magic)) { + if ((tc->flags & (~0xF)) == talloc_magic) { + talloc_abort_magic(tc->flags & (~TALLOC_FLAG_MASK)); return NULL; } @@ -561,7 +614,7 @@ pool_hdr->end = (void *)((char *)pool_hdr->end + chunk_size); - result->flags = TALLOC_MAGIC | TALLOC_FLAG_POOLMEM; + result->flags = talloc_magic | TALLOC_FLAG_POOLMEM; result->pool = pool_hdr; pool_hdr->object_count++; @@ -617,7 +670,7 @@ return NULL; } tc = (struct talloc_chunk *)(ptr + prefix_len); - tc->flags = TALLOC_MAGIC; + tc->flags = talloc_magic; tc->pool = NULL; talloc_memlimit_grow(limit, total_len); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/talloc.h new/talloc-2.1.4/talloc.h --- old/talloc-2.1.3/talloc.h 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.4/talloc.h 2015-10-13 14:20:30.000000000 +0200 @@ -47,6 +47,8 @@ int talloc_version_major(void); int talloc_version_minor(void); +/* This is mostly useful only for testing */ +int talloc_test_get_magic(void); /** * @brief Define a talloc parent type diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/test_magic_differs.sh new/talloc-2.1.4/test_magic_differs.sh --- old/talloc-2.1.3/test_magic_differs.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.4/test_magic_differs.sh 2015-10-13 14:20:30.000000000 +0200 @@ -0,0 +1,14 @@ +#!/bin/sh +# This test ensures that two different talloc processes do not use the same +# magic value to lessen the opportunity for transferrable attacks. + +echo "test: magic differs" + +if [ + "`./talloc_test_magic_differs_helper`" != "`./talloc_test_magic_differs_helper`" +]; then + echo "failure: magic remained the same between executions" + exit 1 +fi + +echo "success: magic differs" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/test_magic_differs_helper.c new/talloc-2.1.4/test_magic_differs_helper.c --- old/talloc-2.1.3/test_magic_differs_helper.c 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.4/test_magic_differs_helper.c 2015-10-13 14:20:30.000000000 +0200 @@ -0,0 +1,12 @@ +#include <stdio.h> +#include "talloc.h" + +/* + * This program is called by a testing shell script in order to ensure that + * if the library is loaded into different processes it uses different magic + * values in order to thwart security attacks. + */ +int main(int argc, char *argv[]) { + printf("%i\n", talloc_test_get_magic()); + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/testsuite.c new/talloc-2.1.4/testsuite.c --- old/talloc-2.1.3/testsuite.c 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/testsuite.c 2015-10-13 14:20:30.000000000 +0200 @@ -31,6 +31,9 @@ #include <pthread.h> #endif +#include <unistd.h> +#include <sys/wait.h> + #include "talloc_testsuite.h" static struct timeval timeval_current(void) @@ -1747,6 +1750,7 @@ ret = pthread_cond_wait(&condvar, &mtx); if (ret != 0) { talloc_free(top_ctx); + pthread_mutex_unlock(&mtx); return NULL; } } @@ -1827,6 +1831,7 @@ printf("pthread_cond_wait %d failed (%d)\n", i, ret); talloc_free(mem_ctx); + pthread_mutex_unlock(&mtx); return false; } } @@ -1850,6 +1855,67 @@ } #endif +static void test_magic_protection_abort(const char *reason) +{ + /* exit with errcode 42 to communicate successful test to the parent process */ + if (strcmp(reason, "Bad talloc magic value - unknown value") == 0) { + _exit(42); + } else { + printf("talloc aborted for an unexpected reason\n"); + } +} + +static bool test_magic_protection(void) +{ + void *pool = talloc_pool(NULL, 1024); + int *p1, *p2; + pid_t pid; + int exit_status; + + printf("test: magic_protection\n"); + p1 = talloc(pool, int); + p2 = talloc(pool, int); + + /* To avoid complaints from the compiler assign values to the p1 & p2. */ + *p1 = 6; + *p2 = 9; + + pid = fork(); + if (pid == 0) { + talloc_set_abort_fn(test_magic_protection_abort); + + /* + * Simulate a security attack + * by triggering a buffer overflow in memset to overwrite the + * constructor in the next pool chunk. + * + * Real attacks would attempt to set a real destructor. + */ + memset(p1, '\0', 32); + + /* Then the attack takes effect when the memory's freed. */ + talloc_free(pool); + } else { + while (wait(&exit_status) != pid); + } + + if (!WIFEXITED(exit_status)) { + printf("Child exited through unexpected abnormal means\n"); + return false; + } + if (WEXITSTATUS(exit_status) != 42) { + printf("Child exited with wrong exit status\n"); + return false; + } + if (WIFSIGNALED(exit_status)) { + printf("Child recieved unexpected signal\n"); + return false; + } + + printf("success: magic_protection\n"); + return true; +} + static void test_reset(void) { talloc_set_log_fn(test_log_stdout); @@ -1932,6 +1998,8 @@ } test_reset(); ret &= test_autofree(); + test_reset(); + ret &= test_magic_protection(); test_reset(); talloc_disable_null_tracking(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/third_party/waf/wafadmin/Build.py new/talloc-2.1.4/third_party/waf/wafadmin/Build.py --- old/talloc-2.1.3/third_party/waf/wafadmin/Build.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/third_party/waf/wafadmin/Build.py 2015-10-03 11:13:51.000000000 +0200 @@ -645,6 +645,10 @@ cache[v] = x return cache.get(env.variant() + '_' + name, None) + def get_tgen_by_name(self, name): + """waf 1.8 api""" + return self.name_to_obj(name, self.env) + def flush(self, all=1): """tell the task generators to create the tasks""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/third_party/waf/wafadmin/Node.py new/talloc-2.1.4/third_party/waf/wafadmin/Node.py --- old/talloc-2.1.3/third_party/waf/wafadmin/Node.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/third_party/waf/wafadmin/Node.py 2015-10-03 11:13:51.000000000 +0200 @@ -689,6 +689,13 @@ child = self.ensure_dir_node_from_path(k) child.update_build_dir(env) + def read(self, flags='r', encoding='ISO8859-1'): + """backported from waf 1.8""" + return Utils.readf(self.abspath(), flags, encoding) + + def write(self, data, flags='w', encoding='ISO8859-1'): + """backported from waf 1.8""" + Utils.writef(self.abspath(self.bld.env), data, flags, encoding) class Nodu(Node): pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/third_party/waf/wafadmin/TaskGen.py new/talloc-2.1.4/third_party/waf/wafadmin/TaskGen.py --- old/talloc-2.1.3/third_party/waf/wafadmin/TaskGen.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/third_party/waf/wafadmin/TaskGen.py 2015-10-03 11:13:51.000000000 +0200 @@ -242,6 +242,9 @@ def name_to_obj(self, name): return self.bld.name_to_obj(name, self.env) + def get_tgen_by_name(self, name): + return self.bld.get_tgen_by_name(name) + def find_sources_in_dirs(self, dirnames, excludes=[], exts=[]): """ The attributes "excludes" and "exts" must be lists to avoid the confusion diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/third_party/waf/wafadmin/Tools/cc.py new/talloc-2.1.4/third_party/waf/wafadmin/Tools/cc.py --- old/talloc-2.1.3/third_party/waf/wafadmin/Tools/cc.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/third_party/waf/wafadmin/Tools/cc.py 2015-10-03 11:13:51.000000000 +0200 @@ -23,7 +23,7 @@ class cc_taskgen(ccroot.ccroot_abstract): pass -@feature('cc') +@feature('c', 'cc') @before('apply_type_vars') @after('default_cc') def init_cc(self): @@ -33,7 +33,7 @@ if not self.env['CC_NAME']: raise Utils.WafError("At least one compiler (gcc, ..) must be selected") -@feature('cc') +@feature('c', 'cc') @after('apply_incpaths') def apply_obj_vars_cc(self): """after apply_incpaths for INC_PATHS""" @@ -51,7 +51,7 @@ for i in env['CPPPATH']: app('_CCINCFLAGS', cpppath_st % i) -@feature('cc') +@feature('c', 'cc') @after('apply_lib_vars') def apply_defines_cc(self): """after uselib is set for CCDEFINES""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/third_party/waf/wafadmin/Tools/ccroot.py new/talloc-2.1.4/third_party/waf/wafadmin/Tools/ccroot.py --- old/talloc-2.1.3/third_party/waf/wafadmin/Tools/ccroot.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/third_party/waf/wafadmin/Tools/ccroot.py 2015-10-03 11:13:51.000000000 +0200 @@ -190,7 +190,7 @@ return os.path.join(dir, pattern % name) -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') @before('apply_core') def default_cc(self): """compiled_tasks attribute must be set before the '.c->.o' tasks can be created""" @@ -253,7 +253,7 @@ if self.install_path: self.bld.install_files(self.install_path, self.link_task.outputs[0], env=self.env, chmod=self.chmod) -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') @after('apply_type_vars', 'apply_lib_vars', 'apply_core') def apply_incpaths(self): """used by the scanner @@ -297,7 +297,7 @@ if USE_TOP_LEVEL: self.env.append_value('INC_PATHS', self.bld.srcnode) -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') @after('init_cc', 'init_cxx') @before('apply_lib_vars') def apply_type_vars(self): @@ -339,7 +339,7 @@ self.link_task = tsk -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') @after('apply_link', 'init_cc', 'init_cxx', 'apply_core') def apply_lib_vars(self): """after apply_link because of 'link_task' @@ -523,7 +523,7 @@ 'frameworkpath' : 'FRAMEWORKPATH' } -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') @before('init_cxx', 'init_cc') @before('apply_lib_vars', 'apply_obj_vars', 'apply_incpaths', 'init_cc') def add_extra_flags(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/third_party/waf/wafadmin/Tools/msvc.py new/talloc-2.1.4/third_party/waf/wafadmin/Tools/msvc.py --- old/talloc-2.1.3/third_party/waf/wafadmin/Tools/msvc.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/third_party/waf/wafadmin/Tools/msvc.py 2015-10-03 11:13:51.000000000 +0200 @@ -638,7 +638,7 @@ ##### conf above, build below @after('apply_link') -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') def apply_flags_msvc(self): if self.env.CC_NAME != 'msvc' or not self.link_task: return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/third_party/waf/wafadmin/Tools/osx.py new/talloc-2.1.4/third_party/waf/wafadmin/Tools/osx.py --- old/talloc-2.1.3/third_party/waf/wafadmin/Tools/osx.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/third_party/waf/wafadmin/Tools/osx.py 2015-10-03 11:13:51.000000000 +0200 @@ -38,7 +38,7 @@ # see WAF issue 285 # and also http://trac.macports.org/ticket/17059 -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') @before('apply_lib_vars') def set_macosx_deployment_target(self): if self.env['MACOSX_DEPLOYMENT_TARGET']: @@ -47,7 +47,7 @@ if sys.platform == 'darwin': os.environ['MACOSX_DEPLOYMENT_TARGET'] = '.'.join(platform.mac_ver()[0].split('.')[:2]) -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') @after('apply_lib_vars') def apply_framework(self): for x in self.to_list(self.env['FRAMEWORKPATH']): @@ -145,7 +145,7 @@ self.env.append_value('LINKFLAGS', path) @before('apply_link', 'apply_lib_vars') -@feature('cc', 'cxx') +@feature('c', 'cc', 'cxx') def apply_bundle(self): """use env['MACBUNDLE'] to force all shlibs into mac bundles or use obj.mac_bundle = True for specific targets only""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/third_party/waf/wafadmin/Utils.py new/talloc-2.1.4/third_party/waf/wafadmin/Utils.py --- old/talloc-2.1.3/third_party/waf/wafadmin/Utils.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.4/third_party/waf/wafadmin/Utils.py 2015-10-03 11:13:51.000000000 +0200 @@ -147,6 +147,38 @@ # portability fixes may be added elsewhere (although, md5 should be everywhere by now) md5 = None +def readf(fname, m='r', encoding='ISO8859-1'): + """backported from waf 1.8""" + if sys.hexversion > 0x3000000 and not 'b' in m: + m += 'b' + f = open(fname, m) + try: + txt = f.read() + finally: + f.close() + if encoding: + txt = txt.decode(encoding) + else: + txt = txt.decode() + else: + f = open(fname, m) + try: + txt = f.read() + finally: + f.close() + return txt + +def writef(fname, data, m='w', encoding='ISO8859-1'): + """backported from waf 1.8""" + if sys.hexversion > 0x3000000 and not 'b' in m: + data = data.encode(encoding) + m += 'b' + f = open(fname, m) + try: + f.write(data) + finally: + f.close() + class ordered_dict(UserDict): def __init__(self, dict = None): self.allkeys = [] @@ -423,8 +455,7 @@ os.makedirs(path) except OSError, e: if not os.path.isdir(path): - raise Errors.WafError('Cannot create the folder %r' % path, ex=e) - + raise WafError("Cannot create the folder '%s' (error: %s)" % (path, e)) def cmd_output(cmd, **kw): @@ -557,15 +588,6 @@ for dt in tooldir: sys.path.remove(dt) -def readf(fname, m='r'): - "get the contents of a file, it is not used anywhere for the moment" - f = open(fname, m) - try: - txt = f.read() - finally: - f.close() - return txt - def nada(*k, **kw): """A function that does nothing""" pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.3/wscript new/talloc-2.1.4/wscript --- old/talloc-2.1.3/wscript 2015-07-21 22:32:32.000000000 +0200 +++ new/talloc-2.1.4/wscript 2015-10-13 14:20:30.000000000 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.1.3' +VERSION = '2.1.4' blddir = 'bin' @@ -66,6 +66,9 @@ Logs.warn('Disabling pytalloc-util as python devel libs not found') conf.env.disable_python = True + conf.CHECK_HEADERS('sys/auxv.h') + conf.CHECK_FUNCS('getauxval') + conf.SAMBA_CONFIG_H() conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS() @@ -97,6 +100,10 @@ testsuite_deps, install=False) + bld.SAMBA_BINARY('talloc_test_magic_differs_helper', + 'test_magic_differs_helper.c', + 'talloc', install=False) + else: private_library = True @@ -151,9 +158,14 @@ cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite') ret = samba_utils.RUN_COMMAND(cmd) print("testsuite returned %d" % ret) + magic_cmd = os.path.join(srcdir, 'lib', 'talloc', + 'test_magic_differs.sh') + + magic_ret = samba_utils.RUN_COMMAND(magic_cmd) + print("magic differs test returned %d" % magic_ret) pyret = samba_utils.RUN_PYTHON_TESTS(['test_pytalloc.py']) print("python testsuite returned %d" % pyret) - sys.exit(ret or pyret) + sys.exit(ret or magic_ret or pyret) def dist(): '''makes a tarball for distribution'''