<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/scripts/mod/modpost.c, branch v4.2.4</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.2.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.2.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2015-07-08T22:53:49Z</updated>
<entry>
<title>modpost: work correctly with tile coldtext sections</title>
<updated>2015-07-08T22:53:49Z</updated>
<author>
<name>Chris Metcalf</name>
<email>cmetcalf@ezchip.com</email>
</author>
<published>2015-07-08T21:07:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=673c2c34f684e9d4328459e426ab54d51a5865c5'/>
<id>urn:sha1:673c2c34f684e9d4328459e426ab54d51a5865c5</id>
<content type='text'>
The tilegx and tilepro compilers use .coldtext for their unlikely
executed text section name, so an __attribute__((cold)) function
will (when compiled with higher optimization levels) land in
the .coldtext section.

Modify modpost to add .coldtext to the set of OTHER_TEXT_SECTIONS
so we don't get warnings about referencing such a section in an
__ex_table block, and then also modify arch/tile/lib/memcpy_user_64.c
so that it uses plain ".coldtext" instead of ".coldtext.memcpy".
The latter naming is a relic of an earlier use of -ffunction-sections,
which we no longer use by default.

Signed-off-by: Chris Metcalf &lt;cmetcalf@ezchip.com&gt;
Acked-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>modpost: don't emit section mismatch warnings for compiler optimizations</title>
<updated>2015-04-22T08:01:34Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2015-04-20T00:50:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4a3893d069b788f3570c19c12d9e986e8e15870f'/>
<id>urn:sha1:4a3893d069b788f3570c19c12d9e986e8e15870f</id>
<content type='text'>
Currently an allyesconfig build [gcc-4.9.1] can generate the following:

   WARNING: vmlinux.o(.text.unlikely+0x3864): Section mismatch in
   reference from the function cpumask_empty.constprop.3() to the
   variable .init.data:nmi_ipi_mask

which comes from the cpumask_empty usage in arch/x86/kernel/nmi_selftest.c.

Normally we would not see a symbol entry for cpumask_empty since it is:

	static inline bool cpumask_empty(const struct cpumask *srcp)

however in this case, the variant of the symbol gets emitted when GCC does
constant propagation optimization.

Fix things up so that any locally optimized constprop variants don't warn
when accessing variables that live in the __init sections.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>modpost: expand pattern matching to support substring matches</title>
<updated>2015-04-22T08:01:33Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2015-04-20T00:50:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=09c20c032b0f753969ae778d9783d946f054d7fe'/>
<id>urn:sha1:09c20c032b0f753969ae778d9783d946f054d7fe</id>
<content type='text'>
Currently the match() function supports a leading * to match any
prefix and a trailing * to match any suffix.  However there currently
is not a combination of both that can be used to target matches of
whole families of functions that share a common substring.

Here we expand the *foo and foo* match to also support *foo* with
the goal of targeting compiler generated symbol names that contain
strings like ".constprop." and ".isra."

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>modpost: do not try to match the SHT_NUL section.</title>
<updated>2015-04-22T08:01:33Z</updated>
<author>
<name>Quentin Casasnovas</name>
<email>quentin.casasnovas@oracle.com</email>
</author>
<published>2015-04-16T03:46:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c5c3439af0f9c08e253d2a703a7eb3deba7d8591'/>
<id>urn:sha1:c5c3439af0f9c08e253d2a703a7eb3deba7d8591</id>
<content type='text'>
Trying to match the SHT_NUL section isn't useful and causes build failures
on parisc and mn10300 since the addition of section strict white-listing
and __ex_table sanitizing.

Signed-off-by: Quentin Casasnovas &lt;quentin.casasnovas@oracle.com&gt;
Reported-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Fixes: 050e57fd5936 ("modpost: add strict white-listing when referencing....")
Fixes: 52dc0595d540 ("modpost: handle relocations mismatch in __ex_table.")
Tested-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>modpost: fix extable entry size calculation.</title>
<updated>2015-04-22T08:01:32Z</updated>
<author>
<name>Quentin Casasnovas</name>
<email>quentin.casasnovas@oracle.com</email>
</author>
<published>2015-04-16T03:35:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e84048aa173f2403fa468cb189f101b57fece539'/>
<id>urn:sha1:e84048aa173f2403fa468cb189f101b57fece539</id>
<content type='text'>
As Guenter pointed out, we were never really calculating the extable entry
size because the pointer arithmetic was simply wrong.  We want to check
we're handling the second relocation in __ex_table to infer an entry size,
but we were using (void*) pointers instead of Elf_Rel[a]* ones.

This fixes the problem by moving that check in the caller (since we can
deal with different types of relocations) and add is_second_extable_reloc()
to make the whole thing more readable.

