Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename sysfs device label attribute to group and minor time tweak #14

Open
wants to merge 303 commits into
base: master
Choose a base branch
from

Conversation

modelrockettier
Copy link
Contributor

@modelrockettier modelrockettier commented Jan 31, 2019

Inspired by this Reddit thread, I've changed the /sys/fs/bcachefs/<uuid>/dev-#/label attribute to /sys/fs/bcachefs/<uuid>/dev-#/group to more closely mirror the bcachefs format and show-super output (naming it "group" instead of "label").

Additionally, this replaces two current_kernel_time64() calls with calls to ktime_get_coarse_real_ts64() (to fix the time portion of #13). Also since ktime_get_coarse_real_ts64() was added in the 4.18 kernel, the change can be done now (unlike the chacha changes, which were done in 5.0).

bch2_btree_node_relock() and __bch2_btree_iter_relock() are now only
used for relocking, not upgrading or downgrading locks, so we can split
out bch2_btree_node_upgrade() and slim down the fast path.
also fix some dirent bugs
bch2_btree_iter_peek_slot() -> bch2_bkey_debugcheck() was popping,
because __bch2_btree_iter_peek_slot() was using KEY_TYPE_DELETED for an
extent hole
also factor out bch2_btree_iter_checks()
prep work for btree_iter_prev()
btree_node_merge -> get_sibling -> btree_node_lock could drop locks,
when using linked iterators
Fewer allocations, and to_disk/from_disk are considerably less sketchy
now

Signed-off-by: Kent Overstreet <[email protected]>
similar to the dirent bug - making struct bch_dirent and bch_xattr 8
byte aligned changed sizeof, and size calculations that used
sizeof(bch_xattr)/sizeof(bch_dirent) wrong
when looking up the unit, it was matching against the trailing null in
si_units

Signed-off-by: Kent Overstreet <[email protected]>
There was a missing set_btree_bset_end() call, leading to popped
assertions later. Also add a quick and dirty debug option for injecting
invalid keys.

Signed-off-by: Kent Overstreet <[email protected]>
so as to generate fewer transaction restarts

Signed-off-by: Kent Overstreet <[email protected]>
@koverstreet koverstreet force-pushed the master branch 3 times, most recently from e4b827e to b3a7824 Compare November 4, 2024 07:06
@koverstreet koverstreet force-pushed the master branch 3 times, most recently from 48c34ec to c7e3dd8 Compare November 15, 2024 01:20
koverstreet pushed a commit that referenced this pull request Nov 23, 2024
The kdump kernel is broken on SME systems with CONFIG_IMA_KEXEC=y enabled.
Debugging traced the issue back to

  b69a2af ("x86/kexec: Carry forward IMA measurement log on kexec").

Testing was previously not conducted on SME systems with CONFIG_IMA_KEXEC
enabled, which led to the oversight, with the following incarnation:

...
  ima: No TPM chip found, activating TPM-bypass!
  Loading compiled-in module X.509 certificates
  Loaded X.509 cert 'Build time autogenerated kernel key: 18ae0bc7e79b64700122bb1d6a904b070fef2656'
  ima: Allocated hash algorithm: sha256
  Oops: general protection fault, probably for non-canonical address 0xcfacfdfe6660003e: 0000 [#1] PREEMPT SMP NOPTI
  CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-rc2+ #14
  Hardware name: Dell Inc. PowerEdge R7425/02MJ3T, BIOS 1.20.0 05/03/2023
  RIP: 0010:ima_restore_measurement_list
  Call Trace:
   <TASK>
   ? show_trace_log_lvl
   ? show_trace_log_lvl
   ? ima_load_kexec_buffer
   ? __die_body.cold
   ? die_addr
   ? exc_general_protection
   ? asm_exc_general_protection
   ? ima_restore_measurement_list
   ? vprintk_emit
   ? ima_load_kexec_buffer
   ima_load_kexec_buffer
   ima_init
   ? __pfx_init_ima
   init_ima
   ? __pfx_init_ima
   do_one_initcall
   do_initcalls
   ? __pfx_kernel_init
   kernel_init_freeable
   kernel_init
   ret_from_fork
   ? __pfx_kernel_init
   ret_from_fork_asm
   </TASK>
  Modules linked in:
  ---[ end trace 0000000000000000 ]---
  ...
  Kernel panic - not syncing: Fatal exception
  Kernel Offset: disabled
  Rebooting in 10 seconds..

Adding debug printks showed that the stored addr and size of ima_kexec buffer
are not decrypted correctly like:

  ima: ima_load_kexec_buffer, buffer:0xcfacfdfe6660003e, size:0xe48066052d5df359

Three types of setup_data info

  — SETUP_EFI,
  - SETUP_IMA, and
  - SETUP_RNG_SEED

are passed to the kexec/kdump kernel. Only the ima_kexec buffer
experienced incorrect decryption. Debugging identified a bug in
early_memremap_is_setup_data(), where an incorrect range calculation
occurred due to the len variable in struct setup_data ended up only
representing the length of the data field, excluding the struct's size,
and thus leading to miscalculation.

Address a similar issue in memremap_is_setup_data() while at it.

  [ bp: Heavily massage. ]

Fixes: b3c72fc ("x86/boot: Introduce setup_indirect")
Signed-off-by: Baoquan He <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Acked-by: Tom Lendacky <[email protected]>
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
@koverstreet koverstreet force-pushed the master branch 7 times, most recently from 8903f5f to bc01863 Compare November 30, 2024 02:27
@koverstreet koverstreet force-pushed the master branch 8 times, most recently from f1d736e to f22a971 Compare December 8, 2024 05:20
@koverstreet koverstreet force-pushed the master branch 4 times, most recently from 23dec8a to dd7d7f2 Compare December 9, 2024 13:52
michaeladler pushed a commit to michaeladler/bcachefs that referenced this pull request Dec 11, 2024
[ Upstream commit 8619593 ]

I found the following bug in my fuzzer:

  UBSAN: array-index-out-of-bounds in drivers/net/wireless/ath/ath9k/htc_hst.c:26:51
  index 255 is out of range for type 'htc_endpoint [22]'
  CPU: 0 UID: 0 PID: 8 Comm: kworker/0:0 Not tainted 6.11.0-rc6-dirty koverstreet#14
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
  Workqueue: events request_firmware_work_func
  Call Trace:
   <TASK>
   dump_stack_lvl+0x180/0x1b0
   __ubsan_handle_out_of_bounds+0xd4/0x130
   htc_issue_send.constprop.0+0x20c/0x230
   ? _raw_spin_unlock_irqrestore+0x3c/0x70
   ath9k_wmi_cmd+0x41d/0x610
   ? mark_held_locks+0x9f/0xe0
   ...

Since this bug has been confirmed to be caused by insufficient verification
of conn_rsp_epid, I think it would be appropriate to add a range check for
conn_rsp_epid to htc_connect_service() to prevent the bug from occurring.

Fixes: fb9987d ("ath9k_htc: Support for AR9271 chipset.")
Signed-off-by: Jeongjun Park <[email protected]>
Acked-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
@koverstreet koverstreet force-pushed the master branch 2 times, most recently from 79c1539 to f8ed207 Compare December 12, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants