04 Oct, 2018

1 commit

  • [ Upstream commit 9f2d1e68cf4d641def734adaccfc3823d3575e6c ]

    Livepatch modules are special in that we preserve their entire symbol
    tables in order to be able to apply relocations after module load. The
    unwanted side effect of this is that undefined (SHN_UNDEF) symbols of
    livepatch modules are accessible via the kallsyms api and this can
    confuse symbol resolution in livepatch (klp_find_object_symbol()) and
    cause subtle bugs in livepatch.

    Have the module kallsyms api skip over SHN_UNDEF symbols. These symbols
    are usually not available for normal modules anyway as we cut down their
    symbol tables to just the core (non-undefined) symbols, so this should
    really just affect livepatch modules. Note that this patch doesn't
    affect the display of undefined symbols in /proc/kallsyms.

    Reported-by: Josh Poimboeuf
    Tested-by: Josh Poimboeuf
    Reviewed-by: Josh Poimboeuf
    Signed-off-by: Jessica Yu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jessica Yu
     

21 Jun, 2018

1 commit

  • [ Upstream commit ae646f0b9ca135b87bc73ff606ef996c3029780a ]

    load_module() creates W+X mappings via __vmalloc_node_range() (from
    layout_and_allocate()->move_module()->module_alloc()) by using
    PAGE_KERNEL_EXEC. These mappings are later cleaned up via
    "call_rcu_sched(&freeinit->rcu, do_free_init)" from do_init_module().

    This is a problem because call_rcu_sched() queues work, which can be run
    after debug_checkwx() is run, resulting in a race condition. If hit,
    the race results in a nasty splat about insecure W+X mappings, which
    results in a poor user experience as these are not the mappings that
    debug_checkwx() is intended to catch.

    This issue is observed on multiple arm64 platforms, and has been
    artificially triggered on an x86 platform.

    Address the race by flushing the queued work before running the
    arch-defined mark_rodata_ro() which then calls debug_checkwx().

    Link: http://lkml.kernel.org/r/1525103946-29526-1-git-send-email-jhugo@codeaurora.org
    Fixes: e1a58320a38d ("x86/mm: Warn on W^X mappings")
    Signed-off-by: Jeffrey Hugo
    Reported-by: Timur Tabi
    Reported-by: Jan Glauber
    Acked-by: Kees Cook
    Acked-by: Ingo Molnar
    Acked-by: Will Deacon
    Acked-by: Laura Abbott
    Cc: Mark Rutland
    Cc: Ard Biesheuvel
    Cc: Catalin Marinas
    Cc: Stephen Smalley
    Cc: Thomas Gleixner
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jeffrey Hugo
     

08 Feb, 2018

1 commit

  • commit caf7501a1b4ec964190f31f9c3f163de252273b8

    There's a risk that a kernel which has full retpoline mitigations becomes
    vulnerable when a module gets loaded that hasn't been compiled with the
    right compiler or the right option.

    To enable detection of that mismatch at module load time, add a module info
    string "retpoline" at build time when the module was compiled with
    retpoline support. This only covers compiled C source, but assembler source
    or prebuilt object files are not checked.

    If a retpoline enabled kernel detects a non retpoline protected module at
    load time, print a warning and report it in the sysfs vulnerability file.

    [ tglx: Massaged changelog ]

    Signed-off-by: Andi Kleen
    Signed-off-by: Thomas Gleixner
    Cc: David Woodhouse
    Cc: gregkh@linuxfoundation.org
    Cc: torvalds@linux-foundation.org
    Cc: jeyu@kernel.org
    Cc: arjan@linux.intel.com
    Link: https://lkml.kernel.org/r/20180125235028.31211-1-andi@firstfloor.org
    Signed-off-by: Greg Kroah-Hartman

    Andi Kleen
     

25 Jul, 2017

1 commit

  • ddebug_remove_module() use mod->name to find the ddebug_table of the
    module and remove it. But dynamic_debug_setup() use the first
    _ddebug->modname to create ddebug_table for the module. It's ok when
    the _ddebug->modname is the same with the mod->name.

    But livepatch module is special, it may contain _ddebugs of other
    modules, the modname of which is different from the name of livepatch
    module. So ddebug_remove_module() can't use mod->name to find the
    right ddebug_table and remove it. It can cause kernel crash when we cat
    the file /dynamic_debug/control.

    Signed-off-by: Zhou Chengming
    Signed-off-by: Jessica Yu

    Zhou Chengming
     

