Linux 5.11.8
Greg Kroah-Hartman
maintainerI'm announcing the release of the 5.11.8 kernel.
All users of the 5.11 kernel series must upgrade.
The updated 5.11.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.11.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/arm64/include/asm/el2_setup.h | 4 arch/x86/crypto/aesni-intel_asm.S | 115 +++++++++------- arch/x86/crypto/aesni-intel_glue.c | 25 +-- arch/x86/kvm/mmu/mmu_internal.h | 13 + drivers/infiniband/ulp/srp/ib_srp.c | 110 ++++++--------- drivers/net/dsa/b53/b53_common.c | 18 ++ drivers/net/dsa/b53/b53_regs.h | 1 drivers/net/dsa/bcm_sf2.c | 15 -- drivers/regulator/pca9450-regulator.c | 30 ++++ fs/fuse/fuse_i.h | 1 fs/gfs2/ops_fstype.c | 33 ++-- fs/gfs2/recovery.c | 8 - fs/gfs2/super.c | 45 ------ fs/gfs2/util.c | 58 +++++++- fs/gfs2/util.h | 3 fs/io_uring.c | 84 ++++++----- fs/locks.c | 3 fs/nfsd/nfs4state.c | 53 +------ include/linux/regulator/pca9450.h | 10 + kernel/bpf/verifier.c | 33 ++-- net/mptcp/pm.c | 5 net/mptcp/pm_netlink.c | 23 ++- net/mptcp/protocol.c | 20 ++ net/mptcp/protocol.h | 5 tools/testing/selftests/bpf/verifier/bounds_deduction.c | 27 ++- tools/testing/selftests/bpf/verifier/map_ptr.c | 4 tools/testing/selftests/bpf/verifier/unpriv.c | 15 +- tools/testing/selftests/bpf/verifier/value_ptr_arith.c | 23 +++ 29 files changed, 461 insertions(+), 325 deletions(-)
Amir Goldstein (1):
fuse: fix live lock in fuse_iget()
Ard Biesheuvel (1):
crypto: x86/aes-ni-xts - use direct calls to and 4-way stride
Bob Peterson (3):
gfs2: Add common helper for holding and releasing the freeze glock
gfs2: move freeze glock outside the make_fs_rw and _ro functions
gfs2: bypass signal_our_withdraw if no journal
Florian Fainelli (1):
net: dsa: b53: Support setting learning on port
Florian Westphal (2):
mptcp: pm: add lockdep assertions
mptcp: dispose initial struct socket when its subflow is closed
Frieder Schrempf (3):
regulator: pca9450: Add SD_VSEL GPIO for LDO5
regulator: pca9450: Enable system reset on WDOG_B assertion
regulator: pca9450: Clear PRESET_EN bit to fix BUCK1/2/3 voltage setting
Geliang Tang (1):
mptcp: send ack for every add_addr
Greg Kroah-Hartman (1):
Linux 5.11.8
J. Bruce Fields (2):
Revert "nfsd4: remove check_conflicting_opens warning" Revert "nfsd4: a client's own opens needn't prevent delegations"
Jens Axboe (3):
io_uring: don't attempt IO reissue from the ring exit path
io_uring: don't keep looping for more events if we can't flush overflow
io_uring: clear IOCB_WAITQ for non -EIOCBQUEUED return
Nicolas Morey-Chaisemartin (1):
RDMA/srp: Fix support for unpopulated and unbalanced NUMA nodes
Pavel Begunkov (3):
io_uring: refactor scheduling in io_cqring_wait
io_uring: refactor io_cqring_wait
io_uring: simplify do_read return parsing
Piotr Krysiuk (5):
bpf: Prohibit alu ops for pointer types not defining ptr_limit
bpf: Fix off-by-one for area size in creating mask to left
bpf: Simplify alu_limit masking for pointer arithmetic
bpf: Add sanity check for upper ptr_limit
bpf, selftests: Fix up some test_verifier cases for unprivileged
Sean Christopherson (2):
KVM: x86/mmu: Expand on the comment in kvm_vcpu_ad_need_write_protect()
KVM: x86/mmu: Set SPTE_AD_WRPROT_ONLY_MASK if and only if PML is enabled
Vladimir Murzin (1):
arm64: Unconditionally set virtual cpu id registers
Greg Kroah-Hartman
maintainerMakefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 11 -SUBLEVEL = 7 +SUBLEVEL = 8 EXTRAVERSION = NAME = 💕 Valentine's Day Edition 💕
arch/arm64/include/asm/el2_setup.h +2 -2
@@ -111,7 +111,7 @@ .endm /* Virtual CPU ID registers */ -.macro __init_el2_nvhe_idregs +.macro __init_el2_idregsmrs x0, midr_el1 mrs x1, mpidr_el1 msr vpidr_el2, x0
@@ -163,6 +163,7 @@__init_el2_stage2 __init_el2_gicv3__init_el2_hstr + __init_el2_idregs/* * When VHE is not in use, early init of EL2 needs to be done here.
@@ -171,7 +172,6 @@* will be done via the _EL1 system register aliases in __cpu_setup. */ .ifeqs "\mode", "nvhe" - __init_el2_nvhe_idregs __init_el2_nvhe_cptr __init_el2_nvhe_sve __init_el2_nvhe_prepare_eret
arch/x86/crypto/aesni-intel_asm.S +70 -45
166 lines not on this page · raw message
arch/x86/crypto/aesni-intel_glue.c +14 -11
@@ -97,6 +97,12 @@ asmlinkage void aesni_cbc_dec(struct crypto_aes_ctx *ctx, u8 *out,#define AVX_GEN2_OPTSIZE 640#define AVX_GEN4_OPTSIZE 4096 +asmlinkage void aesni_xts_encrypt(const struct crypto_aes_ctx *ctx, u8 *out, +const u8 *in,unsigned int len,u8 *iv); + +asmlinkage void aesni_xts_decrypt(const struct crypto_aes_ctx *ctx, u8 *out, +const u8 *in,unsigned int len,u8 *iv); +#ifdef CONFIG_X86_64 static void (*aesni_ctr_enc_tfm)(struct crypto_aes_ctx *ctx, u8 *out,
@@ -104,9 +110,6 @@ static void (*aesni_ctr_enc_tfm)(struct crypto_aes_ctx *ctx, u8 *out, asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out,const u8 *in,unsigned int len,u8 *iv); -asmlinkage void aesni_xts_crypt8(const struct crypto_aes_ctx *ctx, u8 *out, -const u8 *in,bool enc,le128 *iv); -/* asmlinkage void aesni_gcm_enc() * void *ctx, AES Key schedule. Starts on a 16 byte boundary. * struct gcm_context_data. May be uninitialized.
@@ -547,14 +550,14 @@ static void aesni_xts_dec(const void *ctx, u8 *dst, const u8 *src, le128 *iv)glue_xts_crypt_128bit_one (ctx, dst, src, iv, aesni_dec); } -static void aesni_xts_enc8 (const void *ctx,u8 *dst,const u8 *src,le128 *iv) +static void aesni_xts_enc32 (const void *ctx,u8 *dst,const u8 *src,le128 *iv) { -aesni_xts_crypt8 (ctx, dst, src, true, iv); +aesni_xts_encrypt (ctx, dst, src,32 *AES_BLOCK_SIZE , (u8 *)iv); } -static void aesni_xts_dec8 (const void *ctx,u8 *dst,const u8 *src,le128 *iv) +static void aesni_xts_dec32 (const void *ctx,u8 *dst,const u8 *src,le128 *iv) { -aesni_xts_crypt8 (ctx, dst, src, false, iv); +aesni_xts_decrypt (ctx, dst, src,32 *AES_BLOCK_SIZE , (u8 *)iv); }static const struct common_glue_ctx aesni_enc_xts = {
@@ -562,8 +565,8 @@ static const struct common_glue_ctx aesni_enc_xts = { .fpu_blocks_limit = 1, .funcs = { { - .num_blocks = 8, - .fn_u = { .xts = aesni_xts_enc8 } + .num_blocks = 32, + .fn_u = { .xts = aesni_xts_enc32 } }, { .num_blocks = 1, .fn_u = { .xts = aesni_xts_enc }
@@ -575,8 +578,8 @@ static const struct common_glue_ctx aesni_dec_xts = { .fpu_blocks_limit = 1, .funcs = { { - .num_blocks = 8, - .fn_u = { .xts = aesni_xts_dec8 } + .num_blocks = 32, + .fn_u = { .xts = aesni_xts_dec32 } }, { .num_blocks = 1, .fn_u = { .xts = aesni_xts_dec }
arch/x86/kvm/mmu/mmu_internal.h +8 -5
@@ -76,12 +76,15 @@ static inline struct kvm_mmu_page *sptep_to_sp(u64 *sptep)static inline bool kvm_vcpu_ad_need_write_protect (struct kvm_vcpu *vcpu) {/* -* When using the EPT page-modification log, the GPAs in the log -* would come from L2 rather than L1. Therefore, we need to rely -* on write protection to record dirty pages. This also bypasses -* PML, since writes now result in a vmexit. +* When using the EPT page-modification log, the GPAs in the CPU dirty +* log would come from L2 rather than L1. Therefore, we need to rely +* on write protection to record dirty pages, which bypasses PML, since +* writes now result in a vmexit. Note, the check on CPU dirty logging +* being enabled is mandatory as the bits used to denote WP-only SPTEs +* are reserved for NPT w/ PAE (32-bit KVM). */ -return vcpu->arch.mmu == &vcpu->arch.guest_mmu; +return vcpu->arch.mmu == &vcpu->arch.guest_mmu && + kvm_x86_ops.cpu_dirty_log_size; }bool is_nx_huge_page_enabled (void );
drivers/infiniband/ulp/srp/ib_srp.c +45 -65
133 lines not on this page · raw message
drivers/net/dsa/b53/b53_common.c +18 -0
@@ -510,6 +510,19 @@ void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port) }EXPORT_SYMBOL (b53_imp_vlan_setup); +static void b53_port_set_learning (struct b53_device *dev,int port, +bool learning) +{ +u16 reg; + +b53_read16 (dev,B53_CTRL_PAGE ,B53_DIS_LEARNING , ®); +if (learning) + reg &= ~BIT (port); +else + reg |=BIT (port); +b53_write16 (dev,B53_CTRL_PAGE ,B53_DIS_LEARNING , reg); +} +int b53_enable_port (struct dsa_switch *ds,int port,struct phy_device *phy) {struct b53_device *dev = ds->priv;
@@ -523,6 +536,7 @@ int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy) cpu_port =dsa_to_port (ds, port)->cpu_dp->index;b53_br_egress_floods (ds, port, true, true); +b53_port_set_learning (dev, port, false);if (dev->ops->irq_enable) ret = dev->ops->irq_enable (dev, port);
@@ -656,6 +670,7 @@ static void b53_enable_cpu_port(struct b53_device *dev, int port)b53_brcm_hdr_setup (dev->ds, port);b53_br_egress_floods (dev->ds, port, true, true); +b53_port_set_learning (dev, port, false); }static void b53_enable_mib (struct b53_device *dev)
@@ -1839,6 +1854,8 @@ int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br)b53_write16 (dev,B53_PVLAN_PAGE ,B53_PVLAN_PORT_MASK (port), pvlan); dev->ports[port].vlan_ctl_mask = pvlan; +b53_port_set_learning (dev, port, true); +return 0 ; }EXPORT_SYMBOL (b53_br_join);
@@ -1886,6 +1903,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br) vl->untag |=BIT (port) |BIT (cpu_port);b53_set_vlan_entry (dev, pvid, vl); } +b53_port_set_learning (dev, port, false); }EXPORT_SYMBOL (b53_br_leave);
drivers/net/dsa/b53/b53_regs.h +1 -0
@@ -115,6 +115,7 @@#define B53_UC_FLOOD_MASK 0x32#define B53_MC_FLOOD_MASK 0x34#define B53_IPMC_FLOOD_MASK 0x36 +#define B53_DIS_LEARNING 0x3c/* * Override Ports 0-7 State on devices with xMII interfaces (8 bit)
drivers/net/dsa/bcm_sf2.c +1 -14
@@ -222,23 +222,10 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, reg &= ~P_TXQ_PSM_VDD (port);core_writel (priv, reg,CORE_MEM_PSM_VDD_CTRL ); -/* Enable learning */ - reg =core_readl (priv,CORE_DIS_LEARN ); - reg &= ~BIT (port); -core_writel (priv, reg,CORE_DIS_LEARN ); -/* Enable Broadcom tags for that port if requested */ -if (priv->brcm_tag_mask &BIT (port)) { +if (priv->brcm_tag_mask &BIT (port))b53_brcm_hdr_setup (ds, port); -/* Disable learning on ASP port */ -if (port ==7 ) { - reg =core_readl (priv,CORE_DIS_LEARN ); - reg |=BIT (port); -core_writel (priv, reg,CORE_DIS_LEARN ); - } - } -/* Configure Traffic Class to QoS mapping, allow each priority to map * to a different queue number */
drivers/regulator/pca9450-regulator.c +30 -0
@@ -5,6 +5,7 @@*/ #include <linux/err.h> +#include <linux/gpio/consumer.h> #include <linux/i2c.h> #include <linux/interrupt.h> #include <linux/kernel.h>
@@ -32,6 +33,7 @@ struct pca9450_regulator_desc {struct pca9450 {struct device *dev;struct regmap *regmap; +struct gpio_desc *sd_vsel_gpio;enum pca9450_chip_type type;unsigned int rcnt;int irq;
@@ -795,6 +797,34 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,return ret; } +/* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */ + ret =regmap_clear_bits (pca9450->regmap,PCA9450_REG_BUCK123_DVS , +BUCK123_PRESET_EN ); +if (ret) { +dev_err (&i2c->dev,"Failed to clear PRESET_EN bit: %d\n" , ret); +return ret; + } + +/* Set reset behavior on assertion of WDOG_B signal */ + ret =regmap_update_bits (pca9450->regmap,PCA9450_REG_RESET_CTRL , +WDOG_B_CFG_MASK ,WDOG_B_CFG_COLD_LDO12 ); +if (ret) { +dev_err (&i2c->dev,"Failed to set WDOG_B reset behavior\n" ); +return ret; + } + +/* +* The driver uses the LDO5CTRL_H register to control the LDO5 regulator. +* This is only valid if the SD_VSEL input of the PMIC is high. Let's +* check if the pin is available as GPIO and set it to high. +*/ + pca9450->sd_vsel_gpio =gpiod_get_optional (pca9450->dev,"sd-vsel" ,GPIOD_OUT_HIGH ); + +if (IS_ERR (pca9450->sd_vsel_gpio)) { +dev_err (&i2c->dev,"Failed to get SD_VSEL GPIO\n" ); +return ret; + } +dev_info (&i2c->dev,"%s probed.\n" , type ==PCA9450_TYPE_PCA9450A ?"pca9450a" :"pca9450bc" );
fs/fuse/fuse_i.h +1 -0
@@ -863,6 +863,7 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc)static inline void fuse_make_bad (struct inode *inode) { +remove_inode_hash (inode);set_bit (FUSE_I_BAD , &get_fuse_inode (inode)->state); }
fs/gfs2/ops_fstype.c +17 -16
@@ -1084,6 +1084,7 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)int silent = fc->sb_flags &SB_SILENT ;struct gfs2_sbd *sdp;struct gfs2_holder mount_gh; +struct gfs2_holder freeze_gh;int error; sdp =init_sbd (sb);
@@ -1195,25 +1196,18 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) goto fail_per_node; } -if (sb_rdonly (sb)) { -struct gfs2_holder freeze_gh; + error =gfs2_freeze_lock (sdp, &freeze_gh,0 ); +if (error) + goto fail_per_node; - error =gfs2_glock_nq_init (sdp->sd_freeze_gl,LM_ST_SHARED , -LM_FLAG_NOEXP |GL_EXACT , - &freeze_gh); -if (error) { -fs_err (sdp,"can't make FS RO: %d\n" , error); - goto fail_per_node; - } -gfs2_glock_dq_uninit (&freeze_gh); - }else { +if (!sb_rdonly (sb)) error =gfs2_make_fs_rw (sdp); -if (error) { -fs_err (sdp,"can't make FS RW: %d\n" , error); - goto fail_per_node; - } - } +gfs2_freeze_unlock (&freeze_gh); +if (error) { +fs_err (sdp,"can't make FS RW: %d\n" , error); + goto fail_per_node; + }gfs2_glock_dq_uninit (&mount_gh);gfs2_online_uevent (sdp);return 0 ;
@@ -1514,6 +1508,12 @@ static int gfs2_reconfigure(struct fs_context *fc) fc->sb_flags |=SB_RDONLY ;if ((sb->s_flags ^ fc->sb_flags) &SB_RDONLY ) { +struct gfs2_holder freeze_gh; + + error =gfs2_freeze_lock (sdp, &freeze_gh,0 ); +if (error) +return -EINVAL ; +if (fc->sb_flags &SB_RDONLY ) { error =gfs2_make_fs_ro (sdp);if (error)
@@ -1523,6 +1523,7 @@ static int gfs2_reconfigure(struct fs_context *fc)if (error)errorfc (fc,"unable to remount read-write" ); } +gfs2_freeze_unlock (&freeze_gh); } sdp->sd_args = *newargs;
fs/gfs2/recovery.c +3 -5
@@ -470,9 +470,7 @@ void gfs2_recover_func(struct work_struct *work)/* Acquire a shared hold on the freeze lock */ - error =gfs2_glock_nq_init (sdp->sd_freeze_gl,LM_ST_SHARED , -LM_FLAG_NOEXP |LM_FLAG_PRIORITY | -GL_EXACT , &thaw_gh); + error =gfs2_freeze_lock (sdp, &thaw_gh,LM_FLAG_PRIORITY );if (error) goto fail_gunlock_ji;
@@ -524,7 +522,7 @@ void gfs2_recover_func(struct work_struct *work)clean_journal (jd, &head);up_read (&sdp->sd_log_flush_lock); -gfs2_glock_dq_uninit (&thaw_gh); +gfs2_freeze_unlock (&thaw_gh); t_rep =ktime_get (); fs_info(sdp, "jid=%u: Journal replayed in %lldms [jlck:%lldms, " "jhead:%lldms, tlck:%lldms, replay:%lldms]\n",
@@ -546,7 +544,7 @@ void gfs2_recover_func(struct work_struct *work) goto done; fail_gunlock_thaw: -gfs2_glock_dq_uninit (&thaw_gh); +gfs2_freeze_unlock (&thaw_gh); fail_gunlock_ji:if (jlocked) {gfs2_glock_dq_uninit (&ji_gh);
fs/gfs2/super.c +4 -41
106 lines not on this page · raw message
fs/gfs2/util.c +51 -7
78 lines not on this page · raw message
fs/gfs2/util.h +3 -0
@@ -149,6 +149,9 @@ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function,extern int check_journal_clean (struct gfs2_sbd *sdp,struct gfs2_jdesc *jd,bool verbose); +extern int gfs2_freeze_lock (struct gfs2_sbd *sdp, +struct gfs2_holder *freeze_gh,int caller_flags); +extern void gfs2_freeze_unlock (struct gfs2_holder *freeze_gh);#define gfs2_io_error (sdp) \ gfs2_io_error_i((sdp), __func__, __FILE__, __LINE__)
fs/io_uring.c +48 -36
156 lines not on this page · raw message
fs/locks.c +0 -3
@@ -1808,9 +1808,6 @@ check_conflicting_open(struct file *filp, const long arg, int flags)if (flags &FL_LAYOUT )return 0 ; -if (flags &FL_DELEG ) -/* We leave these checks to the caller. */ -return 0 ;if (arg ==F_RDLCK )return inode_is_open_for_write (inode) ? -EAGAIN :0 ;
fs/nfsd/nfs4state.c +14 -39
82 lines not on this page · raw message
include/linux/regulator/pca9450.h +10 -0
@@ -147,6 +147,9 @@ enum {#define BUCK6_FPWM 0x04#define BUCK6_ENMODE_MASK 0x03 +/* PCA9450_REG_BUCK123_PRESET_EN bit */ +#define BUCK123_PRESET_EN 0x80 +/* PCA9450_BUCK1OUT_DVS0 bits */ #define BUCK1OUT_DVS0_MASK 0x7F#define BUCK1OUT_DVS0_DEFAULT 0x14
@@ -216,4 +219,11 @@ enum {#define IRQ_THERM_105 0x02#define IRQ_THERM_125 0x01 +/* PCA9450_REG_RESET_CTRL bits */ +#define WDOG_B_CFG_MASK 0xC0 +#define WDOG_B_CFG_NONE 0x00 +#define WDOG_B_CFG_WARM 0x40 +#define WDOG_B_CFG_COLD_LDO12 0x80 +#define WDOG_B_CFG_COLD 0xC0 +#endif /* __LINUX_REG_PCA9450_H__ */
kernel/bpf/verifier.c +21 -12
@@ -5389,10 +5389,14 @@ static int retrieve_ptr_limit(const struct bpf_reg_state *ptr_reg, {bool mask_to_left = (opcode ==BPF_ADD && off_is_neg) || (opcode ==BPF_SUB && !off_is_neg); -u32 off; +u32 off, max;switch (ptr_reg->type) {case PTR_TO_STACK : +/* Offset 0 is out-of-bounds, but acceptable start for the +* left direction, see BPF_REG_FP. +*/ + max =MAX_BPF_STACK + mask_to_left;/* Indirect variable offset stack access is prohibited in * unprivileged mode so it's not handled here. */
@@ -5400,16 +5404,17 @@ static int retrieve_ptr_limit(const struct bpf_reg_state *ptr_reg,if (mask_to_left) *ptr_limit =MAX_BPF_STACK + off;else - *ptr_limit = -off; -return 0 ; + *ptr_limit = -off -1 ; +return *ptr_limit >= max ? -ERANGE :0 ;case PTR_TO_MAP_VALUE : + max = ptr_reg->map_ptr->value_size;if (mask_to_left) { *ptr_limit = ptr_reg->umax_value + ptr_reg->off; }else { off = ptr_reg->smin_value + ptr_reg->off; - *ptr_limit = ptr_reg->map_ptr->value_size - off; + *ptr_limit = ptr_reg->map_ptr->value_size - off -1 ; } -return 0 ; +return *ptr_limit >= max ? -ERANGE :0 ;default :return -EINVAL ; }
@@ -5462,6 +5467,7 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env,u32 alu_state, alu_limit;struct bpf_reg_state tmp;bool ret; +int err;if (can_skip_alu_sanitation (env, insn))return 0 ;
@@ -5477,10 +5483,13 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env, alu_state |= ptr_is_dst_reg ?BPF_ALU_SANITIZE_SRC :BPF_ALU_SANITIZE_DST ; -if (retrieve_ptr_limit (ptr_reg, &alu_limit, opcode, off_is_neg)) -return 0 ; -if (update_alu_sanitation_state (aux, alu_state, alu_limit)) -return -EACCES ; + err =retrieve_ptr_limit (ptr_reg, &alu_limit, opcode, off_is_neg); +if (err <0 ) +return err; + + err =update_alu_sanitation_state (aux, alu_state, alu_limit); +if (err <0 ) +return err; do_sim:/* Simulate and find potential out-of-bounds access under * speculative execution from truncation as a result of
@@ -5596,7 +5605,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,case BPF_ADD : ret =sanitize_ptr_alu (env, insn, ptr_reg, dst_reg, smin_val <0 );if (ret <0 ) { -verbose (env,"R%d tried to add from different maps or paths\n" , dst); +verbose (env,"R%d tried to add from different maps, paths, or prohibited types\n" , dst);return ret; }/* We can take a fixed offset as long as it doesn't overflow
@@ -5651,7 +5660,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,case BPF_SUB : ret =sanitize_ptr_alu (env, insn, ptr_reg, dst_reg, smin_val <0 );if (ret <0 ) { -verbose (env,"R%d tried to sub from different maps or paths\n" , dst); +verbose (env,"R%d tried to sub from different maps, paths, or prohibited types\n" , dst);return ret; }if (dst_reg == off_reg) {
@@ -11079,7 +11088,7 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env) off_reg = issrc ? insn->src_reg : insn->dst_reg;if (isneg) *patch++ =BPF_ALU64_IMM (BPF_MUL , off_reg,-1 ); - *patch++ =BPF_MOV32_IMM (BPF_REG_AX , aux->alu_limit -1 ); + *patch++ =BPF_MOV32_IMM (BPF_REG_AX , aux->alu_limit); *patch++ =BPF_ALU64_REG (BPF_SUB ,BPF_REG_AX , off_reg); *patch++ =BPF_ALU64_REG (BPF_OR ,BPF_REG_AX , off_reg); *patch++ =BPF_ALU64_IMM (BPF_NEG ,BPF_REG_AX ,0 );
net/mptcp/pm.c +3 -2
@@ -20,6 +20,8 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,pr_debug ("msk=%p, local_id=%d" , msk, addr->id); +lockdep_assert_held (&msk->pm.lock); +if (add_addr) {pr_warn ("addr_signal error, add_addr=%d" , add_addr);return -EINVAL ;
@@ -188,8 +190,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,void mptcp_pm_add_addr_send_ack (struct mptcp_sock *msk) { -if (!mptcp_pm_should_add_signal_ipv6 (msk) && - !mptcp_pm_should_add_signal_port (msk)) +if (!mptcp_pm_should_add_signal (msk))return ;mptcp_pm_schedule_work (msk,MPTCP_PM_ADD_ADDR_SEND_ACK );
net/mptcp/pm_netlink.c +17 -6
@@ -134,6 +134,8 @@ select_local_address(const struct pm_nl_pernet *pernet, {struct mptcp_pm_addr_entry *entry, *ret =NULL ; +msk_owned_by_me (msk); +rcu_read_lock ();__mptcp_flush_join_list (msk);list_for_each_entry_rcu (entry, &pernet->local_addr_list, list) {
@@ -191,6 +193,8 @@ lookup_anno_list_by_saddr(struct mptcp_sock *msk, {struct mptcp_pm_add_entry *entry; +lockdep_assert_held (&msk->pm.lock); +list_for_each_entry (entry, &msk->pm.anno_list, list) {if (addresses_equal (&entry->addr, addr, false))return entry;
@@ -266,6 +270,8 @@ static bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,struct sock *sk = (struct sock *)msk;struct net *net =sock_net (sk); +lockdep_assert_held (&msk->pm.lock); +if (lookup_anno_list_by_saddr (msk, &entry->addr))return false;
@@ -408,8 +414,10 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk) {struct mptcp_subflow_context *subflow; -if (!mptcp_pm_should_add_signal_ipv6 (msk) && - !mptcp_pm_should_add_signal_port (msk)) +msk_owned_by_me (msk); +lockdep_assert_held (&msk->pm.lock); + +if (!mptcp_pm_should_add_signal (msk))return ;__mptcp_flush_join_list (msk);
@@ -419,10 +427,9 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)u8 add_addr;spin_unlock_bh (&msk->pm.lock); -if (mptcp_pm_should_add_signal_ipv6 (msk)) -pr_debug ("send ack for add_addr6" ); -if (mptcp_pm_should_add_signal_port (msk)) -pr_debug ("send ack for add_addr_port" ); +pr_debug ("send ack for add_addr%s%s" , +mptcp_pm_should_add_signal_ipv6 (msk) ?" [ipv6]" :"" , +mptcp_pm_should_add_signal_port (msk) ?" [port]" :"" );lock_sock (ssk);tcp_send_ack (ssk);
@@ -445,6 +452,8 @@ void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)pr_debug ("address rm_id %d" , msk->pm.rm_id); +msk_owned_by_me (msk); +if (!msk->pm.rm_id)return ;
@@ -480,6 +489,8 @@ void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id)pr_debug ("subflow rm_id %d" , rm_id); +msk_owned_by_me (msk); +if (!rm_id)return ;
net/mptcp/protocol.c +15 -5
@@ -2100,6 +2100,14 @@ static struct sock *mptcp_subflow_get_retrans(const struct mptcp_sock *msk)return backup; } +static void mptcp_dispose_initial_subflow (struct mptcp_sock *msk) +{ +if (msk->subflow) { +iput (SOCK_INODE (msk->subflow)); + msk->subflow =NULL ; + } +} +/* subflow sockets can be either outgoing (connect) or incoming * (accept). *
@@ -2144,6 +2152,9 @@ void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,if (ssk == msk->last_snd) msk->last_snd =NULL ; + +if (msk->subflow && ssk == msk->subflow->sk) +mptcp_dispose_initial_subflow (msk); }static unsigned int mptcp_sync_mss (struct sock *sk,u32 pmtu)
@@ -2186,6 +2197,8 @@ static void __mptcp_close_subflow(struct mptcp_sock *msk) {struct mptcp_subflow_context *subflow, *tmp; +might_sleep (); +list_for_each_entry_safe (subflow, tmp, &msk->conn_list, node) {struct sock *ssk =mptcp_subflow_tcp_sock (subflow);
@@ -2529,11 +2542,7 @@ static void __mptcp_destroy_sock(struct sock *sk)pr_debug ("msk=%p" , msk); -/* dispose the ancillatory tcp socket, if any */ -if (msk->subflow) { -iput (SOCK_INODE (msk->subflow)); - msk->subflow =NULL ; - } +might_sleep ();/* be sure to always acquire the join list lock, to sync vs * mptcp_finish_join().
@@ -2559,6 +2568,7 @@ static void __mptcp_destroy_sock(struct sock *sk)sk_stream_kill_queues (sk);xfrm_sk_free_policy (sk);sk_refcnt_debug_release (sk); +mptcp_dispose_initial_subflow (msk);sock_put (sk); }
net/mptcp/protocol.h +5 -0
@@ -286,6 +286,11 @@ struct mptcp_sock {#define mptcp_for_each_subflow (__msk, __subflow) \ list_for_each_entry(__subflow, &((__msk)->conn_list), node) +static inline void msk_owned_by_me (const struct mptcp_sock *msk) +{ +sock_owned_by_me ((const struct sock *)msk); +} +static inline struct mptcp_sock *mptcp_sk (const struct sock *sk) {return (struct mptcp_sock *)sk;
tools/testing/selftests/bpf/verifier/bounds_deduction.c +19 -8
@@ -6,8 +6,9 @@BPF_ALU64_REG (BPF_SUB ,BPF_REG_0 ,BPF_REG_1 ), BPF_EXIT_INSN(), }, - .result =REJECT , + .errstr_unpriv ="R0 tried to sub from different maps, paths, or prohibited types" , .errstr = "R0 tried to subtract pointer from scalar", + .result = REJECT, }, { "check deducing bounds from const, 2",
@@ -20,6 +21,8 @@ BPF_ALU64_REG(BPF_SUB, BPF_REG_1, BPF_REG_0), BPF_EXIT_INSN(), }, + .errstr_unpriv = "R1 tried to sub from different maps, paths, or prohibited types", + .result_unpriv = REJECT, .result = ACCEPT, .retval = 1, },
@@ -31,8 +34,9 @@BPF_ALU64_REG (BPF_SUB ,BPF_REG_0 ,BPF_REG_1 ), BPF_EXIT_INSN(), }, - .result =REJECT , + .errstr_unpriv ="R0 tried to sub from different maps, paths, or prohibited types" , .errstr = "R0 tried to subtract pointer from scalar", + .result = REJECT, }, { "check deducing bounds from const, 4",
@@ -45,6 +49,8 @@BPF_ALU64_REG (BPF_SUB ,BPF_REG_1 ,BPF_REG_0 ), BPF_EXIT_INSN(), }, + .errstr_unpriv ="R1 tried to sub from different maps, paths, or prohibited types" , + .result_unpriv = REJECT, .result = ACCEPT, }, {
@@ -55,8 +61,9 @@BPF_ALU64_REG (BPF_SUB ,BPF_REG_0 ,BPF_REG_1 ), BPF_EXIT_INSN(), }, - .result =REJECT , + .errstr_unpriv ="R0 tried to sub from different maps, paths, or prohibited types" , .errstr = "R0 tried to subtract pointer from scalar", + .result = REJECT, }, { "check deducing bounds from const, 6",
@@ -67,8 +74,9 @@BPF_ALU64_REG (BPF_SUB ,BPF_REG_0 ,BPF_REG_1 ), BPF_EXIT_INSN(), }, - .result =REJECT , + .errstr_unpriv ="R0 tried to sub from different maps, paths, or prohibited types" , .errstr = "R0 tried to subtract pointer from scalar", + .result = REJECT, }, { "check deducing bounds from const, 7",
@@ -80,8 +88,9 @@ offsetof(struct __sk_buff, mark)), BPF_EXIT_INSN(), }, - .result = REJECT, + .errstr_unpriv = "R1 tried to sub from different maps, paths, or prohibited types", .errstr = "dereference of modified ctx ptr", + .result = REJECT, .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, }, {
@@ -94,8 +103,9 @@ offsetof(struct __sk_buff, mark)), BPF_EXIT_INSN(), }, - .result = REJECT, + .errstr_unpriv = "R1 tried to add from different maps, paths, or prohibited types", .errstr = "dereference of modified ctx ptr", + .result = REJECT, .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, }, {
@@ -106,8 +116,9 @@BPF_ALU64_REG (BPF_SUB ,BPF_REG_0 ,BPF_REG_1 ), BPF_EXIT_INSN(), }, - .result =REJECT , + .errstr_unpriv ="R0 tried to sub from different maps, paths, or prohibited types" , .errstr = "R0 tried to subtract pointer from scalar", + .result = REJECT, }, { "check deducing bounds from const, 10",
@@ -119,6 +130,6 @@ BPF_ALU64_REG(BPF_SUB, BPF_REG_0, BPF_REG_1), BPF_EXIT_INSN(), }, - .result = REJECT, .errstr = "math between ctx pointer and register with unbounded min value is not allowed", + .result = REJECT, },
tools/testing/selftests/bpf/verifier/map_ptr.c +4 -0
@@ -75,6 +75,8 @@ BPF_EXIT_INSN(), }, .fixup_map_hash_16b = { 4 }, + .result_unpriv = REJECT, + .errstr_unpriv = "R1 tried to add from different maps, paths, or prohibited types", .result = ACCEPT, }, {
@@ -91,5 +93,7 @@ BPF_EXIT_INSN(), }, .fixup_map_hash_16b = { 4 }, + .result_unpriv = REJECT, + .errstr_unpriv = "R1 tried to add from different maps, paths, or prohibited types", .result = ACCEPT, },
tools/testing/selftests/bpf/verifier/unpriv.c +14 -1
@@ -496,7 +496,7 @@ .result = ACCEPT, }, { - "unpriv: adding of fp", + "unpriv: adding of fp, reg", .insns = {BPF_MOV64_IMM (BPF_REG_0 ,0 ), BPF_MOV64_IMM(BPF_REG_1, 0),
@@ -504,6 +504,19 @@BPF_STX_MEM (BPF_DW ,BPF_REG_1 ,BPF_REG_0 ,-8 ), BPF_EXIT_INSN(), }, + .errstr_unpriv ="R1 tried to add from different maps, paths, or prohibited types" , + .result_unpriv = REJECT, + .result = ACCEPT, +}, +{ +"unpriv: adding of fp, imm" , + .insns = { +BPF_MOV64_IMM (BPF_REG_0 ,0 ), +BPF_MOV64_REG (BPF_REG_1 ,BPF_REG_10 ), +BPF_ALU64_IMM (BPF_ADD ,BPF_REG_1 ,0 ), +BPF_STX_MEM (BPF_DW ,BPF_REG_1 ,BPF_REG_0 ,-8 ), + BPF_EXIT_INSN(), + }, .errstr_unpriv ="R1 stack pointer arithmetic goes out of range" , .result_unpriv = REJECT, .result = ACCEPT,
tools/testing/selftests/bpf/verifier/value_ptr_arith.c +22 -1
@@ -169,7 +169,7 @@ .fixup_map_array_48b = { 1 }, .result = ACCEPT, .result_unpriv = REJECT, - .errstr_unpriv = "R2 tried to add from different maps or paths", + .errstr_unpriv = "R2 tried to add from different maps, paths, or prohibited types", .retval = 0, }, {
@@ -516,6 +516,27 @@ .result = ACCEPT, .retval = 0xabcdef12, }, +{ + "map access: value_ptr += N, value_ptr -= N known scalar", + .insns = { +BPF_ST_MEM (BPF_DW ,BPF_REG_10 ,-8 ,0 ), +BPF_MOV64_REG (BPF_REG_2 ,BPF_REG_10 ), +BPF_ALU64_IMM (BPF_ADD ,BPF_REG_2 ,-8 ), +BPF_LD_MAP_FD (BPF_REG_1 ,0 ), +BPF_RAW_INSN (BPF_JMP |BPF_CALL ,0 ,0 ,0 , BPF_FUNC_map_lookup_elem), +BPF_JMP_IMM (BPF_JEQ ,BPF_REG_0 ,0 ,6 ), +BPF_MOV32_IMM (BPF_REG_1 ,0x12345678 ), +BPF_STX_MEM (BPF_W ,BPF_REG_0 ,BPF_REG_1 ,0 ), +BPF_ALU64_IMM (BPF_ADD ,BPF_REG_0 ,2 ), +BPF_MOV64_IMM (BPF_REG_1 ,2 ), +BPF_ALU64_REG (BPF_SUB ,BPF_REG_0 ,BPF_REG_1 ), +BPF_LDX_MEM (BPF_W ,BPF_REG_0 ,BPF_REG_0 ,0 ), + BPF_EXIT_INSN(), + }, + .fixup_map_array_48b = { 3 }, + .result = ACCEPT, + .retval = 0x12345678, +}, {"map access: unknown scalar += value_ptr, 1" , .insns = {