aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/swupd-server
diff options
context:
space:
mode:
authorDmitry Rozhkov <dmitry.rozhkov@linux.intel.com>2016-03-14 17:50:07 +0200
committerJoshua Lock <joshua.g.lock@intel.com>2016-03-14 21:25:32 +0000
commit9e5731a3aa4b2065f5399094903c6805f8c67170 (patch)
treedf0b6b37a34ea16351ecc82197ec075211493bb5 /recipes-core/swupd-server
parentb45ff4ff8389431f80c744cb17a9019bae512d44 (diff)
downloadmeta-swupd-9e5731a3aa4b2065f5399094903c6805f8c67170.tar.gz
meta-swupd-9e5731a3aa4b2065f5399094903c6805f8c67170.tar.bz2
meta-swupd-9e5731a3aa4b2065f5399094903c6805f8c67170.zip
swupd-server: Add patch fixing freeing dangling pointers
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Diffstat (limited to 'recipes-core/swupd-server')
-rw-r--r--recipes-core/swupd-server/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch28
-rw-r--r--recipes-core/swupd-server/swupd-server/0002-Add-system_argv-helper-for-safer-calls-to-system-uti.patch (renamed from recipes-core/swupd-server/swupd-server/0001-Add-system_argv-helper-for-safer-calls-to-system-uti.patch)9
-rw-r--r--recipes-core/swupd-server/swupd-server/0003-Add-configure-option-to-re-enable-config-files-in-ma.patch (renamed from recipes-core/swupd-server/swupd-server/0002-Add-configure-option-to-re-enable-config-files-in-ma.patch)13
-rw-r--r--recipes-core/swupd-server/swupd-server/0004-Fix-regression-that-introduced-a-directory-named.patch (renamed from recipes-core/swupd-server/swupd-server/0002-Fix-regression-that-introduced-a-directory-named.patch)10
-rw-r--r--recipes-core/swupd-server/swupd-server/0005-xattrs.c-Avoid-freeing-dangling-pointers.patch49
-rw-r--r--recipes-core/swupd-server/swupd-server_2.53.bb7
6 files changed, 82 insertions, 34 deletions
diff --git a/recipes-core/swupd-server/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch b/recipes-core/swupd-server/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch
index b771e0a..6ae3c52 100644
--- a/recipes-core/swupd-server/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch
+++ b/recipes-core/swupd-server/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch
@@ -1,7 +1,7 @@
-From 83fbb8a78594cf9047e37ed0aa1e931b9d691f2a Mon Sep 17 00:00:00 2001
+From 4a3c91466e0782885fe980b659a6f6ac4835fe8a Mon Sep 17 00:00:00 2001
From: Joshua Lock <joshua.g.lock@intel.com>
Date: Thu, 28 Jan 2016 10:24:56 +0000
-Subject: [PATCH 1/2] Add option -S to take the state data dir as an argument
+Subject: [PATCH] Add option -S to take the state data dir as an argument
The optional -S option expects a full path to a directory
swupd-server should use instead of the default /var/lib/update.
@@ -24,7 +24,7 @@ Upstream-Status: Accepted (v3.0+)
10 files changed, 264 insertions(+), 73 deletions(-)
diff --git a/include/swupd.h b/include/swupd.h
-index 775c28e..58307d9 100644
+index 00b88d4..522ac2e 100644
--- a/include/swupd.h
+++ b/include/swupd.h
@@ -16,9 +16,6 @@
@@ -56,7 +56,7 @@ index 775c28e..58307d9 100644
extern int file_sort_hash(gconstpointer a, gconstpointer b);
extern int file_sort_filename(gconstpointer a, gconstpointer b);
diff --git a/src/analyze_fs.c b/src/analyze_fs.c
-index 2326237..fdc359a 100644
+index 4d01ccf..f6cfa13 100644
--- a/src/analyze_fs.c
+++ b/src/analyze_fs.c
@@ -389,7 +389,7 @@ struct manifest *full_manifest_from_directory(int version)
@@ -78,11 +78,11 @@ index 2326237..fdc359a 100644
iterate_directory(manifest, dir, "", false);
diff --git a/src/chroot.c b/src/chroot.c
-index 1d7df95..c5bb942 100644
+index d85b5f7..cb6a04a 100644
--- a/src/chroot.c
+++ b/src/chroot.c
-@@ -40,14 +40,15 @@ void chroot_create_full(int newversion)
- char * command;
+@@ -41,14 +41,15 @@ void chroot_create_full(int newversion)
+ struct stat buf;
char *full_dir;
- string_or_die(&full_dir, "%s/%i/full/", IMAGE_DIR, newversion);
@@ -99,7 +99,7 @@ index 1d7df95..c5bb942 100644
ret = system(command);
assert(ret==0);
free(command);
-@@ -60,8 +61,8 @@ void chroot_create_full(int newversion)
+@@ -61,8 +62,8 @@ void chroot_create_full(int newversion)
}
LOG(NULL, "Overlaying bundle chroot onto full", "%s", group);
@@ -110,7 +110,7 @@ index 1d7df95..c5bb942 100644
ret = system(command);
assert(ret==0);
free(command);
-@@ -80,8 +81,8 @@ void chroot_create_full(int newversion)
+@@ -81,8 +82,8 @@ void chroot_create_full(int newversion)
}
LOG(NULL, "Recopy bundle chroot out of full", "%s", group);
@@ -204,7 +204,7 @@ index 32dc793..ff6a3fa 100644
+ free(staging_dir);
}
diff --git a/src/main.c b/src/main.c
-index 7ed71d5..3d5f24a 100644
+index ccfedfd..9366cd9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -55,6 +55,7 @@ static const struct option prog_opts[] = {
@@ -553,7 +553,7 @@ index 20fbd67..2b62b8a 100644
return exit_status;
}
diff --git a/src/pack.c b/src/pack.c
-index e96e9a4..036853f 100644
+index f021af9..5bb99b8 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -46,21 +46,21 @@ static void empty_pack_stage(int full, int version, char *module)
@@ -752,10 +752,10 @@ index 70f9006..5ea979c 100644
/* make sure file->stat.st_size is valid */
diff --git a/src/versions.c b/src/versions.c
-index 6860160..0fb729a 100644
+index eb38acc..3dd1e63 100644
--- a/src/versions.c
+++ b/src/versions.c
-@@ -215,10 +215,10 @@ GList *get_last_versions_list(int next_version, int max_versions)
+@@ -213,10 +213,10 @@ GList *get_last_versions_list(int next_version, int max_versions)
int idx, build_num, build_type, jump_point;
int jump_point_found;
@@ -768,7 +768,7 @@ index 6860160..0fb729a 100644
return NULL;
}
-@@ -228,7 +228,7 @@ GList *get_last_versions_list(int next_version, int max_versions)
+@@ -226,7 +226,7 @@ GList *get_last_versions_list(int next_version, int max_versions)
}
free(filename);
diff --git a/recipes-core/swupd-server/swupd-server/0001-Add-system_argv-helper-for-safer-calls-to-system-uti.patch b/recipes-core/swupd-server/swupd-server/0002-Add-system_argv-helper-for-safer-calls-to-system-uti.patch
index f94305e..037ea6b 100644
--- a/recipes-core/swupd-server/swupd-server/0001-Add-system_argv-helper-for-safer-calls-to-system-uti.patch
+++ b/recipes-core/swupd-server/swupd-server/0002-Add-system_argv-helper-for-safer-calls-to-system-uti.patch
@@ -1,8 +1,7 @@
-From 8f24ef7f857c9d2c2eb2601a2a1e06123c086001 Mon Sep 17 00:00:00 2001
+From a32179878e8e439948a4a6385515a0aea7a61592 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@intel.com>
Date: Fri, 29 Jan 2016 17:48:46 +0200
-Subject: [PATCH swupd-server 1/2] Add system_argv() helper for safer calls to
- system utilities
+Subject: [PATCH] Add system_argv() helper for safer calls to system utilities
Often file names contain special characters like hashes or
whitespaces and that makes escaping a difficult task when using
@@ -20,10 +19,10 @@ Upstream-Status: Backport (v2.54+)
3 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/include/swupd.h b/include/swupd.h
-index 00b88d4..2805186 100644
+index 522ac2e..ad4b967 100644
--- a/include/swupd.h
+++ b/include/swupd.h
-@@ -223,6 +223,7 @@ extern FILE * fopen_exclusive(const char *filename); /* no mode, opens for write
+@@ -228,6 +228,7 @@ extern FILE * fopen_exclusive(const char *filename); /* no mode, opens for write
extern void dump_file_info(struct file *file);
extern void string_or_die(char **strp, const char *fmt, ...);
extern void print_elapsed_time(struct timeval *previous_time, struct timeval *current_time);
diff --git a/recipes-core/swupd-server/swupd-server/0002-Add-configure-option-to-re-enable-config-files-in-ma.patch b/recipes-core/swupd-server/swupd-server/0003-Add-configure-option-to-re-enable-config-files-in-ma.patch
index a5ab7af..af14bbe 100644
--- a/recipes-core/swupd-server/swupd-server/0002-Add-configure-option-to-re-enable-config-files-in-ma.patch
+++ b/recipes-core/swupd-server/swupd-server/0003-Add-configure-option-to-re-enable-config-files-in-ma.patch
@@ -1,8 +1,7 @@
-From e209255d8985eb4eb4c43f5e773ee1a0a16eb297 Mon Sep 17 00:00:00 2001
+From f35e84199529c0dc320d8d4280a79b8060dbaf21 Mon Sep 17 00:00:00 2001
From: Joshua Lock <joshua.g.lock@intel.com>
Date: Fri, 12 Feb 2016 16:02:58 +0000
-Subject: [PATCH 2/2] Add configure option to re-enable config files in
- manifests
+Subject: [PATCH] Add configure option to re-enable config files in manifests
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
@@ -15,7 +14,7 @@ Upstream-Status: Accepted (v3.0+)
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
-index 8bb6e3b..afffad5 100644
+index 0cb074f..47256b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,12 @@ AC_ARG_ENABLE(
@@ -32,7 +31,7 @@ index 8bb6e3b..afffad5 100644
AS_IF([test "$enable_lzma" = "check"],
[PKG_CHECK_MODULES([lzma],
diff --git a/include/swupd.h b/include/swupd.h
-index 58307d9..7cce735 100644
+index ad4b967..d45ca9c 100644
--- a/include/swupd.h
+++ b/include/swupd.h
@@ -23,6 +23,12 @@
@@ -49,10 +48,10 @@ index 58307d9..7cce735 100644
#define REGULAR_BUILD 0
#define FIX_BUILD 1
diff --git a/src/manifest.c b/src/manifest.c
-index 69a8fb9..58d0be1 100644
+index 251c884..24403e3 100644
--- a/src/manifest.c
+++ b/src/manifest.c
-@@ -830,7 +830,7 @@ int prune_manifest(struct manifest *manifest)
+@@ -825,7 +825,7 @@ int prune_manifest(struct manifest *manifest)
next = g_list_next(list);
file = list->data;
diff --git a/recipes-core/swupd-server/swupd-server/0002-Fix-regression-that-introduced-a-directory-named.patch b/recipes-core/swupd-server/swupd-server/0004-Fix-regression-that-introduced-a-directory-named.patch
index 9c1d8fa..1b9dac4 100644
--- a/recipes-core/swupd-server/swupd-server/0002-Fix-regression-that-introduced-a-directory-named.patch
+++ b/recipes-core/swupd-server/swupd-server/0004-Fix-regression-that-introduced-a-directory-named.patch
@@ -1,7 +1,7 @@
-From aba4418696ef31ab5afc9811903a044366619dc4 Mon Sep 17 00:00:00 2001
+From 841418e5e3f40ee5ae492d606d403feef82cdc1c Mon Sep 17 00:00:00 2001
From: Patrick McCarty <patrick.mccarty@intel.com>
Date: Mon, 22 Feb 2016 22:07:08 -0800
-Subject: [PATCH 2/4] Fix regression that introduced a directory named '/ '
+Subject: [PATCH] Fix regression that introduced a directory named '/ '
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
@@ -12,11 +12,11 @@ Upstream-Status: Backport (v3.0+)
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/chroot.c b/src/chroot.c
-index f961d58..2878496 100644
+index cb6a04a..58e1f1a 100644
--- a/src/chroot.c
+++ b/src/chroot.c
-@@ -40,7 +40,7 @@ void chroot_create_full(int newversion)
- char * command;
+@@ -41,7 +41,7 @@ void chroot_create_full(int newversion)
+ struct stat buf;
char *full_dir;
- string_or_die(&full_dir, "%s/%i/full/ ", image_dir, newversion);
diff --git a/recipes-core/swupd-server/swupd-server/0005-xattrs.c-Avoid-freeing-dangling-pointers.patch b/recipes-core/swupd-server/swupd-server/0005-xattrs.c-Avoid-freeing-dangling-pointers.patch
new file mode 100644
index 0000000..0706862
--- /dev/null
+++ b/recipes-core/swupd-server/swupd-server/0005-xattrs.c-Avoid-freeing-dangling-pointers.patch
@@ -0,0 +1,49 @@
+From 5a061a5d332e11fa55ea2ecd68554e77c2bbc36e Mon Sep 17 00:00:00 2001
+From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
+Date: Mon, 14 Mar 2016 16:44:00 +0200
+Subject: [PATCH] xattrs.c: Avoid freeing dangling pointers
+
+It may happen that in a new version of a file xattrs
+get added or removed. In this case one of the xattr
+strings points to the bogus 0xdeadcafe address.
+In order to avoid freeing the dangling pointer check
+the length of the xattr string.
+
+Upstream-Status: Backport [v2.54+]
+
+Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
+---
+ src/xattrs.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/xattrs.c b/src/xattrs.c
+index bf7256c..16905bd 100644
+--- a/src/xattrs.c
++++ b/src/xattrs.c
+@@ -242,8 +242,8 @@ int xattrs_compare(const char *filename1, const char *filename2)
+ {
+ char *new_xattrs;
+ char *old_xattrs;
+- size_t new_xattrs_len;
+- size_t old_xattrs_len;
++ size_t new_xattrs_len = 0;
++ size_t old_xattrs_len = 0;
+ int ret = 0;
+
+ xattrs_get_blob(filename1, &old_xattrs, &old_xattrs_len);
+@@ -258,8 +258,10 @@ int xattrs_compare(const char *filename1, const char *filename2)
+ ret = -1;
+ }
+
+- free(old_xattrs);
+- free(new_xattrs);
++ if (old_xattrs_len)
++ free(old_xattrs);
++ if (new_xattrs_len)
++ free(new_xattrs);
+
+ return ret;
+ }
+--
+2.5.0
+
diff --git a/recipes-core/swupd-server/swupd-server_2.53.bb b/recipes-core/swupd-server/swupd-server_2.53.bb
index fdbd39b..ebe32da 100644
--- a/recipes-core/swupd-server/swupd-server_2.53.bb
+++ b/recipes-core/swupd-server/swupd-server_2.53.bb
@@ -8,9 +8,10 @@ DEPENDS = "file xz glib-2.0 zlib bzip2 tar rsync openssl"
SRC_URI = "\
https://download.clearlinux.org/releases/5940/clear/source/SRPMS/${BPN}-${PV}-4.src.rpm;extract=${BP}.tar.gz \
file://0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch \
- file://0001-Add-system_argv-helper-for-safer-calls-to-system-uti.patch \
- file://0002-Add-configure-option-to-re-enable-config-files-in-ma.patch \
- file://0002-Fix-regression-that-introduced-a-directory-named.patch \
+ file://0002-Add-system_argv-helper-for-safer-calls-to-system-uti.patch \
+ file://0003-Add-configure-option-to-re-enable-config-files-in-ma.patch \
+ file://0004-Fix-regression-that-introduced-a-directory-named.patch \
+ file://0005-xattrs.c-Avoid-freeing-dangling-pointers.patch \
"
SRC_URI[md5sum] = "14f25677b5a4f0b33785910b03860939"