13 Jul, 2017

1 commit

  • Pull modules updates from Jessica Yu:
    "Summary of modules changes for the 4.13 merge window:

    - Minor code cleanups

    - Avoid accessing mod struct prior to checking module struct version,
    from Kees

    - Fix racy atomic inc/dec logic of kmod_concurrent_max in kmod, from
    Luis"

    * tag 'modules-for-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
    module: make the modinfo name const
    kmod: reduce atomic operations on kmod_concurrent and simplify
    module: use list_for_each_entry_rcu() on find_module_all()
    kernel/module.c: suppress warning about unused nowarn variable
    module: Add module name to modinfo
    module: Pass struct load_info into symbol checks

    Linus Torvalds
     

11 Jul, 2017

1 commit


07 Jul, 2017

3 commits

  • Merge misc updates from Andrew Morton:

    - a few hotfixes

    - various misc updates

    - ocfs2 updates

    - most of MM

    * emailed patches from Andrew Morton : (108 commits)
    mm, memory_hotplug: move movable_node to the hotplug proper
    mm, memory_hotplug: drop CONFIG_MOVABLE_NODE
    mm, memory_hotplug: drop artificial restriction on online/offline
    mm: memcontrol: account slab stats per lruvec
    mm: memcontrol: per-lruvec stats infrastructure
    mm: memcontrol: use generic mod_memcg_page_state for kmem pages
    mm: memcontrol: use the node-native slab memory counters
    mm: vmstat: move slab statistics from zone to node counters
    mm/zswap.c: delete an error message for a failed memory allocation in zswap_dstmem_prepare()
    mm/zswap.c: improve a size determination in zswap_frontswap_init()
    mm/zswap.c: delete an error message for a failed memory allocation in zswap_pool_create()
    mm/swapfile.c: sort swap entries before free
    mm/oom_kill: count global and memory cgroup oom kills
    mm: per-cgroup memory reclaim stats
    mm: kmemleak: treat vm_struct as alternative reference to vmalloc'ed objects
    mm: kmemleak: factor object reference updating out of scan_block()
    mm: kmemleak: slightly reduce the size of some structures on 64-bit architectures
    mm, mempolicy: don't check cpuset seqlock where it doesn't matter
    mm, cpuset: always use seqlock when changing task's nodemask
    mm, mempolicy: simplify rebinding mempolicies when updating cpusets
    ...

    Linus Torvalds
     
  • Pull tracing updates from Steven Rostedt:
    "The new features of this release:

    - Added TRACE_DEFINE_SIZEOF() which allows trace events that use
    sizeof() it the TP_printk() to be converted to the actual size such
    that trace-cmd and perf can parse them correctly.

    - Some rework of the TRACE_DEFINE_ENUM() such that the above
    TRACE_DEFINE_SIZEOF() could reuse the same code.

    - Recording of tgid (Thread Group ID). This is similar to how task
    COMMs are recorded (cached at sched_switch), where it is in a table
    and used on output of the trace and trace_pipe files.

    - Have ":mod:" be cached when written into set_ftrace_filter.
    Then the functions of the module will be traced at module load.

    - Some random clean ups and small fixes"

    * tag 'trace-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (26 commits)
    ftrace: Test for NULL iter->tr in regex for stack_trace_filter changes
    ftrace: Decrement count for dyn_ftrace_total_info for init functions
    ftrace: Unlock hash mutex on failed allocation in process_mod_list()
    tracing: Add support for display of tgid in trace output
    tracing: Add support for recording tgid of tasks
    ftrace: Decrement count for dyn_ftrace_total_info file
    ftrace: Remove unused function ftrace_arch_read_dyn_info()
    sh/ftrace: Remove only user of ftrace_arch_read_dyn_info()
    ftrace: Have cached module filters be an active filter
    ftrace: Implement cached modules tracing on module load
    ftrace: Have the cached module list show in set_ftrace_filter
    ftrace: Add :mod: caching infrastructure to trace_array
    tracing: Show address when function names are not found
    ftrace: Add missing comment for FTRACE_OPS_FL_RCU
    tracing: Rename update the enum_map file
    tracing: Add TRACE_DEFINE_SIZEOF() macros
    tracing: define TRACE_DEFINE_SIZEOF() macro to map sizeof's to their values
    tracing: Rename enum_replace to eval_replace
    trace: rename enum_map functions
    trace: rename trace.c enum functions
    ...

    Linus Torvalds
     
  • This header always exists, so doesn't require an ifdef around its
    inclusion. When CONFIG_ARCH_HAS_SET_MEMORY=y it includes the asm
    header, otherwise it provides empty versions of the set_memory_xx()
    routines.

    The usages of set_memory_xx() are still guarded by
    CONFIG_STRICT_MODULE_RWX.

    Link: http://lkml.kernel.org/r/1498717781-29151-3-git-send-email-mpe@ellerman.id.au
    Signed-off-by: Michael Ellerman
    Acked-by: Kees Cook
    Acked-by: Laura Abbott
    Cc: Daniel Borkmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Ellerman
     