Signed-off-by: Quentin Casasnovas &lt;quentin.casasnovas@oracle.com&gt;
Reported-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
CC: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>modpost: fix inverted logic in is_extable_fault_address().</title>
<updated>2015-04-22T08:01:31Z</updated>
<author>
<name>Quentin Casasnovas</name>
<email>quentin.casasnovas@oracle.com</email>
</author>
<published>2015-04-16T03:33:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d3df4de7eb095cc4334759a5e65bf3bfb4be04f1'/>
<id>urn:sha1:d3df4de7eb095cc4334759a5e65bf3bfb4be04f1</id>
<content type='text'>
As Guenter pointed out, we want to assert that extable_entry_size has been
discovered and not the other way around.  Moreover, this sanity check is
only valid when we're not dealing with the first relocation in __ex_table,
since we have not discovered the extable entry size at that point.

This was leading to a divide-by-zero on some architectures and make the
build fail.

Signed-off-by: Quentin Casasnovas &lt;quentin.casasnovas@oracle.com&gt;
Reported-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
CC: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>modpost: handle -ffunction-sections</title>
<updated>2015-04-22T08:01:31Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2015-04-15T03:58:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6c730bfc894f5d4989c2c1493512d3330402be94'/>
<id>urn:sha1:6c730bfc894f5d4989c2c1493512d3330402be94</id>
<content type='text'>
52dc0595d540 introduced OTHER_TEXT_SECTIONS for identifying what
sections could validly have __ex_table entries.  Unfortunately, it
wasn't tested with -ffunction-sections, which some architectures
use.

Reported-by: kbuild test robot &lt;fengguang.wu@intel.com&gt;
Cc: Quentin Casasnovas &lt;quentin.casasnovas@oracle.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>modpost: Whitelist .text.fixup and .exception.text</title>
<updated>2015-04-22T08:01:20Z</updated>
<author>
<name>Thierry Reding</name>
<email>thierry.reding@gmail.com</email>
</author>
<published>2015-04-15T03:53:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d7e0abcf4c6d9fc4ebb948c9bbc880b2483434b4'/>
<id>urn:sha1:d7e0abcf4c6d9fc4ebb948c9bbc880b2483434b4</id>
<content type='text'>
32-bit and 64-bit ARM use these sections to store executable code, so
they must be whitelisted in modpost's table of valid text sections.

Signed-off-by: Thierry Reding &lt;treding@nvidia.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>modpost: document the use of struct section_check.</title>
<updated>2015-04-13T11:33:04Z</updated>
<author>
<name>Quentin Casasnovas</name>
<email>quentin.casasnovas@oracle.com</email>
</author>
<published>2015-04-13T11:25:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e5d8f59a5cfa76ab5ebe47622d0c569eddd42fbe'/>
<id>urn:sha1:e5d8f59a5cfa76ab5ebe47622d0c569eddd42fbe</id>
<content type='text'>
struct section_check is used as a generic way of describing what
relocations are authorized/forbidden when running modpost.  This commit
tries to describe how each field is used.

Signed-off-by: Quentin Casasnovas &lt;quentin.casasnovas@oracle.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt; (Fixed "mist"ake)
</content>
</entry>
<entry>
<title>modpost: handle relocations mismatch in __ex_table.</title>
<updated>2015-04-13T11:33:03Z</updated>
<author>
<name>Quentin Casasnovas</name>
<email>quentin.casasnovas@oracle.com</email>
</author>
<published>2015-04-13T11:22:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=52dc0595d540155436d91811f929bdc8afd6a2a1'/>
<id>urn:sha1:52dc0595d540155436d91811f929bdc8afd6a2a1</id>
<content type='text'>
__ex_table is a simple table section where each entry is a pair of
addresses - the first address is an address which can fault in kernel
space, and the second address points to where the kernel should jump to
when handling that fault.  This is how copy_from_user() does not crash the
kernel if userspace gives a borked pointer for example.

If one of these addresses point to a non-executable section, something is
seriously wrong since it either means the kernel will never fault from
there or it will not be able to jump to there.  As both cases are serious
enough, we simply error out in these cases so the build fails and the
developper has to fix the issue.

In case the section is executable, but it isn't referenced in our list of
authorized sections to point to from __ex_table, we just dump a warning
giving more information about it.  We do this in case the new section is
executable but isn't supposed to be executed by the kernel.  This happened
with .altinstr_replacement, which is executable but is only used to copy
instructions from - we should never have our instruction pointer pointing
in .altinstr_replacement.  Admitedly, a proper fix in that case would be to
just set .altinstr_replacement NX, but we need to warn about future cases
like this.

Signed-off-by: Quentin Casasnovas &lt;quentin.casasnovas@oracle.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt; (added long casts)
</content>
</entry>
</feed>
