The 'name' string passed to DLSYM macro is created from the fsname
buffer in load_backfs_module(). That buffer is greater than 512
bytes in size but the temporary buffer in DLSYM is only 64. The
newest gcc version detect this bug.
mount_utils.c: In function ‘load_backfs_module’:
mount_utils.c:530:36: error: ‘%s’ directive output may be truncated writing up to 507 bytes into a region of size 64 [-Werror=format-truncation=]
530 | snprintf(_fname, sizeof(_fname), "%s_%s", prefix, #func); \
| ^~~~~~~
mount_utils.c:593:2: note: in expansion of macro ‘DLSYM’
593 | DLSYM(name, ops, init);
Change-Id: I8ae30a5288f236fb9272dffd40f44175e5e03ef9
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/43938
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
#ifdef PLUGIN_DIR
#define DLSYM(prefix, sym, func) \
do { \
- char _fname[64]; \
+ char _fname[PATH_MAX]; \
snprintf(_fname, sizeof(_fname), "%s_%s", prefix, #func); \
sym->func = (typeof(sym->func))dlsym(sym->dl_handle, _fname); \
} while (0)