29 Jun, 2017

1 commit


28 Jun, 2017

1 commit


26 Jun, 2017

1 commit

  • This patch fix the following warning:
    kernel/module.c: In function 'add_usage_links':
    kernel/module.c:1653:6: warning: variable 'nowarn' set but not used [-Wunused-but-set-variable]

    [jeyu: folded in first patch since it only swapped the function order
    so that del_usage_links can be called from add_usage_links]
    Signed-off-by: Corentin Labbe
    Signed-off-by: Jessica Yu

    Corentin Labbe
     

14 Jun, 2017

2 commits

  • Each module has a list of enum's its contributing to the
    enum map, rename that entry to reflect its use by more than
    enums.

    Link: http://lkml.kernel.org/r/20170531215653.3240-4-jeremy.linton@arm.com

    Signed-off-by: Jeremy Linton
    Signed-off-by: Steven Rostedt (VMware)

    Jeremy Linton
     
  • The kernel and its modules have sections containing the enum
    string to value conversions. Rename this section because we
    intend to store more than enums in it.

    Link: http://lkml.kernel.org/r/20170531215653.3240-2-jeremy.linton@arm.com

    Signed-off-by: Jeremy Linton
    Signed-off-by: Steven Rostedt (VMware)

    Jeremy Linton
     

26 May, 2017

