Commit 399f0c22 authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'perf-urgent-for-mingo' of...

Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/urgent

Pull perf/urgent fixes from Jiri Olsa:

  * Fix perf to use non-executable stack, again (Mathias Krause)

  * Remove extra '/' character in events file path (Xia Kaixu)

  * Search for modules in %s/lib/modules/%s (Richard Yao)

  * Build related fixies plus static build test (Jiri Olsa)

  * Fix stack map lookup in dwarf unwind test (Jiri Olsa)
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 9f7ff893 9a126728
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug";
static const char * const debugfs_known_mountpoints[] = { static const char * const debugfs_known_mountpoints[] = {
"/sys/kernel/debug/", "/sys/kernel/debug",
"/debug/", "/debug",
0, 0,
}; };
......
...@@ -589,7 +589,7 @@ $(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H) ...@@ -589,7 +589,7 @@ $(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
$(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $< $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $<
$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS) $(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
$(QUIET_LINK)$(CC) -o $@ -shared $(ALL_LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
......
...@@ -23,7 +23,7 @@ static int sample_ustack(struct perf_sample *sample, ...@@ -23,7 +23,7 @@ static int sample_ustack(struct perf_sample *sample,
sp = (unsigned long) regs[PERF_REG_X86_SP]; sp = (unsigned long) regs[PERF_REG_X86_SP];
map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp); map = map_groups__find(&thread->mg, MAP__VARIABLE, (u64) sp);
if (!map) { if (!map) {
pr_debug("failed to get stack map\n"); pr_debug("failed to get stack map\n");
free(buf); free(buf);
......
#include <linux/linkage.h> #include <linux/linkage.h>
#define AX 0 #define AX 0
...@@ -90,3 +89,10 @@ ENTRY(perf_regs_load) ...@@ -90,3 +89,10 @@ ENTRY(perf_regs_load)
ret ret
ENDPROC(perf_regs_load) ENDPROC(perf_regs_load)
#endif #endif
/*
* We need to provide note.GNU-stack section, saying that we want
* NOT executable stack. Otherwise the final linking will assume that
* the ELF stack should not be restricted at all and set it RWX.
*/
.section .note.GNU-stack,"",@progbits
...@@ -117,6 +117,10 @@ CFLAGS += -Wall ...@@ -117,6 +117,10 @@ CFLAGS += -Wall
CFLAGS += -Wextra CFLAGS += -Wextra
CFLAGS += -std=gnu99 CFLAGS += -std=gnu99
# Enforce a non-executable stack, as we may regress (again) in the future by
# adding assembler files missing the .GNU-stack linker note.
LDFLAGS += -Wl,-z,noexecstack
EXTLIBS = -lelf -lpthread -lrt -lm -ldl EXTLIBS = -lelf -lpthread -lrt -lm -ldl
ifneq ($(OUTPUT),) ifneq ($(OUTPUT),)
...@@ -194,7 +198,10 @@ VF_FEATURE_TESTS = \ ...@@ -194,7 +198,10 @@ VF_FEATURE_TESTS = \
stackprotector-all \ stackprotector-all \
timerfd \ timerfd \
libunwind-debug-frame \ libunwind-debug-frame \
bionic bionic \
liberty \
liberty-z \
cplus-demangle
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
# If in the future we need per-feature checks/flags for features not # If in the future we need per-feature checks/flags for features not
...@@ -512,7 +519,21 @@ else ...@@ -512,7 +519,21 @@ else
endif endif
ifeq ($(feature-libbfd), 1) ifeq ($(feature-libbfd), 1)
EXTLIBS += -lbfd -lz -liberty EXTLIBS += -lbfd
# call all detections now so we get correct
# status in VF output
$(call feature_check,liberty)
$(call feature_check,liberty-z)
$(call feature_check,cplus-demangle)
ifeq ($(feature-liberty), 1)
EXTLIBS += -liberty
else
ifeq ($(feature-liberty-z), 1)
EXTLIBS += -liberty -lz
endif
endif
endif endif
ifdef NO_DEMANGLE ifdef NO_DEMANGLE
...@@ -523,15 +544,10 @@ else ...@@ -523,15 +544,10 @@ else
CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
else else
ifneq ($(feature-libbfd), 1) ifneq ($(feature-libbfd), 1)
$(call feature_check,liberty) ifneq ($(feature-liberty), 1)
ifeq ($(feature-liberty), 1) ifneq ($(feature-liberty-z), 1)
EXTLIBS += -lbfd -liberty # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
else # or any of 'bfd iberty z' trinity
$(call feature_check,liberty-z)
ifeq ($(feature-liberty-z), 1)
EXTLIBS += -lbfd -liberty -lz
else
$(call feature_check,cplus-demangle)
ifeq ($(feature-cplus-demangle), 1) ifeq ($(feature-cplus-demangle), 1)
EXTLIBS += -liberty EXTLIBS += -liberty
CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
......
...@@ -46,6 +46,7 @@ make_install_man := install-man ...@@ -46,6 +46,7 @@ make_install_man := install-man
make_install_html := install-html make_install_html := install-html
make_install_info := install-info make_install_info := install-info
make_install_pdf := install-pdf make_install_pdf := install-pdf
make_static := LDFLAGS=-static
# all the NO_* variable combined # all the NO_* variable combined
make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
...@@ -87,6 +88,7 @@ run += make_install_bin ...@@ -87,6 +88,7 @@ run += make_install_bin
# run += make_install_info # run += make_install_info
# run += make_install_pdf # run += make_install_pdf
run += make_minimal run += make_minimal
run += make_static
ifneq ($(call has,ctags),) ifneq ($(call has,ctags),)
run += make_tags run += make_tags
......
...@@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir) ...@@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir)
} }
static int map_groups__set_modules_path_dir(struct map_groups *mg, static int map_groups__set_modules_path_dir(struct map_groups *mg,
const char *dir_name) const char *dir_name, int depth)
{ {
struct dirent *dent; struct dirent *dent;
DIR *dir = opendir(dir_name); DIR *dir = opendir(dir_name);
...@@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg, ...@@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
!strcmp(dent->d_name, "..")) !strcmp(dent->d_name, ".."))
continue; continue;
ret = map_groups__set_modules_path_dir(mg, path); /* Do not follow top-level source and build symlinks */
if (depth == 0) {
if (!strcmp(dent->d_name, "source") ||
!strcmp(dent->d_name, "build"))
continue;
}
ret = map_groups__set_modules_path_dir(mg, path,
depth + 1);
if (ret < 0) if (ret < 0)
goto out; goto out;
} else { } else {
...@@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine) ...@@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine)
if (!version) if (!version)
return -1; return -1;
snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel", snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
machine->root_dir, version); machine->root_dir, version);
free(version); free(version);
return map_groups__set_modules_path_dir(&machine->kmaps, modules_path); return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
} }
static int machine__create_module(void *arg, const char *name, u64 start) static int machine__create_module(void *arg, const char *name, u64 start)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment