1. 23 Aug, 2024 4 commits
    • Alice Ryhl's avatar
      rust: list: add tracking for ListArc · a4802631
      Alice Ryhl authored
      Add the ability to track whether a ListArc exists for a given value,
      allowing for the creation of ListArcs without going through UniqueArc.
      
      The `impl_list_arc_safe!` macro is extended with a `tracked_by` strategy
      that defers the tracking of ListArcs to a field of the struct.
      Additionally, the AtomicListArcTracker type is introduced, which can
      track whether a ListArc exists using an atomic. By deferring the
      tracking to a field of type AtomicListArcTracker, structs gain the
      ability to create ListArcs without going through a UniqueArc.
      
      Rust Binder uses this for some objects where we want to be able to
      insert them into a linked list at any time. Using the
      AtomicListArcTracker, we are able to check whether an item is already in
      the list, and if not, we can create a `ListArc` and push it.
      
      The macro has the ability to defer the tracking of ListArcs to a field,
      using whatever strategy that field has. Since we don't add any
      strategies other than AtomicListArcTracker, another similar option would
      be to hard-code that the field should be an AtomicListArcTracker.
      However, Rust Binder has a case where the AtomicListArcTracker is not
      stored directly in the struct, but in a sub-struct. Furthermore, the
      outer struct is generic:
      
      struct Wrapper<T: ?Sized> {
          links: ListLinks,
          inner: T,
      }
      
      Here, the Wrapper struct implements ListArcSafe with `tracked_by inner`,
      and then the various types used with `inner` also uses the macro to
      implement ListArcSafe. Some of them use the untracked strategy, and some
      of them use tracked_by with an AtomicListArcTracker. This way, Wrapper
      just inherits whichever choice `inner` has made.
      Reviewed-by: default avatarBenno Lossin <benno.lossin@proton.me>
      Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Link: https://lore.kernel.org/r/20240814-linked-list-v5-3-f5f5e8075da0@google.comSigned-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      a4802631
    • Alice Ryhl's avatar
      rust: list: add ListArc · 6cd34171
      Alice Ryhl authored
      The `ListArc` type can be thought of as a special reference to a
      refcounted object that owns the permission to manipulate the
      `next`/`prev` pointers stored in the refcounted object. By ensuring that
      each object has only one `ListArc` reference, the owner of that
      reference is assured exclusive access to the `next`/`prev` pointers.
      When a `ListArc` is inserted into a `List`, the `List` takes ownership
      of the `ListArc` reference.
      
      There are various strategies for ensuring that a value has only one
      `ListArc` reference. The simplest is to convert a `UniqueArc` into a
      `ListArc`. However, the refcounted object could also keep track of
      whether a `ListArc` exists using a boolean, which could allow for the
      creation of new `ListArc` references from an `Arc` reference. Whatever
      strategy is used, the relevant tracking is referred to as "the tracking
      inside `T`", and the `ListArcSafe` trait (and its subtraits) are used to
      update the tracking when a `ListArc` is created or destroyed.
      
      Note that we allow the case where the tracking inside `T` thinks that a
      `ListArc` exists, but actually, there isn't a `ListArc`. However, we do
      not allow the opposite situation where a `ListArc` exists, but the
      tracking thinks it doesn't. This is because the former can at most
      result in us failing to create a `ListArc` when the operation could
      succeed, whereas the latter can result in the creation of two `ListArc`
      references. Only the latter situation can lead to memory safety issues.
      
      This patch introduces the `impl_list_arc_safe!` macro that allows you to
      implement `ListArcSafe` for types using the strategy where a `ListArc`
      can only be created from a `UniqueArc`. Other strategies are introduced
      in later patches.
      
      This is part of the linked list that Rust Binder will use for many
      different things. The strategy where a `ListArc` can only be created
      from a `UniqueArc` is actually sufficient for most of the objects that
      Rust Binder needs to insert into linked lists. Usually, these are todo
      items that are created and then immediately inserted into a queue.
      
      The const generic ID allows objects to have several prev/next pointer
      pairs so that the same object can be inserted into several different
      lists. You are able to have several `ListArc` references as long as they
      correspond to different pointer pairs. The ID itself is purely a
      compile-time concept and will not be present in the final binary. Both
      the `List` and the `ListArc` will need to agree on the ID for them to
      work together. Rust Binder uses this in a few places (e.g. death
      recipients) where the same object can be inserted into both generic todo
      lists and some other lists for tracking the status of the object.
      
      The ID is a const generic rather than a type parameter because the
      `pair_from_unique` method needs to be able to assert that the two ids
      are different. There's no easy way to assert that when using types
      instead of integers.
      Reviewed-by: default avatarBenno Lossin <benno.lossin@proton.me>
      Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Link: https://lore.kernel.org/r/20240814-linked-list-v5-2-f5f5e8075da0@google.comSigned-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      6cd34171
    • Benno Lossin's avatar
      rust: init: add `assert_pinned` macro · 0528ca0a
      Benno Lossin authored
      Add a macro to statically check if a field of a struct is marked with
      `#[pin]` ie that it is structurally pinned. This can be used when
      `unsafe` code needs to rely on fields being structurally pinned.
      
      The macro has a special "inline" mode for the case where the type
      depends on generic parameters from the surrounding scope.
      Signed-off-by: default avatarBenno Lossin <benno.lossin@proton.me>
      Co-developed-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Link: https://lore.kernel.org/r/20240814-linked-list-v5-1-f5f5e8075da0@google.com
      [ Replaced `compile_fail` with `ignore` and a TODO note. Removed
        `pub` from example to clean `unreachable_pub` lint. - Miguel ]
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      0528ca0a
    • Matthew Maurer's avatar
      rust: support arrays in target JSON · c6945aca
      Matthew Maurer authored
      Some configuration options such as the supported sanitizer list are
      arrays. To support using Rust with sanitizers on x86, we must update the
      target.json generator to support this case.
      
      The Push trait is removed in favor of the From trait because the Push
      trait doesn't work well in the nested case where you are not really
      pushing values to a TargetSpec.
      Signed-off-by: default avatarMatthew Maurer <mmaurer@google.com>
      Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Reviewed-by: default avatarGary Guo <gary@garyguo.net>
      Tested-by: default avatarGatlin Newhouse <gatlin.newhouse@gmail.com>
      Link: https://lore.kernel.org/r/20240730-target-json-arrays-v1-1-2b376fd0ecf4@google.comSigned-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      c6945aca
  2. 21 Aug, 2024 2 commits
  3. 20 Aug, 2024 2 commits
  4. 19 Aug, 2024 1 commit
  5. 18 Aug, 2024 21 commits
  6. 17 Aug, 2024 8 commits
    • Linus Torvalds's avatar
      Merge tag 'v6.11-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · e0fac5fc
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
      
       - fix for clang warning - additional null check
      
       - fix for cached write with posix locks
      
       - flexible structure fix
      
      * tag 'v6.11-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        smb: smb2pdu.h: Use static_assert() to check struct sizes
        smb3: fix lock breakage for cached writes
        smb/client: avoid possible NULL dereference in cifs_free_subrequest()
      e0fac5fc
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 98a1b2d7
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "I2C core fix replacing IS_ENABLED() with IS_REACHABLE()
      
        For host drivers, there are two fixes:
      
         - Tegra I2C Controller: Addresses a potential double-locking issue
           during probe. ACPI devices are not IRQ-safe when invoking runtime
           suspend and resume functions, so the irq_safe flag should not be
           set.
      
         - Qualcomm GENI I2C Controller: Fixes an oversight in the exit path
           of the runtime_resume() function, which was missed in the previous
           release"
      
      * tag 'i2c-for-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: tegra: Do not mark ACPI devices as irq safe
        i2c: Use IS_REACHABLE() for substituting empty ACPI functions
        i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume
      98a1b2d7
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · df6cbc62
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Two small fixes to the mpi3mr driver. One to avoid oversize
        allocations in tracing and the other to fix an uninitialized spinlock
        in the user to driver feature request code (used to trigger dumps and
        the like)"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: mpi3mr: Avoid MAX_PAGE_ORDER WARNING for buffer allocations
        scsi: mpi3mr: Add missing spin_lock_init() for mrioc->trigger_lock
      df6cbc62
    • Linus Torvalds's avatar
      Merge tag 'xfs-6.11-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · d09840f8
      Linus Torvalds authored
      Pull xfs fixes from Chandan Babu:
      
       - Check for presence of only 'attr' feature before scrubbing an inode's
         attribute fork.
      
       - Restore the behaviour of setting AIL thread to TASK_INTERRUPTIBLE for
         long (i.e. 50ms) sleep durations to prevent high load averages.
      
       - Do not allow users to change the realtime flag of a file unless the
         datadev and rtdev both support fsdax access modes.
      
      * tag 'xfs-6.11-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: conditionally allow FS_XFLAG_REALTIME changes if S_DAX is set
        xfs: revert AIL TASK_KILLABLE threshold
        xfs: attr forks require attr, not attr2
      d09840f8
    • Linus Torvalds's avatar
      Merge tag 'bcachefs-2024-08-16' of git://evilpiepirate.org/bcachefs · b7181758
      Linus Torvalds authored
      Pull bcachefs fixes from Kent OverstreetL
      
       - New on disk format version, bcachefs_metadata_version_disk_accounting_inum
      
         This adds one more disk accounting counter, which counts disk usage
         and number of extents per inode number. This lets us track
         fragmentation, for implementing defragmentation later, and it also
         counts disk usage per inode in all snapshots, which will be a useful
         thing to expose to users.
      
       - One performance issue we've observed is threads spinning when they
         should be waiting for dirty keys in the key cache to be flushed by
         journal reclaim, so we now have hysteresis for the waiting thread, as
         well as improving the tracepoint and a new time_stat, for tracking
         time blocked waiting on key cache flushing.
      
      ... and various assorted smaller fixes.
      
      * tag 'bcachefs-2024-08-16' of git://evilpiepirate.org/bcachefs:
        bcachefs: Fix locking in __bch2_trans_mark_dev_sb()
        bcachefs: fix incorrect i_state usage
        bcachefs: avoid overflowing LRU_TIME_BITS for cached data lru
        bcachefs: Fix forgetting to pass trans to fsck_err()
        bcachefs: Increase size of cuckoo hash table on too many rehashes
        bcachefs: bcachefs_metadata_version_disk_accounting_inum
        bcachefs: Kill __bch2_accounting_mem_mod()
        bcachefs: Make bkey_fsck_err() a wrapper around fsck_err()
        bcachefs: Fix warning in __bch2_fsck_err() for trans not passed in
        bcachefs: Add a time_stat for blocked on key cache flush
        bcachefs: Improve trans_blocked_journal_reclaim tracepoint
        bcachefs: Add hysteresis to waiting on btree key cache flush
        lib/generic-radix-tree.c: Fix rare race in __genradix_ptr_alloc()
        bcachefs: Convert for_each_btree_node() to lockrestart_do()
        bcachefs: Add missing downgrade table entry
        bcachefs: disk accounting: ignore unknown types
        bcachefs: bch2_accounting_invalid() fixup
        bcachefs: Fix bch2_trigger_alloc when upgrading from old versions
        bcachefs: delete faulty fastpath in bch2_btree_path_traverse_cached()
      b7181758
    • Kent Overstreet's avatar
      bcachefs: Fix locking in __bch2_trans_mark_dev_sb() · 0e49d3ff
      Kent Overstreet authored
      We run this in full RW mode now, so we have to guard against the
      superblock buffer being reallocated.
      Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
      0e49d3ff
    • Linus Torvalds's avatar
      Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · e5fa841a
      Linus Torvalds authored
      Pull memcg-v1 fix from Al Viro:
       "memcg_write_event_control() oops fix"
      
      * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        memcg_write_event_control(): fix a user-triggerable oops
      e5fa841a
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · c2cdb13a
      Linus Torvalds authored
      Pull arm64 fixes from Catalin Marinas:
      
       - Fix the arm64 __get_mem_asm() to use the _ASM_EXTABLE_##type##ACCESS()
         macro instead of the *_ERR() one in order to avoid writing -EFAULT to
         the value register in case of a fault
      
       - Initialise all elements of the acpi_early_node_map[] to NUMA_NO_NODE.
         Prior to this fix, only the first element was initialised
      
       - Move the KASAN random tag seed initialisation after the per-CPU areas
         have been initialised (prng_state is __percpu)
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: Fix KASAN random tag seed initialization
        arm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
        arm64: uaccess: correct thinko in __get_mem_asm()
      c2cdb13a
  7. 16 Aug, 2024 2 commits