From: Jo-Philipp Wich Date: Sun, 22 Dec 2019 18:46:05 +0000 (+0100) Subject: libblkid-tiny: fix symbol collision with full libblkid X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b4e25d54035c5092e8e9b46ab63500e95ac8c730;p=project%2Ffstools.git libblkid-tiny: fix symbol collision with full libblkid The recent introduction of blkid_new_probe() and blkid_free_probe() in the dynamically linked libblkid-tiny caused the dlopen'd libblkid.so to call into the wrong version of blkid_new_probe() within blkid_new_probe_from_filename(), leading to memory corruption and eventual segmentation faults. Fixes: b82c5c1 ("libblkid-tiny: add functions for allocating & freeing probe struct") Signed-off-by: Jo-Philipp Wich --- diff --git a/libblkid-tiny/blkid.h b/libblkid-tiny/blkid.h index 799e699..be16b8f 100644 --- a/libblkid-tiny/blkid.h +++ b/libblkid-tiny/blkid.h @@ -215,11 +215,11 @@ extern char *blkid_evaluate_spec(const char *spec, blkid_cache *cache) __ul_attribute__((warn_unused_result)); /* probe.c */ -extern blkid_probe blkid_new_probe(void) +extern blkid_probe blkidtiny_new_probe(void) __ul_attribute__((warn_unused_result)); extern blkid_probe blkid_new_probe_from_filename(const char *filename) __ul_attribute__((warn_unused_result)); -extern void blkid_free_probe(blkid_probe pr); +extern void blkidtiny_free_probe(blkid_probe pr); extern void blkid_reset_probe(blkid_probe pr); diff --git a/libblkid-tiny/libblkid-tiny.h b/libblkid-tiny/libblkid-tiny.h index aa87fd9..f0922b5 100644 --- a/libblkid-tiny/libblkid-tiny.h +++ b/libblkid-tiny/libblkid-tiny.h @@ -62,8 +62,8 @@ struct blkid_struct_probe struct list_head buffers; /* list of buffers */ }; -struct blkid_struct_probe *blkid_new_probe(void); -void blkid_free_probe(struct blkid_struct_probe *pr); +struct blkid_struct_probe *blkidtiny_new_probe(void); +void blkidtiny_free_probe(struct blkid_struct_probe *pr); extern int probe_block(char *block, struct blkid_struct_probe *pr); extern int mkblkdev(void); diff --git a/libblkid-tiny/probe.c b/libblkid-tiny/probe.c index ae7e708..bf68840 100644 --- a/libblkid-tiny/probe.c +++ b/libblkid-tiny/probe.c @@ -14,7 +14,7 @@ static int blkid_probe_reset_buffers(struct blkid_struct_probe *pr); -struct blkid_struct_probe *blkid_new_probe(void) +struct blkid_struct_probe *blkidtiny_new_probe(void) { struct blkid_struct_probe *pr; @@ -27,7 +27,7 @@ struct blkid_struct_probe *blkid_new_probe(void) return pr; } -void blkid_free_probe(struct blkid_struct_probe *pr) +void blkidtiny_free_probe(struct blkid_struct_probe *pr) { if (!pr) return; diff --git a/probe.c b/probe.c index 7d0e831..3ed7a7d 100644 --- a/probe.c +++ b/probe.c @@ -24,7 +24,7 @@ probe_path_tiny(const char *path) struct blkid_struct_probe *pr; char *type, *dev, *uuid, *label, *version; - pr = blkid_new_probe(); + pr = blkidtiny_new_probe(); if (!pr) return NULL; @@ -53,7 +53,7 @@ probe_path_tiny(const char *path) } } - blkid_free_probe(pr); + blkidtiny_free_probe(pr); return info; }