modules: don't export section names of empty sections via sysfs
Helge Deller authored
On the parisc architecture we face for each and every loaded kernel module
this kernel "badness warning":
  sysfs: cannot create duplicate filename '/module/ac97_bus/sections/.text'
  Badness at fs/sysfs/dir.c:487

Reason for that is, that on parisc all kernel modules do have multiple
.text sections due to the usage of the -ffunction-sections compiler flag
which is needed to reach all jump targets on this platform.

An objdump on such a kernel module gives:
Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .note.gnu.build-id 00000024  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .text         00000000  00000000  00000000  00000058  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .text.ac97_bus_match 0000001c  00000000  00000000  00000058  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .text         00000000  00000000  00000000  000000d4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
...
Since the .text sections are empty (size of 0 bytes) and won't be
loaded by the kernel module loader anyway, I don't see a reason
why such sections need to be listed under
/sys/module/<module_name>/sections/<section_name> either.

The attached patch does solve this issue by not exporting section
names which are empty.

This fixes bugzilla http://bugzilla.kernel.org/show_bug.cgi?id=14703

Signed-off-by: default avatarHelge Deller <deller@gmx.de>
CC: rusty@rustcorp.com.au
CC: akpm@linux-foundation.org
CC: James.Bottomley@HansenPartnership.com
CC: roland@redhat.com
CC: dave@hiauly1.hia.nrc.ca
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
35dead42
Name Last commit Last update
gcov microblaze: Enable GCOV_PROFILE_ALL
irq genirq: try_one_irq() must be called with irq disabled
power PM / Hibernate: Add newline to load_image() fail path
time headers: remove sched.h from interrupt.h
trace ftrace: Fix unmatched locking in ftrace_regex_write()
.gitignore Update kernel/.gitignore with new auto-generated files
Kconfig.freezer container freezer: implement freezer cgroup subsystem
Kconfig.hz sched: fix SCHED_HRTICK dependency
Kconfig.preempt rcu: provide RCU options on non-preempt architectures too
Makefile SLOW_WORK: Move slow_work's proc file to debugfs
acct.c bsdacct: switch credentials for writing to the accounting file
async.c async: Fix lack of boot-time console due to insufficient synchronization
audit.c Audit: send signal info if selinux is disabled
audit.h Fix rule eviction order for AUDIT_DIR
audit_tree.c Fix rule eviction order for AUDIT_DIR
audit_watch.c Audit: reorganize struct audit_watch to save 8 bytes
auditfilter.c Audit: clean up all op= output to include string quoting
auditsc.c Audit: rearrange audit_context to save 16 bytes per struct
backtracetest.c backtrace: replace timer with tasklet + completions
bounds.c Add kbuild.h that contains common definitions for kbuild users
capability.c [CVE-2009-0029] System call wrappers part 04
cgroup.c cgroup: fix strstrip() misuse
cgroup_freezer.c cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time
compat.c signals: implement sys_rt_tgsigqueueinfo
configs.c kernel/configs.c: remove useless comments
cpu.c
cpuset.c
cred-internals.h
cred.c
delayacct.c
dma.c
exec_domain.c
exit.c
extable.c
fork.c
freezer.c
futex.c
futex_compat.c
groups.c
hrtimer.c
hung_task.c
itimer.c
kallsyms.c
kexec.c
kfifo.c
kgdb.c
kmod.c
kprobes.c
ksysfs.c
kthread.c
latencytop.c
lockdep.c
lockdep_internals.h
lockdep_proc.c
lockdep_states.h
module.c
mutex-debug.c
mutex-debug.h
mutex.c
mutex.h
notifier.c
ns_cgroup.c
nsproxy.c
panic.c
params.c
perf_event.c
pid.c
pid_namespace.c
pm_qos_params.c
posix-cpu-timers.c
posix-timers.c
printk.c
profile.c
ptrace.c
rcupdate.c
rcutorture.c
rcutree.c
rcutree.h
rcutree_plugin.h
rcutree_trace.c
relay.c
res_counter.c
resource.c
rtmutex-debug.c
rtmutex-debug.h
rtmutex-tester.c
rtmutex.c
rtmutex.h
rtmutex_common.h
rwsem.c
sched.c
sched_clock.c
sched_cpupri.c
sched_cpupri.h
sched_debug.c
sched_fair.c
sched_features.h
sched_idletask.c
sched_rt.c
sched_stats.h
seccomp.c
semaphore.c
signal.c
slow-work-debugfs.c
slow-work.c