Re: [GIT PULL] Modules fixes for v5.19-rc1

2022-05-26 Thread pr-tracker-bot
The pull request you sent on Wed, 25 May 2022 14:49:34 -0700:

> git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/ 
> tags/modules-5.19-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ef98f9cfe20d8ca063365d46d4ab2b85eeeb324f

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html


Re: [GIT PULL] Modules fixes for v5.19-rc1

2022-05-25 Thread Luis Chamberlain
Sorry the subject should say "Modules changes".

I also forgot to itemize possible merge conflicts and resolutions
which linux-next reported:

powerpc:
https://lkml.kernel.org/r/20220520154055.7f964...@canb.auug.org.au

kbuild:
https://lkml.kernel.org/r/20220523120859.570f7...@canb.auug.org.au

  Luis


[GIT PULL] Modules fixes for v5.19-rc1

2022-05-25 Thread Luis Chamberlain
OK, finally some changes for modules. It is still pretty boring,
but I am hopefull that the cleanup will yield nice results in the
future as further cleanups will make the code much easier to
read, maintain and test. Perhaps the most exciting thing is
Christophe Leroy's CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC.
In reviewing Rick Edgecombe's prior work on enhancements for
special allocators I suspect this is going to help as module
space was the more complex aspect to deal with in his work.

AFAICT you *may* run into conflicts *if* bpf folks submit the
module_alloc_huge() stuff which I was still reviewing with Rick.
To my taste that effort seems to be going fast and I like to
take time to consider a proper interface for it which aligns well
with that others have in mind, specially in consideration for what
other architectures might need. The VM_FLUSH_RESET_PERMS stuff was
what was loose there. It doesn't seem we can address that stuff in
a generic neat way yet, and so the x86 open codes its own solution
for it.

I suspect we'll also need more tests on the huge page front so that
if more module_alloc() users want to convert we can enable folks to
give more realistic performance information rather than loose
numbers. In the future I suspect we'll just generalize module_alloc()
to vmalloc_exec() as its users are growing and the technical debt
of not drawing a clean API for it is growing.

Let me know if there are any issues.

  Luis

The following changes since commit 3123109284176b1532874591f7c81f3837bbdc17:

  Linux 5.18-rc1 (2022-04-03 14:08:21 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/ 
tags/modules-5.19-rc1

for you to fetch changes up to 7390b94a3c2d93272d6da4945b81a9cf78055b7b:

  module: merge check_exported_symbol() into find_exported_symbol_in_section() 
(2022-05-12 10:29:41 -0700)


Modules updates for v5.19-rc1

As promised, for v5.19 I queued up quite a bit of work for modules, but
still with a pretty conservative eye. These changes have been soaking on
modules-next (and so linux-next) for quite some time, the code shift was
merged onto modules-next on March 22, and the last patch was queued on May
5th.

The following are the highlights of what bells and whistles we will get for
v5.19:

 1) It was time to tidy up kernel/module.c and one way of starting with
that effort was to split it up into files. At my request Aaron Tomlin
spearheaded that effort with the goal to not introduce any
functional at all during that endeavour.  The penalty for the split
is +1322 bytes total, +112 bytes in data, +1210 bytes in text while
bss is unchanged. One of the benefits of this other than helping
make the code easier to read and review is summoning more help on review
for changes with livepatching so kernel/module/livepatch.c is now
pegged as maintained by the live patching folks.

The before and after with just the move on a defconfig on x86-64:

 $ size kernel/module.o
textdata bss dec hex filename
   384344540 104   43078a846 kernel/module.o

 $ size -t kernel/module/*.o
textdata bss dec hex filename
   4785 120   049051329 kernel/module/kallsyms.o
  285774416 104   330978149 kernel/module/main.o
   1158   8   01166 48e kernel/module/procfs.o
902 108   01010 3f2 kernel/module/strict_rwx.o
   3390   0   03390 d3e kernel/module/sysfs.o
832   0   0 832 340 kernel/module/tree_lookup.o
  396444652 104   44400ad70 (TOTALS)

 2) Aaron added module unload taint tracking (MODULE_UNLOAD_TAINT_TRACKING),
so to enable tracking unloaded modules which did taint the kernel.

 3) Christophe Leroy added CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC
which lets architectures to request having modules data in vmalloc
area instead of module area. There are three reasons why an
architecture might want this:

a) On some architectures (like book3s/32) it is not possible to protect
   against execution on a page basis. The exec stuff can be mapped by
   different arch segment sizes (on book3s/32 that is 256M segments). By
   default the module area is in an Exec segment while vmalloc area is in
   a NoExec segment. Using vmalloc lets you muck with module data as
   NoExec on those architectures whereas before you could not.

b) By pushing more module data to vmalloc you also increase the
   probability of module text to remain within a closer distance
   from kernel core text and this reduces trampolines, this has been
   reported on arm first and powerpc folks are following that lead.

c) Free'ing module_alloc() (Exec by default) area leaves this
   exposed as Exec by default, some architectures