Re: How to fix false positives on references to discarded text/data?

Kai Germaschewski (kai@tp1.ruhr-uni-bochum.de)
Sun, 23 Dec 2001 23:00:39 +0100 (CET)


On Sun, 23 Dec 2001, Keith Owens wrote:

> As an example, net/ipv4/netfilter/ip_nat_snmp_basic.c
> static void __exit fini(void)
> {
> ip_nat_helper_unregister(&snmp);
> ip_nat_helper_unregister(&snmp_trap);
> br_write_lock_bh(BR_NETPROTO_LOCK);
> br_write_unlock_bh(BR_NETPROTO_LOCK);
> }
>
> The lock operations generate a branch to out of line code in section
> .text.lock which then branches back to fini. When ip_nat_snmp_basic is
> built into vmlinux, the fini section is discarded but the .text.lock
> code is kept. That has two problems, unused code in .text.lock (minor)
> and an unresolved reference from .text.lock to .text.exit which makes
> binutils complain (major).

The logical fix would be to have the out-of-line code put into
.text.exit.lock in this case, and then discard .text.exit.lock during the
final link. Now, the problem is to have the spinlock code automatically
chose the right section.

But I think, I found a solution: Don't use .text.lock for the out-of-line
code, use .text 1 (subsection 1) instead. This will put the out-of-line
code out of line, but into the same section - case solved ;-)

I'll patch my kernel now - since I don't have the new binutils yet, it'll
be a bit hard to verify it really works, though.

--Kai

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/