Commit ef778588 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'bcachefs-2025-04-10' of git://evilpiepirate.org/bcachefs

Pull bcachefs fixes from Kent Overstreet:
 "Mostly minor fixes.

  Eric Biggers' crypto API conversion is included because of long
  standing sporadic crashes - mostly, but not entirely syzbot - in the
  crypto API code when calling poly1305, which have been nigh impossible
  to reproduce and debug.

  His rework deletes the code where we've seen the crashes, so either
  it'll be a fix or we'll end up with backtraces we can debug. (Thanks
  Eric!)"

* tag 'bcachefs-2025-04-10' of git://evilpiepirate.org/bcachefs:
  bcachefs: Use sort_nonatomic() instead of sort()
  bcachefs: Remove unnecessary softdep on xxhash
  bcachefs: use library APIs for ChaCha20 and Poly1305
  bcachefs: Fix duplicate "ro,read_only" in opts at startup
  bcachefs: Fix UAF in bchfs_read()
  bcachefs: Use cpu_to_le16 for dirent lengths
  bcachefs: Fix type for parameter in journal_advance_devs_to_next_bucket
  bcachefs: Fix escape sequence in prt_printf
parents 0c7cae12 55fd97fb
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -15,10 +15,9 @@ config BCACHEFS_FS
	select ZLIB_INFLATE
	select ZSTD_COMPRESS
	select ZSTD_DECOMPRESS
	select CRYPTO
	select CRYPTO_LIB_SHA256
	select CRYPTO_CHACHA20
	select CRYPTO_POLY1305
	select CRYPTO_LIB_CHACHA
	select CRYPTO_LIB_POLY1305
	select KEYS
	select RAID6_PQ
	select XOR_BLOCKS
+2 −2
Original line number Diff line number Diff line
@@ -981,8 +981,8 @@ struct bch_fs {
	mempool_t		compress_workspace[BCH_COMPRESSION_OPT_NR];
	size_t			zstd_workspace_size;

	struct crypto_sync_skcipher *chacha20;
	struct crypto_shash	*poly1305;
	struct bch_key		chacha20_key;
	bool			chacha20_key_set;

	atomic64_t		key_version;

+2 −3
Original line number Diff line number Diff line
@@ -644,8 +644,6 @@ void bch2_btree_and_journal_iter_init_node_iter(struct btree_trans *trans,
 */
static int journal_sort_key_cmp(const void *_l, const void *_r)
{
	cond_resched();

	const struct journal_key *l = _l;
	const struct journal_key *r = _r;

@@ -689,7 +687,8 @@ void bch2_journal_keys_put(struct bch_fs *c)

static void __journal_keys_sort(struct journal_keys *keys)
{
	sort(keys->data, keys->nr, sizeof(keys->data[0]), journal_sort_key_cmp, NULL);
	sort_nonatomic(keys->data, keys->nr, sizeof(keys->data[0]),
		       journal_sort_key_cmp, NULL);

	cond_resched();

+3 −3
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca,
		return;

	if (bch2_csum_type_is_encryption(BSET_CSUM_TYPE(&bn->keys))) {
		if (!c->chacha20)
		if (!c->chacha20_key_set)
			return;

		struct nonce nonce = btree_nonce(&bn->keys, 0);
@@ -398,7 +398,7 @@ int bch2_scan_for_btree_nodes(struct bch_fs *c)
		bch2_print_string_as_lines(KERN_INFO, buf.buf);
	}

	sort(f->nodes.data, f->nodes.nr, sizeof(f->nodes.data[0]), found_btree_node_cmp_cookie, NULL);
	sort_nonatomic(f->nodes.data, f->nodes.nr, sizeof(f->nodes.data[0]), found_btree_node_cmp_cookie, NULL);

	dst = 0;
	darray_for_each(f->nodes, i) {
@@ -418,7 +418,7 @@ int bch2_scan_for_btree_nodes(struct bch_fs *c)
	}
	f->nodes.nr = dst;

	sort(f->nodes.data, f->nodes.nr, sizeof(f->nodes.data[0]), found_btree_node_cmp_pos, NULL);
	sort_nonatomic(f->nodes.data, f->nodes.nr, sizeof(f->nodes.data[0]), found_btree_node_cmp_pos, NULL);

	if (0 && c->opts.verbose) {
		printbuf_reset(&buf);
+4 −4
Original line number Diff line number Diff line
@@ -428,7 +428,7 @@ static int bch2_btree_write_buffer_flush_locked(struct btree_trans *trans)
		 */
		trace_and_count(c, write_buffer_flush_slowpath, trans, slowpath, wb->flushing.keys.nr);

		sort(wb->flushing.keys.data,
		sort_nonatomic(wb->flushing.keys.data,
			       wb->flushing.keys.nr,
			       sizeof(wb->flushing.keys.data[0]),
			       wb_key_seq_cmp, NULL);
Loading