1 commit

  • This patch makes it possible to pass additional arguments in addition
    to uevent action name when writing /sys/.../uevent attribute. These
    additional arguments are then inserted into generated synthetic uevent
    as additional environment variables.

    Before, we were not able to pass any additional uevent environment
    variables for synthetic uevents. This made it hard to identify such uevents
    properly in userspace to make proper distinction between genuine uevents
    originating from kernel and synthetic uevents triggered from userspace.
    Also, it was not possible to pass any additional information which would
    make it possible to optimize and change the way the synthetic uevents are
    processed back in userspace based on the originating environment of the
    triggering action in userspace. With the extra additional variables, we are
    able to pass through this extra information needed and also it makes it
    possible to synchronize with such synthetic uevents as they can be clearly
    identified back in userspace.

    The format for writing the uevent attribute is following:

    ACTION [UUID [KEY=VALUE ...]

    There's no change in how "ACTION" is recognized - it stays the same
    ("add", "change", "remove"). The "ACTION" is the only argument required
    to generate synthetic uevent, the rest of arguments, that this patch
    adds support for, are optional.

    The "UUID" is considered as transaction identifier so it's possible to
    use the same UUID value for one or more synthetic uevents in which case
    we logically group these uevents together for any userspace listeners.
    The "UUID" is expected to be in "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    format where "x" is a hex digit. The value appears in uevent as
    "SYNTH_UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" environment variable.

    The "KEY=VALUE" pairs can contain alphanumeric characters only. It's
    possible to define zero or more more pairs - each pair is then delimited
    by a space character " ". Each pair appears in synthetic uevents as
    "SYNTH_ARG_KEY=VALUE" environment variable. That means the KEY name gains
    "SYNTH_ARG_" prefix to avoid possible collisions with existing variables.
    To pass the "KEY=VALUE" pairs, it's also required to pass in the "UUID"
    part for the synthetic uevent first.

    If "UUID" is not passed in, the generated synthetic uevent gains
    "SYNTH_UUID=0" environment variable automatically so it's possible to
    identify this situation in userspace when reading generated uevent and so
    we can still make a difference between genuine and synthetic uevents.

    Signed-off-by: Peter Rajnoha
    Signed-off-by: Greg Kroah-Hartman

    Peter Rajnoha
     

24 May, 2017

2 commits

  • Accessing the mod structure (e.g. for mod->name) prior to having completed
    check_modstruct_version() can result in writing garbage to the error logs
    if the layout of the mod structure loaded from disk doesn't match the
    running kernel's mod structure layout. This kind of mismatch will become
    much more likely if a kernel is built with different randomization seed
    for the struct layout randomization plugin.

    Instead, add and use a new modinfo string for logging the module name.

    Signed-off-by: Kees Cook
    Signed-off-by: Jessica Yu

    Kees Cook
     
  • Since we're already using values from struct load_info, just pass this
    pointer in directly and use what's needed as we need it. This allows us
    to access future fields in struct load_info too.

    Signed-off-by: Kees Cook
    Signed-off-by: Jessica Yu

    Kees Cook
     

09 May, 2017

2 commits

  • set_memory_* functions have moved to set_memory.h. Switch to this
    explicitly.

    Link: http://lkml.kernel.org/r/1488920133-27229-12-git-send-email-labbott@redhat.com
    Signed-off-by: Laura Abbott
    Acked-by: Jessica Yu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Laura Abbott
     
  • __vmalloc* allows users to provide gfp flags for the underlying
    allocation. This API is quite popular

    $ git grep "=[[:space:]]__vmalloc\|return[[:space:]]*__vmalloc" | wc -l
    77

    The only problem is that many people are not aware that they really want
    to give __GFP_HIGHMEM along with other flags because there is really no
    reason to consume precious lowmemory on CONFIG_HIGHMEM systems for pages
    which are mapped to the kernel vmalloc space. About half of users don't
    use this flag, though. This signals that we make the API unnecessarily
    too complex.

    This patch simply uses __GFP_HIGHMEM implicitly when allocating pages to
    be mapped to the vmalloc space. Current users which add __GFP_HIGHMEM
    are simplified and drop the flag.

    Link: http://lkml.kernel.org/r/20170307141020.29107-1-mhocko@kernel.org
    Signed-off-by: Michal Hocko
    Reviewed-by: Matthew Wilcox
    Cc: Al Viro
    Cc: Vlastimil Babka
    Cc: David Rientjes
    Cc: Cristopher Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Hocko
     

04 May, 2017

2 commits

  • Pull modules updates from Jessica Yu:

    - Minor code cleanups

    - Fix section alignment for .init_array

    * tag 'modules-for-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
    kallsyms: Use bounded strnchr() when parsing string
    module: Unify the return value type of try_module_get
    module: set .init_array alignment to 8

    Linus Torvalds
     
  • Pull audit updates from Paul Moore:
    "Fourteen audit patches for v4.12 that span the full range of fixes,
    new features, and internal cleanups.

    We have a patches to move to 64-bit timestamps, convert refcounts from
    atomic_t to refcount_t, track PIDs using the pid struct instead of
    pid_t, convert our own private audit buffer cache to a standard
    kmem_cache, log kernel module names when they are unloaded, and
    normalize the NETFILTER_PKT to make the userspace folks happier.

    From a fixes perspective, the most important is likely the auditd
    connection tracking RCU fix; it was a rather brain dead bug that I'll
    take the blame for, but thankfully it didn't seem to affect many
    people (only one report).

    I think the patch subject lines and commit descriptions do a pretty
    good job of explaining the details and why the changes are important
    so I'll point you there instead of duplicating it here; as usual, if
    you have any questions you know where to find us.

    We also manage to take out more code than we put in this time, that
    always makes me happy :)"

    * 'stable-4.12' of git://git.infradead.org/users/pcmoore/audit:
    audit: fix the RCU locking for the auditd_connection structure
    audit: use kmem_cache to manage the audit_buffer cache
    audit: Use timespec64 to represent audit timestamps
    audit: store the auditd PID as a pid struct instead of pid_t
    audit: kernel generated netlink traffic should have a portid of 0
    audit: combine audit_receive() and audit_receive_skb()
    audit: convert audit_watch.count from atomic_t to refcount_t
    audit: convert audit_tree.count from atomic_t to refcount_t
    audit: normalize NETFILTER_PKT
    netfilter: use consistent ipv4 network offset in xt_AUDIT
    audit: log module name on delete_module
    audit: remove unnecessary semicolon in audit_watch_handle_event()
    audit: remove unnecessary semicolon in audit_mark_handle_event()
    audit: remove unnecessary semicolon in audit_field_valid()

    Linus Torvalds
     

