6.3.13-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 427/431 smb: client: fix shared DFS root mounts with different prefixes
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
[ Upstream commit 3ae872de410751fe5e629e04da491a632d95201c ]
When having two DFS root mounts that are connected to same namespace, same mount options but different prefix paths, we can't really use the shared @server->origin_fullpath when chasing DFS links in them.
Move the origin_fullpath field to cifs_tcon structure so when having shared DFS root mounts with different prefix paths, and we need to chase any DFS links, dfs_get_automount_devname() will pick up the correct full path out of the @tcon that will be used for the new mount.
Before patch
mount.cifs //dom/dfs/dir /mnt/1 -o ...
mount.cifs //dom/dfs /mnt/2 -o ...
# shared server, ses, tcon # server: origin_fullpath=//dom/dfs/dir
# @server->origin_fullpath + '/dir/link1'
$ ls /mnt/2/dir/link1 ls: cannot open directory '/mnt/2/dir/link1': No such file or directory
After patch
mount.cifs //dom/dfs/dir /mnt/1 -o ...
mount.cifs //dom/dfs /mnt/2 -o ...
# shared server & ses # tcon_1: origin_fullpath=//dom/dfs/dir # tcon_2: origin_fullpath=//dom/dfs
# @tcon_2->origin_fullpath + '/dir/link1'
$ ls /mnt/2/dir/link1 dir0 dir1 dir10 dir3 dir5 dir6 dir7 dir9 target2_file.txt tsub
--- fs/cifs/cifs_debug.c | 16 +++++----- fs/cifs/cifsglob.h | 10 +++---- fs/cifs/cifsproto.h | 2 +- fs/cifs/connect.c | 70 +++++++++++++++++++++++++------------------- fs/cifs/dfs.c | 55 +++++++++++++--------------------- fs/cifs/dfs.h | 19 ++++++------ fs/cifs/dfs_cache.c | 8 +++-- fs/cifs/misc.c | 38 ++++++++++++++++++------ 8 files changed, 118 insertions(+), 100 deletions(-)
fs/cifs/cifs_debug.c +9 -7
@@ -121,6 +121,12 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)seq_puts (m," nosparse" );if (tcon->need_reconnect)seq_puts (m,"\tDISCONNECTED " ); +spin_lock (&tcon->tc_lock); +if (tcon->origin_fullpath) { +seq_printf (m,"\n\tDFS origin fullpath: %s" , + tcon->origin_fullpath); + } +spin_unlock (&tcon->tc_lock);seq_putc (m,'\n' ); }
@@ -377,13 +383,9 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\nIn Send: %d In MaxReq Wait: %d" ,atomic_read (&server->in_send),atomic_read (&server->num_waiters)); -if (IS_ENABLED (CONFIG_CIFS_DFS_UPCALL )) { -if (server->origin_fullpath) -seq_printf (m,"\nDFS origin full path: %s" , - server->origin_fullpath); -if (server->leaf_fullpath) -seq_printf (m,"\nDFS leaf full path: %s" , - server->leaf_fullpath); +if (server->leaf_fullpath) { +seq_printf (m,"\nDFS leaf full path: %s" , + server->leaf_fullpath); }seq_printf (m,"\n\n\tSessions: " );
fs/cifs/cifsglob.h +4 -6
@@ -736,23 +736,20 @@ struct TCP_Server_Info {#endif struct mutex refpath_lock;/* protects leaf_fullpath */ /* -* origin_fullpath: Canonical copy of smb3_fs_context::source. -* It is used for matching existing DFS tcons. -* * leaf_fullpath: Canonical DFS referral path related to this * connection. * It is used in DFS cache refresher, reconnect and may * change due to nested DFS links. * -* Both protected by @refpath_lock and @srv_lock. The @refpath_lock is -* mosly used for not requiring a copy of @leaf_fullpath when getting +* Protected by @refpath_lock and @srv_lock. The @refpath_lock is +* mostly used for not requiring a copy of @leaf_fullpath when getting * cached or new DFS referrals (which might also sleep during I/O). * While @srv_lock is held for making string and NULL comparions against * both fields as in mount(2) and cache refresh. * * format: \\HOST\SHARE[\OPTIONAL PATH] */ -char *origin_fullpath, *leaf_fullpath; +char *leaf_fullpath; };static inline bool is_smb1 (struct TCP_Server_Info *server)
@@ -1242,6 +1239,7 @@ struct cifs_tcon {struct delayed_work dfs_cache_work;#endif struct delayed_work query_interfaces;/* query interfaces workqueue job */ +char *origin_fullpath;/* canonical copy of smb3_fs_context::source */ };/*
fs/cifs/cifsproto.h +1 -1
@@ -649,7 +649,7 @@ int smb2_parse_query_directory(struct cifs_tcon *tcon, struct kvec *rsp_iov,int resp_buftype, struct cifs_search_info *srch_inf); -struct super_block *cifs_get_tcp_super (struct TCP_Server_Info *server); +struct super_block *cifs_get_dfs_tcon_super (struct cifs_tcon *tcon);void cifs_put_tcp_super (struct super_block *sb);int cifs_update_super_prepath (struct cifs_sb_info *cifs_sb,char *prefix);char *extract_hostname (const char *unc);
fs/cifs/connect.c +40 -30
132 lines not on this page · raw message
fs/cifs/dfs.c +21 -34
109 lines not on this page · raw message
fs/cifs/dfs.h +9 -10
@@ -39,16 +39,15 @@ static inline char *dfs_get_automount_devname(struct dentry *dentry, void *page) {struct cifs_sb_info *cifs_sb =CIFS_SB (dentry->d_sb);struct cifs_tcon *tcon =cifs_sb_master_tcon (cifs_sb); -struct TCP_Server_Info *server = tcon->ses->server;size_t len;char *s; -spin_lock (&server->srv_lock); -if (unlikely (!server->origin_fullpath)) { -spin_unlock (&server->srv_lock); +spin_lock (&tcon->tc_lock); +if (unlikely (!tcon->origin_fullpath)) { +spin_unlock (&tcon->tc_lock);return ERR_PTR (-EREMOTE ); } -spin_unlock (&server->srv_lock); +spin_unlock (&tcon->tc_lock); s =dentry_path_raw (dentry, page,PATH_MAX );if (IS_ERR (s))
@@ -57,16 +56,16 @@ static inline char *dfs_get_automount_devname(struct dentry *dentry, void *page)if (!s[1 ]) s++; -spin_lock (&server->srv_lock); - len =strlen (server->origin_fullpath); +spin_lock (&tcon->tc_lock); + len =strlen (tcon->origin_fullpath);if (s < (char *)page + len) { -spin_unlock (&server->srv_lock); +spin_unlock (&tcon->tc_lock);return ERR_PTR (-ENAMETOOLONG ); } s -= len; -memcpy (s, server->origin_fullpath, len); -spin_unlock (&server->srv_lock); +memcpy (s, tcon->origin_fullpath, len); +spin_unlock (&tcon->tc_lock);convert_delimiter (s,'/' );return s;
fs/cifs/dfs_cache.c +5 -3
@@ -1248,18 +1248,20 @@ static int refresh_tcon(struct cifs_tcon *tcon, bool force_refresh)int dfs_cache_remount_fs (struct cifs_sb_info *cifs_sb) {struct cifs_tcon *tcon; -struct TCP_Server_Info *server;if (!cifs_sb || !cifs_sb->master_tlink)return -EINVAL ; tcon =cifs_sb_master_tcon (cifs_sb); - server = tcon->ses->server; -if (!server->origin_fullpath) { +spin_lock (&tcon->tc_lock); +if (!tcon->origin_fullpath) { +spin_unlock (&tcon->tc_lock);cifs_dbg (FYI ,"%s: not a dfs mount\n" , __func__);return 0 ; } +spin_unlock (&tcon->tc_lock); +/* * After reconnecting to a different server, unique ids won't match anymore, so we disable * serverino. This prevents dentry revalidation to think the dentry are stale (ESTALE).
fs/cifs/misc.c +29 -9
@@ -156,6 +156,7 @@ tconInfoFree(struct cifs_tcon *tcon)#ifdef CONFIG_CIFS_DFS_UPCALL dfs_put_root_smb_sessions (&tcon->dfs_ses_list);#endif +kfree (tcon->origin_fullpath);kfree (tcon); }
@@ -1106,20 +1107,25 @@ struct super_cb_data {struct super_block *sb; }; -static void tcp_super_cb (struct super_block *sb,void *arg) +static void tcon_super_cb (struct super_block *sb,void *arg) {struct super_cb_data *sd = arg; -struct TCP_Server_Info *server = sd->data;struct cifs_sb_info *cifs_sb; -struct cifs_tcon *tcon; +struct cifs_tcon *t1 = sd->data, *t2;if (sd->sb)return ; cifs_sb =CIFS_SB (sb); - tcon =cifs_sb_master_tcon (cifs_sb); -if (tcon->ses->server == server) + t2 =cifs_sb_master_tcon (cifs_sb); + +spin_lock (&t2->tc_lock); +if (t1->ses == t2->ses && + t1->ses->server == t2->ses->server && + t2->origin_fullpath && +dfs_src_pathname_equal (t2->origin_fullpath, t1->origin_fullpath)) sd->sb = sb; +spin_unlock (&t2->tc_lock); } static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void *),
@@ -1145,6 +1151,7 @@ static struct super_block *__cifs_get_super(void (*f)(struct super_block *, voidreturn sd.sb; } } +pr_warn_once ("%s: could not find dfs superblock\n" , __func__);return ERR_PTR (-EINVAL ); }
@@ -1154,9 +1161,15 @@ static void __cifs_put_super(struct super_block *sb)cifs_sb_deactive (sb); } -struct super_block *cifs_get_tcp_super (struct TCP_Server_Info *server) +struct super_block *cifs_get_dfs_tcon_super (struct cifs_tcon *tcon) { -return __cifs_get_super (tcp_super_cb, server); +spin_lock (&tcon->tc_lock); +if (!tcon->origin_fullpath) { +spin_unlock (&tcon->tc_lock); +return ERR_PTR (-ENOENT ); + } +spin_unlock (&tcon->tc_lock); +return __cifs_get_super (tcon_super_cb, tcon); }void cifs_put_tcp_super (struct super_block *sb)
@@ -1238,9 +1251,16 @@ int cifs_inval_name_dfs_link_error(const unsigned int xid,*/ if (strlen (full_path) <2 || !cifs_sb || (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_DFS ) || - !is_tcon_dfs (tcon) || !ses->server->origin_fullpath) + !is_tcon_dfs (tcon))return 0 ; +spin_lock (&tcon->tc_lock); +if (!tcon->origin_fullpath) { +spin_unlock (&tcon->tc_lock); +return 0 ; + } +spin_unlock (&tcon->tc_lock); +/* * Slow path - tcon is DFS and @full_path has prefix path, so attempt * to get a referral to figure out whether it is an DFS link.
@@ -1264,7 +1284,7 @@ int cifs_inval_name_dfs_link_error(const unsigned int xid,/* * XXX: we are not using dfs_cache_find() here because we might -* end filling all the DFS cache and thus potentially +* end up filling all the DFS cache and thus potentially * removing cached DFS targets that the client would eventually * need during failover. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 428/431 ksmbd: avoid field overflow warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 9cedc58bdbe9fff9aacd0ca19ee5777659f28fd7 ]
clang warns about a possible field overflow in a memcpy:
In file included from fs/smb/server/smb_common.c:7:include/linux/fortify-string.h:583:4: error: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
__write_overflow_field(p_size_field, size);
It appears to interpret the "&out[baselen + 4]" as referring to a single byte of the character array, while the equivalen "out + baselen + 4" is seen as an offset into the array.
I don't see that kind of warning elsewhere, so just go with the simple rework.
--- fs/ksmbd/smb_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ksmbd/smb_common.c +1 -1
@@ -536,7 +536,7 @@ int ksmbd_extract_shortname(struct ksmbd_conn *conn, const char *longname, out[baselen +3 ] =PERIOD ;if (dot_present) -memcpy (&out[baselen +4 ], extension,4 ); +memcpy (out + baselen +4 , extension,4 );else out[baselen +4 ] ='\0' ; smbConvertToUTF16((__le16 *)shortname, out, PATH_MAX,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 429/431 arm64: sme: Use STR P to clear FFR context field in streaming SVE mode
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
[ Upstream commit 893b24181b4c4bf1fa2841b1ed192e5413a97cb1 ]
The FFR is a predicate register which can vary between 16 and 256 bits in size depending upon the configured vector length. When saving the SVE state in streaming SVE mode, the FFR register is inaccessible and so commit 9f5848665788 ("arm64/sve: Make access to FFR optional") simply clears the FFR field of the in-memory context structure. Unfortunately, it achieves this using an unconditional 8-byte store and so if the SME vector length is anything other than 64 bytes in size we will either fail to clear the entire field or, worse, we will corrupt memory immediately following the structure. This has led to intermittent kfence splats in CI [1] and can trigger kmalloc Redzone corruption messages when running the 'fp-stress' kselftest:
| ============================================================================= | BUG kmalloc-1k (Not tainted): kmalloc Redzone overwritten | ----------------------------------------------------------------------------- | | 0xffff000809bf1e22-0xffff000809bf1e27 @offset=7714. First byte 0x0 instead of 0xcc | Allocated in do_sme_acc+0x9c/0x220 age=2613 cpu=1 pid=531 | __kmalloc+0x8c/0xcc | do_sme_acc+0x9c/0x220 | ...
Replace the 8-byte store with a store of a predicate register which has been zero-initialised with PFALSE, ensuring that the entire field is cleared in memory.
[1] https://lore.kernel.org/r/CA+G9fYtU7HsV0R0dp4XEH5xXHSJFw8KyDf5VQrLLfMxWfxQkag@mail.gmail.com
--- arch/arm64/include/asm/fpsimdmacros.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/fpsimdmacros.h +3 -3
@@ -316,12 +316,12 @@ _for n, 0, 15, _sve_str_p \n, \nxbase, \n - 16 cbz \save_ffr, 921f _sve_rdffr 0 - _sve_str_p 0, \nxbase - _sve_ldr_p 0, \nxbase, -16 b 922f 921: - str xzr, [x\nxbase] // Zero out FFR + _sve_pfalse 0 // Zero out FFR 922: + _sve_str_p 0, \nxbase + _sve_ldr_p 0, \nxbase, -16 mrs x\nxtmp, fpsr str w\nxtmp, [\xpfpsr] mrs x\nxtmp, fpcr
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 430/431 x86/efi: Make efi_set_virtual_address_map IBT safe
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 0303c9729afc4094ef53e552b7b8cff7436028d6 ]
Niklāvs reported a boot regression on an Alderlake machine and bisected it to commit 9df9d2f0471b ("init: Invoke arch_cpu_finalize_init() earlier").
By moving the invocation of arch_cpu_finalize_init() further down he identified that efi_enter_virtual_mode() is the function which causes the boot hang.
The main difference of the earlier invocation is that the boot CPU is already fully initialized and mitigations and alternatives are applied.
But the only really interesting change turned out to be IBT, which is now enabled before efi_enter_virtual_mode(). "ibt=off" on the kernel command line cured the problem.
Inspection of the involved calls in efi_enter_virtual_mode() unearthed that efi_set_virtual_address_map() is the only place in the kernel which invokes an EFI call without the IBT safe wrapper. This went obviously unnoticed so far as IBT was enabled later.
Use arch_efi_call_virt() instead of efi_call() to cure that.
--- arch/x86/platform/efi/efi_64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/platform/efi/efi_64.c +3 -3
@@ -853,9 +853,9 @@ efi_set_virtual_address_map(unsigned long memory_map_size,/* Disable interrupts around EFI calls: */ local_irq_save (flags); - status =efi_call (efi.runtime->set_virtual_address_map, - memory_map_size, descriptor_size, - descriptor_version, virtual_map); + status =arch_efi_call_virt (efi.runtime, set_virtual_address_map, + memory_map_size, descriptor_size, + descriptor_version, virtual_map);local_irq_restore (flags);efi_fpu_end ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 431/431 md/raid1-10: fix casting from randomized structure in raid1_submit_write()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
commit b5a99602b74bbfa655be509c615181dd95b0719e upstream.
Following build error triggered while build with clang version 17.0.0 with W=1(this can't be reporduced with gcc 13.1.0):
drivers/md/raid1-10.c:117:25: error: casting from randomized structure pointer type 'struct block_device *' to 'struct md_rdev *'
117 | struct md_rdev *rdev = (struct md_rdev *)bio->bi_bdev;
| ^Fix this by casting 'bio->bi_bdev' to 'void *', as it used to be.
--- drivers/md/raid1-10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid1-10.c +1 -1
@@ -113,7 +113,7 @@ static void md_bio_reset_resync_pages(ststatic inline void raid1_submit_write (struct bio *bio) { -struct md_rdev *rdev = (struct md_rdev *)bio->bi_bdev; +struct md_rdev *rdev = (void *)bio->bi_bdev; bio->bi_next =NULL ;bio_set_dev (bio, rdev->bdev);
Hello!
Quoted 16 lines · Greg Kroah-Hartman
------------------
Note, this is the LAST release for the 6.3.y kernel series. After this is released, it will be end-of-life. Please move to the 6.4.y kernel series at this point in time, OR let us know what is preventing that from happening for you.
------------------This is the start of the stable review cycle for the 6.3.13 release. There are 431 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 11 Jul 2023 11:14:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.13-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
There build regressions on Arm 32-bits, specifically omap1_defconfig:
-----8<-----
/builds/linux/arch/arm/mach-omap1/irq.c: In function 'omap1_init_irq':
/builds/linux/arch/arm/mach-omap1/irq.c:221:11: error: implicit
declaration of function 'irq_domain_add_legacy' [-Werror=implicit-function-declaration]
domain = irq_domain_add_legacy(NULL, nr_irqs, irq_base, 0,
^~~~~~~~~~~~~~~~~~~~~
/builds/linux/arch/arm/mach-omap1/irq.c:222:13: error:
'irq_domain_simple_ops' undeclared (first use in this function); did you mean 'irq_domain_chip_generic'?
&irq_domain_simple_ops, NULL);
^~~~~~~~~~~~~~~~~~~~~
irq_domain_chip_generic /builds/linux/arch/arm/mach-omap1/irq.c:222:13: note: each
undeclared identifier is reported only once for each function it appears in
/builds/linux/arch/arm/mach-omap1/irq.c:250:23: error: implicit
declaration of function 'irq_find_mapping'; did you mean 'iomem_get_mapping'? [-Werror=implicit-function-declaration]
d = irq_get_irq_data(irq_find_mapping(domain, omap_l2_irq));
^~~~~~~~~~~~~~~~
iomem_get_mapping cc1: some warnings being treated as errors make[3]: *** [/builds/linux/scripts/Makefile.build:252:arch/arm/mach-omap1/irq.o] Error 1
----->8-----
Greetings!
Daniel Díaz
[email protected]
Greg Kroah-Hartman
maintainerQuoted 50 lines · Daniel Díaz
Hello!
Quoted 16 lines · Greg Kroah-Hartman
------------------
Note, this is the LAST release for the 6.3.y kernel series. After this is released, it will be end-of-life. Please move to the 6.4.y kernel series at this point in time, OR let us know what is preventing that from happening for you.
------------------This is the start of the stable review cycle for the 6.3.13 release. There are 431 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 11 Jul 2023 11:14:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.13-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
There build regressions on Arm 32-bits, specifically
omap1_defconfig:-----8<-----
/builds/linux/arch/arm/mach-omap1/irq.c: In function 'omap1_init_irq':
/builds/linux/arch/arm/mach-omap1/irq.c:221:11: error: implicit
declaration of function 'irq_domain_add_legacy' [-Werror=implicit-function-declaration]
domain = irq_domain_add_legacy(NULL,nr_irqs,irq_base, 0,
^~~~~~~~~~~~~~~~~~~~~
/builds/linux/arch/arm/mach-omap1/irq.c:222:13: error:
'irq_domain_simple_ops' undeclared (first use in this function); did you mean 'irq_domain_chip_generic'?&irq_domain_simple_ops, NULL); ^~~~~~~~~~~~~~~~~~~~~ irq_domain_chip_generic/builds/linux/arch/arm/mach-omap1/irq.c:222:13: note: each
undeclared identifier is reported only once for each function it appears in
/builds/linux/arch/arm/mach-omap1/irq.c:250:23: error: implicit
declaration of function 'irq_find_mapping'; did you mean 'iomem_get_mapping'? [-Werror=implicit-function-declaration]
Quoted 7 lines
d = irq_get_irq_data(irq_find_mapping(domain, omap_l2_irq)); ^~~~~~~~~~~~~~~~ iomem_get_mappingcc1: some warnings being treated as errors make[3]: *** [/builds/linux/scripts/Makefile.build:252:
arch/arm/mach-omap1/irq.o] Error 1
----->8-----
Ick, sorry, let me go drop some patches and push out a -rc2.
thanks,
greg k-h