1. 20 Sep, 2024 5 commits
    • Masahiro Yamada's avatar
      kallsyms: change overflow variable to bool type · 9a418218
      Masahiro Yamada authored
      Change the 'overflow' variable to bool. Also, remove unnecessary
      parentheses.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      9a418218
    • Masahiro Yamada's avatar
      kallsyms: squash output_address() · 327df5bf
      Masahiro Yamada authored
      After commit 64e16609 ("kallsyms: get rid of code for absolute,
      kallsyms"), there is only one call site for output_address(). Squash it.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      327df5bf
    • Kris Van Hees's avatar
      kbuild: add install target for modules.builtin.ranges · ae70d708
      Kris Van Hees authored
      When CONFIG_BUILTIN_MODULE_RANGES is enabled, the modules.builtin.ranges
      file should be installed in the module install location.
      Signed-off-by: default avatarKris Van Hees <kris.van.hees@oracle.com>
      Reviewed-by: default avatarNick Alcock <nick.alcock@oracle.com>
      Tested-by: default avatarSam James <sam@gentoo.org>
      Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Tested-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      ae70d708
    • Kris Van Hees's avatar
      scripts: add verifier script for builtin module range data · ac7bd094
      Kris Van Hees authored
      The modules.builtin.ranges offset range data for builtin modules is
      generated at compile time based on the list of built-in modules and
      the vmlinux.map and vmlinux.o.map linker maps.  This data can be used
      to determine whether a symbol at a particular address belongs to
      module code that was configured to be compiled into the kernel proper
      as a built-in module (rather than as a standalone module).
      
      This patch adds a script that uses the generated modules.builtin.ranges
      data to annotate the symbols in the System.map with module names if
      their address falls within a range that belongs to one or more built-in
      modules.
      
      It then processes the vmlinux.map (and if needed, vmlinux.o.map) to
      verify the annotation:
      
        - For each top-level section:
           - For each object in the section:
              - Determine whether the object is part of a built-in module
                (using modules.builtin and the .*.cmd file used to compile
                 the object as suggested in [0])
              - For each symbol in that object, verify that the built-in
                module association (or lack thereof) matches the annotation
                given to the symbol.
      Signed-off-by: default avatarKris Van Hees <kris.van.hees@oracle.com>
      Reviewed-by: default avatarNick Alcock <nick.alcock@oracle.com>
      Reviewed-by: default avatarAlan Maguire <alan.maguire@oracle.com>
      Tested-by: default avatarSam James <sam@gentoo.org>
      Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Tested-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      ac7bd094
    • Kris Van Hees's avatar
      kbuild: generate offset range data for builtin modules · 5f5e7344
      Kris Van Hees authored
      Create file module.builtin.ranges that can be used to find where
      built-in modules are located by their addresses. This will be useful for
      tracing tools to find what functions are for various built-in modules.
      
      The offset range data for builtin modules is generated using:
       - modules.builtin: associates object files with module names
       - vmlinux.map: provides load order of sections and offset of first member
          per section
       - vmlinux.o.map: provides offset of object file content per section
       - .*.cmd: build cmd file with KBUILD_MODFILE
      
      The generated data will look like:
      
      .text 00000000-00000000 = _text
      .text 0000baf0-0000cb10 amd_uncore
      .text 0009bd10-0009c8e0 iosf_mbi
      ...
      .text 00b9f080-00ba011a intel_skl_int3472_discrete
      .text 00ba0120-00ba03c0 intel_skl_int3472_discrete intel_skl_int3472_tps68470
      .text 00ba03c0-00ba08d6 intel_skl_int3472_tps68470
      ...
      .data 00000000-00000000 = _sdata
      .data 0000f020-0000f680 amd_uncore
      
      For each ELF section, it lists the offset of the first symbol.  This can
      be used to determine the base address of the section at runtime.
      
      Next, it lists (in strict ascending order) offset ranges in that section
      that cover the symbols of one or more builtin modules.  Multiple ranges
      can apply to a single module, and ranges can be shared between modules.
      
      The CONFIG_BUILTIN_MODULE_RANGES option controls whether offset range data
      is generated for kernel modules that are built into the kernel image.
      
      How it works:
      
       1. The modules.builtin file is parsed to obtain a list of built-in
          module names and their associated object names (the .ko file that
          the module would be in if it were a loadable module, hereafter
          referred to as <kmodfile>).  This object name can be used to
          identify objects in the kernel compile because any C or assembler
          code that ends up into a built-in module will have the option
          -DKBUILD_MODFILE=<kmodfile> present in its build command, and those
          can be found in the .<obj>.cmd file in the kernel build tree.
      
          If an object is part of multiple modules, they will all be listed
          in the KBUILD_MODFILE option argument.
      
          This allows us to conclusively determine whether an object in the
          kernel build belong to any modules, and which.
      
       2. The vmlinux.map is parsed next to determine the base address of each
          top level section so that all addresses into the section can be
          turned into offsets.  This makes it possible to handle sections
          getting loaded at different addresses at system boot.
      
          We also determine an 'anchor' symbol at the beginning of each
          section to make it possible to calculate the true base address of
          a section at runtime (i.e. symbol address - symbol offset).
      
          We collect start addresses of sections that are included in the top
          level section.  This is used when vmlinux is linked using vmlinux.o,
          because in that case, we need to look at the vmlinux.o linker map to
          know what object a symbol is found in.
      
          And finally, we process each symbol that is listed in vmlinux.map
          (or vmlinux.o.map) based on the following structure:
      
          vmlinux linked from vmlinux.a:
      
            vmlinux.map:
              <top level section>
                <included section>  -- might be same as top level section)
                  <object>          -- built-in association known
                    <symbol>        -- belongs to module(s) object belongs to
                    ...
      
          vmlinux linked from vmlinux.o:
      
            vmlinux.map:
              <top level section>
                <included section>  -- might be same as top level section)
                  vmlinux.o         -- need to use vmlinux.o.map
                    <symbol>        -- ignored
                    ...
      
            vmlinux.o.map:
              <section>
                  <object>          -- built-in association known
                    <symbol>        -- belongs to module(s) object belongs to
                    ...
      
       3. As sections, objects, and symbols are processed, offset ranges are
          constructed in a straight-forward way:
      
            - If the symbol belongs to one or more built-in modules:
                - If we were working on the same module(s), extend the range
                  to include this object
                - If we were working on another module(s), close that range,
                  and start the new one
            - If the symbol does not belong to any built-in modules:
                - If we were working on a module(s) range, close that range
      Signed-off-by: default avatarKris Van Hees <kris.van.hees@oracle.com>
      Reviewed-by: default avatarNick Alcock <nick.alcock@oracle.com>
      Reviewed-by: default avatarAlan Maguire <alan.maguire@oracle.com>
      Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Tested-by: default avatarSam James <sam@gentoo.org>
      Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Tested-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5f5e7344
  2. 10 Sep, 2024 3 commits
  3. 09 Sep, 2024 1 commit
  4. 08 Sep, 2024 1 commit
  5. 07 Sep, 2024 5 commits
  6. 01 Sep, 2024 23 commits
  7. 31 Aug, 2024 2 commits
    • Kent Overstreet's avatar
      bcachefs: Mark more errors as autofix · 3d3020c4
      Kent Overstreet authored
      errors that are known to always be safe to fix should be autofix: this
      should be most errors even at this point, but that will need some
      thorough review.
      
      note that errors are still logged in the superblock, so we'll still know
      that they happened.
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      3d3020c4
    • Kent Overstreet's avatar
      bcachefs: Revert lockless buffered IO path · e3e69409
      Kent Overstreet authored
      We had a report of data corruption on nixos when building installer
      images.
      
      https://github.com/NixOS/nixpkgs/pull/321055#issuecomment-2184131334
      
      It seems that writes are being dropped, but only when issued by QEMU,
      and possibly only in snapshot mode. It's undetermined if it's write
      calls are being dropped or dirty folios.
      
      Further testing, via minimizing the original patch to just the change
      that skips the inode lock on non appends/truncates, reveals that it
      really is just not taking the inode lock that causes the corruption: it
      has nothing to do with the other logic changes for preserving write
      atomicity in corner cases.
      
      It's also kernel config dependent: it doesn't reproduce with the minimal
      kernel config that ktest uses, but it does reproduce with nixos's distro
      config. Bisection the kernel config initially pointer the finger at page
      migration or compaction, but it appears that was erroneous; we haven't
      yet determined what kernel config option actually triggers it.
      
      Sadly it appears this will have to be reverted since we're getting too
      close to release and my plate is full, but we'd _really_ like to fully
      debug it.
      
      My suspicion is that this patch is exposing a preexisting bug - the
      inode lock actually covers very little in IO paths, and we have a
      different lock (the pagecache add lock) that guards against races with
      truncate here.
      
      Fixes: 7e64c86c ("bcachefs: Buffered write path now can avoid the inode lock")
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      e3e69409