02 May, 2017

1 commit

  • When a sysadmin wishes to monitor module unloading with a syscall rule such as:
    -a always,exit -F arch=x86_64 -S delete_module -F key=mod-unload
    the SYSCALL record doesn't tell us what module was requested for unloading.

    Use the new KERN_MODULE auxiliary record to record it.
    The SYSCALL record result code will list the return code.

    See: https://github.com/linux-audit/audit-kernel/issues/37
    https://github.com/linux-audit/audit-kernel/issues/7
    https://github.com/linux-audit/audit-kernel/wiki/RFE-Module-Load-Record-Format

    Signed-off-by: Richard Guy Briggs
    Acked-by: Jessica Yu
    Signed-off-by: Paul Moore

    Richard Guy Briggs
     

25 Apr, 2017

1 commit


26 Mar, 2017

1 commit

  • Since commit 383776fa7527 ("locking/lockdep: Handle statically initialized
    PER_CPU locks properly") we try to collapse per-cpu locks into a single
    class by giving them all the same key. For this key we choose the canonical
    address of the per-cpu object, which would be the offset into the per-cpu
    area.

    This has two problems:

    - there is a case where we run !0 lock->key through static_obj() and
    expect this to pass; it doesn't for canonical pointers.

    - 0 is a valid canonical address.

    Cure both issues by redefining the canonical address as the address of the
    per-cpu variable on the boot CPU.

    Since I didn't want to rely on CPU0 being the boot-cpu, or even existing at
    all, track the boot CPU in a variable.

    Fixes: 383776fa7527 ("locking/lockdep: Handle statically initialized PER_CPU locks properly")
    Reported-by: kernel test robot
    Signed-off-by: Peter Zijlstra (Intel)
    Tested-by: Borislav Petkov
    Cc: Sebastian Andrzej Siewior
    Cc: linux-mm@kvack.org
    Cc: wfg@linux.intel.com
    Cc: kernel test robot
    Cc: LKP
    Link: http://lkml.kernel.org/r/20170320114108.kbvcsuepem45j5cr@hirez.programming.kicks-ass.net
    Signed-off-by: Thomas Gleixner

    Peter Zijlstra
     

16 Mar, 2017

1 commit

  • If a PER_CPU struct which contains a spin_lock is statically initialized
    via:

    DEFINE_PER_CPU(struct foo, bla) = {
    .lock = __SPIN_LOCK_UNLOCKED(bla.lock)
    };

    then lockdep assigns a seperate key to each lock because the logic for
    assigning a key to statically initialized locks is to use the address as
    the key. With per CPU locks the address is obvioulsy different on each CPU.

    That's wrong, because all locks should have the same key.

    To solve this the following modifications are required:

    1) Extend the is_kernel/module_percpu_addr() functions to hand back the
    canonical address of the per CPU address, i.e. the per CPU address
    minus the per CPU offset.

    2) Check the lock address with these functions and if the per CPU check
    matches use the returned canonical address as the lock key, so all per
    CPU locks have the same key.

    3) Move the static_obj(key) check into look_up_lock_class() so this check
    can be avoided for statically initialized per CPU locks. That's
    required because the canonical address fails the static_obj(key) check
    for obvious reasons.

    Reported-by: Mike Galbraith
    Signed-off-by: Thomas Gleixner
    [ Merged Dan's fixups for !MODULES and !SMP into this patch. ]
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Andrew Morton
    Cc: Dan Murphy
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20170227143736.pectaimkjkan5kow@linutronix.de
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

23 Feb, 2017

1 commit

  • Pull modules updates from Jessica Yu:
    "Summary of modules changes for the 4.11 merge window:

    - A few small code cleanups

    - Add modules git tree url to MAINTAINERS"

    * tag 'modules-for-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
    MAINTAINERS: add tree for modules
    module: fix memory leak on early load_module() failures
    module: Optimize search_module_extables()
    modules: mark __inittest/__exittest as __maybe_unused
    livepatch/module: print notice of TAINT_LIVEPATCH
    module: Drop redundant declaration of struct module

    Linus Torvalds
     

22 Feb, 2017

4 commits

  • Pull rodata updates from Kees Cook:
    "This renames the (now inaccurate) DEBUG_RODATA and related
    SET_MODULE_RONX configs to the more sensible STRICT_KERNEL_RWX and
    STRICT_MODULE_RWX"

    * tag 'rodata-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    arch: Rename CONFIG_DEBUG_RODATA and CONFIG_DEBUG_MODULE_RONX
    arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common

    Linus Torvalds
     
  • Pull exception table module split from Paul Gortmaker:
    "Final extable.h related changes.

    This completes the separation of exception table content from the
    module.h header file. This is achieved with the final commit that
    removes the one line back compatible change that sourced extable.h
    into the module.h file.

    The commits are unchanged since January, with the exception of a
    couple Acks that came in for the last two commits a bit later. The
    changes have been in linux-next for quite some time[1] and have got
    widespread arch coverage via toolchains I have and also from
    additional ones the kbuild bot has.

    Maintaners of the various arch were Cc'd during the postings to
    lkml[2] and informed that the intention was to take the remaining arch
    specific changes and lump them together with the final two non-arch
    specific changes and submit for this merge window.

    The ia64 diffstat stands out and probably warrants a mention. In an
    earlier review, Al Viro made a valid comment that the original header
    separation of content left something to be desired, and that it get
    fixed as a part of this change, hence the larger diffstat"

    * tag 'extable-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (21 commits)
    module.h: remove extable.h include now users have migrated
    core: migrate exception table users off module.h and onto extable.h
    cris: migrate exception table users off module.h and onto extable.h
    hexagon: migrate exception table users off module.h and onto extable.h
    microblaze: migrate exception table users off module.h and onto extable.h
    unicore32: migrate exception table users off module.h and onto extable.h
    score: migrate exception table users off module.h and onto extable.h
    metag: migrate exception table users off module.h and onto extable.h
    arc: migrate exception table users off module.h and onto extable.h
    nios2: migrate exception table users off module.h and onto extable.h
    sparc: migrate exception table users onto extable.h
    openrisc: migrate exception table users off module.h and onto extable.h
    frv: migrate exception table users off module.h and onto extable.h
    sh: migrate exception table users off module.h and onto extable.h
    xtensa: migrate exception table users off module.h and onto extable.h
    mn10300: migrate exception table users off module.h and onto extable.h
    alpha: migrate exception table users off module.h and onto extable.h
    arm: migrate exception table users off module.h and onto extable.h
    m32r: migrate exception table users off module.h and onto extable.h
    ia64: ensure exception table search users include extable.h
    ...

    Linus Torvalds
     
  • Pull audit updates from Paul Moore:
    "The audit changes for v4.11 are relatively small compared to what we
    did for v4.10, both in terms of size and impact.

    - two patches from Steve tweak the formatting for some of the audit
    records to make them more consistent with other audit records.

    - three patches from Richard record the name of a module on module
    load, fix the logging of sockaddr information when using
    socketcall() on 32-bit systems, and add the ability to reset
    audit's lost record counter.

    - my lone patch just fixes an annoying style nit that I was reminded
    about by one of Richard's patches.

    All these patches pass our test suite"

    * 'stable-4.11' of git://git.infradead.org/users/pcmoore/audit:
    audit: remove unnecessary curly braces from switch/case statements
    audit: log module name on init_module
    audit: log 32-bit socketcalls
    audit: add feature audit_lost reset
    audit: Make AUDIT_ANOM_ABEND event normalized
    audit: Make AUDIT_KERNEL event conform to the specification

    Linus Torvalds
     
  • While looking for early possible module loading failures I was
    able to reproduce a memory leak possible with kmemleak. There
    are a few rare ways to trigger a failure:

    o we've run into a failure while processing kernel parameters
    (parse_args() returns an error)
    o mod_sysfs_setup() fails
    o we're a live patch module and copy_module_elf() fails

    Chances of running into this issue is really low.

    kmemleak splat:

    unreferenced object 0xffff9f2c4ada1b00 (size 32):
    comm "kworker/u16:4", pid 82, jiffies 4294897636 (age 681.816s)
    hex dump (first 32 bytes):
    6d 65 6d 73 74 69 63 6b 30 00 00 00 00 00 00 00 memstick0.......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmemleak_alloc+0x4a/0xa0
    [] __kmalloc_track_caller+0x126/0x230
    [] kstrdup+0x31/0x60
    [] kstrdup_const+0x24/0x30
    [] kvasprintf_const+0x7a/0x90
    [] kobject_set_name_vargs+0x21/0x90
    [] dev_set_name+0x47/0x50
    [] memstick_check+0x95/0x33c [memstick]
    [] process_one_work+0x1f3/0x4b0
    [] worker_thread+0x48/0x4e0
    [] kthread+0xc9/0xe0
    [] ret_from_fork+0x1f/0x40
    [] 0xffffffffffffffff

    Cc: stable # v2.6.30
    Fixes: e180a6b7759a ("param: fix charp parameters set via sysfs")
    Reviewed-by: Miroslav Benes
    Reviewed-by: Aaron Tomlin
    Reviewed-by: Rusty Russell
    Acked-by: Kees Cook
    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Jessica Yu

    Luis R. Rodriguez
     

14 Feb, 2017

1 commit

  • This adds a new auxiliary record MODULE_INIT to the SYSCALL event.

    We get finit_module for free since it made most sense to hook this in to
    load_module().

    https://github.com/linux-audit/audit-kernel/issues/7
    https://github.com/linux-audit/audit-kernel/wiki/RFE-Module-Load-Record-Format

    Signed-off-by: Richard Guy Briggs
    Acked-by: Jessica Yu
    [PM: corrected links in the commit description]
    Signed-off-by: Paul Moore

    Richard Guy Briggs
     

11 Feb, 2017

1 commit


10 Feb, 2017

1 commit

  • These files were including module.h for exception table related
    functions. We've now separated that content out into its own file
    "extable.h" so now move over to that and where possible, avoid all
    the extra header content in module.h that we don't really need to
    compile these non-modular files.

    Note:
    init/main.c still needs module.h for __init_or_module
    kernel/extable.c still needs module.h for is_module_text_address

    ...and so we don't get the benefit of removing module.h from the cpp
    feed for these two files, unlike the almost universal 1:1 exchange
    of module.h for extable.h we were able to do in the arch dirs.

    Cc: Rusty Russell
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Acked-by: Jessica Yu
    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

08 Feb, 2017

1 commit

  • Both of these options are poorly named. The features they provide are
    necessary for system security and should not be considered debug only.
    Change the names to CONFIG_STRICT_KERNEL_RWX and
    CONFIG_STRICT_MODULE_RWX to better describe what these options do.

    Signed-off-by: Laura Abbott
    Acked-by: Jessica Yu
    Signed-off-by: Kees Cook

    Laura Abbott
     

04 Feb, 2017

1 commit

  • The modversion symbol CRCs are emitted as ELF symbols, which allows us
    to easily populate the kcrctab sections by relying on the linker to
    associate each kcrctab slot with the correct value.

    This has a couple of downsides:

    - Given that the CRCs are treated as memory addresses, we waste 4 bytes
    for each CRC on 64 bit architectures,

    - On architectures that support runtime relocation, a R__RELATIVE
    relocation entry is emitted for each CRC value, which identifies it
    as a quantity that requires fixing up based on the actual runtime
    load offset of the kernel. This results in corrupted CRCs unless we
    explicitly undo the fixup (and this is currently being handled in the
    core module code)

    - Such runtime relocation entries take up 24 bytes of __init space
    each, resulting in a x8 overhead in [uncompressed] kernel size for
    CRCs.

    Switching to explicit 32 bit values on 64 bit architectures fixes most
    of these issues, given that 32 bit values are not treated as quantities
    that require fixing up based on the actual runtime load offset. Note
    that on some ELF64 architectures [such as PPC64], these 32-bit values
    are still emitted as [absolute] runtime relocatable quantities, even if
    the value resolves to a build time constant. Since relative relocations
    are always resolved at build time, this patch enables MODULE_REL_CRCS on
    powerpc when CONFIG_RELOCATABLE=y, which turns the absolute CRC
    references into relative references into .rodata where the actual CRC
    value is stored.

    So redefine all CRC fields and variables as u32, and redefine the
    __CRC_SYMBOL() macro for 64 bit builds to emit the CRC reference using
    inline assembler (which is necessary since 64-bit C code cannot use
    32-bit types to hold memory addresses, even if they are ultimately
    resolved using values that do not exceed 0xffffffff). To avoid
    potential problems with legacy 32-bit architectures using legacy
    toolchains, the equivalent C definition of the kcrctab entry is retained
    for 32-bit architectures.

    Note that this mostly reverts commit d4703aefdbc8 ("module: handle ppc64
    relocating kcrctabs when CONFIG_RELOCATABLE=y")

    Acked-by: Rusty Russell
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Linus Torvalds

    Ard Biesheuvel
     

31 Jan, 2017

1 commit

  • Add back the "tainting kernel with TAINT_LIVEPATCH" kernel log message
    that commit 2992ef29ae01 ("livepatch/module: make TAINT_LIVEPATCH
    module-specific") dropped. Now that it's a module-specific taint flag,
    include the module name.

    Signed-off-by: Joe Lawrence
    Acked-by: Josh Poimboeuf
    Reviewed-by: Kamalesh Babulal
    Signed-off-by: Jessica Yu

    Joe Lawrence
     

18 Jan, 2017

1 commit

  • Commit 7fd8329ba502 ("taint/module: Clean up global and module taint
    flags handling") used the key words true and false as character members
    of a new struct. These names cause problems when out-of-kernel modules
    such as VirtualBox include their own definitions of true and false.

    Fixes: 7fd8329ba502 ("taint/module: Clean up global and module taint flags handling")
    Signed-off-by: Larry Finger
    Cc: Petr Mladek
    Cc: Jessica Yu
    Cc: Rusty Russell
    Reported-by: Valdis Kletnieks
    Reviewed-by: Petr Mladek
    Acked-by: Rusty Russell
    Signed-off-by: Jessica Yu

    Larry Finger
     

25 Dec, 2016

1 commit


15 Dec, 2016

1 commit

  • Pull modules updates from Jessica Yu:
    "Summary of modules changes for the 4.10 merge window:

    - The rodata= cmdline parameter has been extended to additionally
    apply to module mappings

    - Fix a hard to hit race between module loader error/clean up
    handling and ftrace registration

    - Some code cleanups, notably panic.c and modules code use a unified
    taint_flags table now. This is much cleaner than duplicating the
    taint flag code in modules.c"

    * tag 'modules-for-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
    module: fix DEBUG_SET_MODULE_RONX typo
    module: extend 'rodata=off' boot cmdline parameter to module mappings
    module: Fix a comment above strong_try_module_get()
    module: When modifying a module's text ignore modules which are going away too
    module: Ensure a module's state is set accordingly during module coming cleanup code
    module: remove trailing whitespace
    taint/module: Clean up global and module taint flags handling
    modpost: free allocated memory

    Linus Torvalds
     

30 Nov, 2016

1 commit

  • This enables CONFIG_MODVERSIONS again, but allows for missing symbol CRC
    information in order to work around the issue that newer binutils
    versions seem to occasionally drop the CRC on the floor. binutils 2.26
    seems to work fine, while binutils 2.27 seems to break MODVERSIONS of
    symbols that have been defined in assembler files.

    [ We've had random missing CRC's before - it may be an old problem that
    just is now reliably triggered with the weak asm symbols and a new
    version of binutils ]

    Some day I really do want to remove MODVERSIONS entirely. Sadly, today
    does not appear to be that day: Debian people apparently do want the
    option to enable MODVERSIONS to make it easier to have external modules
    across kernel versions, and this seems to be a fairly minimal fix for
    the annoying problem.

    Cc: Ben Hutchings
    Acked-by: Michal Marek
    Signed-off-by: Linus Torvalds

    Linus Torvalds