diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:47:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:47:31 +0000 |
commit | 236cb75e4430569627585a5818d9ce9bc85640f8 (patch) | |
tree | f84b5c0335eb76eb9df1e6c2c0004d7d9667c6e4 /debian/patches/use-bzero-instead-of-memset_s.diff | |
parent | Adding upstream version 2:4.17.12+dfsg. (diff) | |
download | samba-236cb75e4430569627585a5818d9ce9bc85640f8.tar.xz samba-236cb75e4430569627585a5818d9ce9bc85640f8.zip |
Adding debian version 2:4.17.12+dfsg-0+deb12u1.debian/2%4.17.12+dfsg-0+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/use-bzero-instead-of-memset_s.diff')
-rw-r--r-- | debian/patches/use-bzero-instead-of-memset_s.diff | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/debian/patches/use-bzero-instead-of-memset_s.diff b/debian/patches/use-bzero-instead-of-memset_s.diff new file mode 100644 index 0000000..a752b24 --- /dev/null +++ b/debian/patches/use-bzero-instead-of-memset_s.diff @@ -0,0 +1,24 @@ +Subject: use bzero() instead of memset_s() + +lib/replace/replace.h header defines ZERO_STRUCT macro +which uses memset_s() function (which is similar to +memset() but can not be optimized out by the compiler). +Glibc has bzero() with similar property, while memset_s() +have is implemented in lib/replace/replace.c, - this way, +some binaries needlessly link with libreplace-samba4 just +to get rep_memset_s() symbol. By using bzero() instead, +this endless linkage is eliminated, so we can package, +for example, libldb (which uses ZERO_STRUCT) without it +linking to libreplace-samba4. + +Note: actually using explicit_bzero() so it is not optimized +out by the compiler - this is the original goal of using +memset_s(). + +diff --git a/lib/replace/replace.h b/lib/replace/replace.h +index 8609d84322c..28db8d425a3 100644 +--- a/lib/replace/replace.h ++++ b/lib/replace/replace.h +@@ -822 +822 @@ +-#define ZERO_STRUCT(x) memset_s((char *)&(x), sizeof(x), 0, sizeof(x)) ++#define ZERO_STRUCT(x) explicit_bzero((char *)&(x), sizeof(x)) |