···145145that files have been removed. This is done using whiteouts and opaque146146directories (non-directories are always opaque).147147148148-A whiteout is created as a character device with 0/0 device number.148148+A whiteout is created as a character device with 0/0 device number or149149+as a zero-size regular file with the xattr "trusted.overlay.whiteout".150150+149151When a whiteout is found in the upper level of a merged directory, any150152matching name in the lower level is ignored, and the whiteout itself151153is also hidden.···155153A directory is made opaque by setting the xattr "trusted.overlay.opaque"156154to "y". Where the upper filesystem contains an opaque directory, any157155directory in the lower filesystem with the same name is ignored.156156+157157+An opaque directory should not conntain any whiteouts, because they do not158158+serve any purpose. A merge directory containing regular files with the xattr159159+"trusted.overlay.whiteout", should be additionally marked by setting the xattr160160+"trusted.overlay.opaque" to "x" on the merge directory itself.161161+This is needed to avoid the overhead of checking the "trusted.overlay.whiteout"162162+on all entries during readdir in the common case.158163159164readdir160165-------···543534mount, so to support storing an effective whiteout file in an overlayfs mount an544535alternative form of whiteout is supported. This form is a regular, zero-size545536file with the "overlay.whiteout" xattr set, inside a directory with the546546-"overlay.whiteouts" xattr set. Such whiteouts are never created by overlayfs,547547-but can be used by userspace tools (like containers) that generate lower layers.537537+"overlay.opaque" xattr set to "x" (see `whiteouts and opaque directories`_).538538+These alternative whiteouts are never created by overlayfs, but can be used by539539+userspace tools (like containers) that generate lower layers.548540These alternative whiteouts can be escaped using the standard xattr escape549541mechanism in order to properly nest to any depth.550542
+5-3
MAINTAINERS
···4547454745484548CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS45494549M: David Howells <dhowells@redhat.com>45504550-L: linux-cachefs@redhat.com (moderated for non-subscribers)45504550+L: netfs@lists.linux.dev45514551S: Supported45524552F: Documentation/filesystems/caching/cachefiles.rst45534553F: fs/cachefiles/···79557955S: Maintained79567956F: rust/kernel/net/phy.rs7957795779587958-EXEC & BINFMT API79587958+EXEC & BINFMT API, ELF79597959R: Eric Biederman <ebiederm@xmission.com>79607960R: Kees Cook <keescook@chromium.org>79617961L: linux-mm@kvack.org79627962S: Supported79637963T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve79647964+F: Documentation/userspace-api/ELF.rst79647965F: fs/*binfmt_*.c79657966F: fs/exec.c79667967F: include/linux/binfmts.h···8224822382258224FILESYSTEMS [NETFS LIBRARY]82268225M: David Howells <dhowells@redhat.com>82278227-L: linux-cachefs@redhat.com (moderated for non-subscribers)82268226+R: Jeff Layton <jlayton@kernel.org>82278227+L: netfs@lists.linux.dev82288228L: linux-fsdevel@vger.kernel.org82298229S: Supported82308230F: Documentation/filesystems/caching/
···795795 struct bpf_tramp_links *fentry = &tlinks[BPF_TRAMP_FENTRY];796796 struct bpf_tramp_links *fexit = &tlinks[BPF_TRAMP_FEXIT];797797 struct bpf_tramp_links *fmod_ret = &tlinks[BPF_TRAMP_MODIFY_RETURN];798798+ bool is_struct_ops = flags & BPF_TRAMP_F_INDIRECT;798799 void *orig_call = func_addr;799800 bool save_ret;800801 u32 insn;···879878880879 stack_size = round_up(stack_size, 16);881880882882- if (func_addr) {881881+ if (!is_struct_ops) {883882 /* For the trampoline called from function entry,884883 * the frame of traced function and the frame of885884 * trampoline need to be considered.···9999981000999 emit_ld(RV_REG_S1, -sreg_off, RV_REG_FP, ctx);1001100010021002- if (func_addr) {10011001+ if (!is_struct_ops) {10031002 /* trampoline called from function entry */10041003 emit_ld(RV_REG_T0, stack_size - 8, RV_REG_SP, ctx);10051004 emit_ld(RV_REG_FP, stack_size - 16, RV_REG_SP, ctx);
···2929 WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))3030#define ASSERT_DPLL_NOT_REGISTERED(d) \3131 WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))3232-#define ASSERT_PIN_REGISTERED(p) \3333- WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED))34323533struct dpll_device_registration {3634 struct list_head list;···423425}424426EXPORT_SYMBOL_GPL(dpll_device_unregister);425427428428+static void dpll_pin_prop_free(struct dpll_pin_properties *prop)429429+{430430+ kfree(prop->package_label);431431+ kfree(prop->panel_label);432432+ kfree(prop->board_label);433433+ kfree(prop->freq_supported);434434+}435435+436436+static int dpll_pin_prop_dup(const struct dpll_pin_properties *src,437437+ struct dpll_pin_properties *dst)438438+{439439+ memcpy(dst, src, sizeof(*dst));440440+ if (src->freq_supported && src->freq_supported_num) {441441+ size_t freq_size = src->freq_supported_num *442442+ sizeof(*src->freq_supported);443443+ dst->freq_supported = kmemdup(src->freq_supported,444444+ freq_size, GFP_KERNEL);445445+ if (!src->freq_supported)446446+ return -ENOMEM;447447+ }448448+ if (src->board_label) {449449+ dst->board_label = kstrdup(src->board_label, GFP_KERNEL);450450+ if (!dst->board_label)451451+ goto err_board_label;452452+ }453453+ if (src->panel_label) {454454+ dst->panel_label = kstrdup(src->panel_label, GFP_KERNEL);455455+ if (!dst->panel_label)456456+ goto err_panel_label;457457+ }458458+ if (src->package_label) {459459+ dst->package_label = kstrdup(src->package_label, GFP_KERNEL);460460+ if (!dst->package_label)461461+ goto err_package_label;462462+ }463463+464464+ return 0;465465+466466+err_package_label:467467+ kfree(dst->panel_label);468468+err_panel_label:469469+ kfree(dst->board_label);470470+err_board_label:471471+ kfree(dst->freq_supported);472472+ return -ENOMEM;473473+}474474+426475static struct dpll_pin *427476dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module,428477 const struct dpll_pin_properties *prop)···486441 if (WARN_ON(prop->type < DPLL_PIN_TYPE_MUX ||487442 prop->type > DPLL_PIN_TYPE_MAX)) {488443 ret = -EINVAL;489489- goto err;444444+ goto err_pin_prop;490445 }491491- pin->prop = prop;446446+ ret = dpll_pin_prop_dup(prop, &pin->prop);447447+ if (ret)448448+ goto err_pin_prop;492449 refcount_set(&pin->refcount, 1);493450 xa_init_flags(&pin->dpll_refs, XA_FLAGS_ALLOC);494451 xa_init_flags(&pin->parent_refs, XA_FLAGS_ALLOC);495452 ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b,496453 &dpll_pin_xa_id, GFP_KERNEL);497454 if (ret)498498- goto err;455455+ goto err_xa_alloc;499456 return pin;500500-err:457457+err_xa_alloc:501458 xa_destroy(&pin->dpll_refs);502459 xa_destroy(&pin->parent_refs);460460+ dpll_pin_prop_free(&pin->prop);461461+err_pin_prop:503462 kfree(pin);504463 return ERR_PTR(ret);505464}···563514 xa_destroy(&pin->dpll_refs);564515 xa_destroy(&pin->parent_refs);565516 xa_erase(&dpll_pin_xa, pin->id);517517+ dpll_pin_prop_free(&pin->prop);566518 kfree(pin);567519 }568520 mutex_unlock(&dpll_lock);···613563 if (WARN_ON(!ops) ||614564 WARN_ON(!ops->state_on_dpll_get) ||615565 WARN_ON(!ops->direction_get))616616- return -EINVAL;617617- if (ASSERT_DPLL_REGISTERED(dpll))618566 return -EINVAL;619567620568 mutex_lock(&dpll_lock);···684636 unsigned long i, stop;685637 int ret;686638687687- if (WARN_ON(parent->prop->type != DPLL_PIN_TYPE_MUX))639639+ if (WARN_ON(parent->prop.type != DPLL_PIN_TYPE_MUX))688640 return -EINVAL;689641690642 if (WARN_ON(!ops) ||691643 WARN_ON(!ops->state_on_pin_get) ||692644 WARN_ON(!ops->direction_get))693693- return -EINVAL;694694- if (ASSERT_PIN_REGISTERED(parent))695645 return -EINVAL;696646697647 mutex_lock(&dpll_lock);
+2-2
drivers/dpll/dpll_core.h
···4444 * @module: module of creator4545 * @dpll_refs: hold referencees to dplls pin was registered with4646 * @parent_refs: hold references to parent pins pin was registered with4747- * @prop: pointer to pin properties given by registerer4747+ * @prop: pin properties copied from the registerer4848 * @rclk_dev_name: holds name of device when pin can recover clock from it4949 * @refcount: refcount5050 **/···5555 struct module *module;5656 struct xarray dpll_refs;5757 struct xarray parent_refs;5858- const struct dpll_pin_properties *prop;5858+ struct dpll_pin_properties prop;5959 refcount_t refcount;6060};6161
+41-16
drivers/dpll/dpll_netlink.c
···303303 if (nla_put_64bit(msg, DPLL_A_PIN_FREQUENCY, sizeof(freq), &freq,304304 DPLL_A_PIN_PAD))305305 return -EMSGSIZE;306306- for (fs = 0; fs < pin->prop->freq_supported_num; fs++) {306306+ for (fs = 0; fs < pin->prop.freq_supported_num; fs++) {307307 nest = nla_nest_start(msg, DPLL_A_PIN_FREQUENCY_SUPPORTED);308308 if (!nest)309309 return -EMSGSIZE;310310- freq = pin->prop->freq_supported[fs].min;310310+ freq = pin->prop.freq_supported[fs].min;311311 if (nla_put_64bit(msg, DPLL_A_PIN_FREQUENCY_MIN, sizeof(freq),312312 &freq, DPLL_A_PIN_PAD)) {313313 nla_nest_cancel(msg, nest);314314 return -EMSGSIZE;315315 }316316- freq = pin->prop->freq_supported[fs].max;316316+ freq = pin->prop.freq_supported[fs].max;317317 if (nla_put_64bit(msg, DPLL_A_PIN_FREQUENCY_MAX, sizeof(freq),318318 &freq, DPLL_A_PIN_PAD)) {319319 nla_nest_cancel(msg, nest);···329329{330330 int fs;331331332332- for (fs = 0; fs < pin->prop->freq_supported_num; fs++)333333- if (freq >= pin->prop->freq_supported[fs].min &&334334- freq <= pin->prop->freq_supported[fs].max)332332+ for (fs = 0; fs < pin->prop.freq_supported_num; fs++)333333+ if (freq >= pin->prop.freq_supported[fs].min &&334334+ freq <= pin->prop.freq_supported[fs].max)335335 return true;336336 return false;337337}···421421dpll_cmd_pin_get_one(struct sk_buff *msg, struct dpll_pin *pin,422422 struct netlink_ext_ack *extack)423423{424424- const struct dpll_pin_properties *prop = pin->prop;424424+ const struct dpll_pin_properties *prop = &pin->prop;425425 struct dpll_pin_ref *ref;426426 int ret;427427···553553 return dpll_device_event_send(DPLL_CMD_DEVICE_CHANGE_NTF, dpll);554554}555555556556+static bool dpll_pin_available(struct dpll_pin *pin)557557+{558558+ struct dpll_pin_ref *par_ref;559559+ unsigned long i;560560+561561+ if (!xa_get_mark(&dpll_pin_xa, pin->id, DPLL_REGISTERED))562562+ return false;563563+ xa_for_each(&pin->parent_refs, i, par_ref)564564+ if (xa_get_mark(&dpll_pin_xa, par_ref->pin->id,565565+ DPLL_REGISTERED))566566+ return true;567567+ xa_for_each(&pin->dpll_refs, i, par_ref)568568+ if (xa_get_mark(&dpll_device_xa, par_ref->dpll->id,569569+ DPLL_REGISTERED))570570+ return true;571571+ return false;572572+}573573+556574/**557575 * dpll_device_change_ntf - notify that the dpll device has been changed558576 * @dpll: registered dpll pointer···597579 int ret = -ENOMEM;598580 void *hdr;599581600600- if (WARN_ON(!xa_get_mark(&dpll_pin_xa, pin->id, DPLL_REGISTERED)))582582+ if (!dpll_pin_available(pin))601583 return -ENODEV;602584603585 msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);···735717 int ret;736718737719 if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE &738738- pin->prop->capabilities)) {720720+ pin->prop.capabilities)) {739721 NL_SET_ERR_MSG(extack, "state changing is not allowed");740722 return -EOPNOTSUPP;741723 }···771753 int ret;772754773755 if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE &774774- pin->prop->capabilities)) {756756+ pin->prop.capabilities)) {775757 NL_SET_ERR_MSG(extack, "state changing is not allowed");776758 return -EOPNOTSUPP;777759 }···798780 int ret;799781800782 if (!(DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE &801801- pin->prop->capabilities)) {783783+ pin->prop.capabilities)) {802784 NL_SET_ERR_MSG(extack, "prio changing is not allowed");803785 return -EOPNOTSUPP;804786 }···826808 int ret;827809828810 if (!(DPLL_PIN_CAPABILITIES_DIRECTION_CAN_CHANGE &829829- pin->prop->capabilities)) {811811+ pin->prop.capabilities)) {830812 NL_SET_ERR_MSG(extack, "direction changing is not allowed");831813 return -EOPNOTSUPP;832814 }···856838 int ret;857839858840 phase_adj = nla_get_s32(phase_adj_attr);859859- if (phase_adj > pin->prop->phase_range.max ||860860- phase_adj < pin->prop->phase_range.min) {841841+ if (phase_adj > pin->prop.phase_range.max ||842842+ phase_adj < pin->prop.phase_range.min) {861843 NL_SET_ERR_MSG_ATTR(extack, phase_adj_attr,862844 "phase adjust value not supported");863845 return -EINVAL;···10411023 unsigned long i;1042102410431025 xa_for_each_marked(&dpll_pin_xa, i, pin, DPLL_REGISTERED) {10441044- prop = pin->prop;10261026+ prop = &pin->prop;10451027 cid_match = clock_id ? pin->clock_id == clock_id : true;10461028 mod_match = mod_name_attr && module_name(pin->module) ?10471029 !nla_strcmp(mod_name_attr,···11481130 }11491131 pin = dpll_pin_find_from_nlattr(info);11501132 if (!IS_ERR(pin)) {11331133+ if (!dpll_pin_available(pin)) {11341134+ nlmsg_free(msg);11351135+ return -ENODEV;11361136+ }11511137 ret = dpll_msg_add_pin_handle(msg, pin);11521138 if (ret) {11531139 nlmsg_free(msg);···1201117912021180 xa_for_each_marked_start(&dpll_pin_xa, i, pin, DPLL_REGISTERED,12031181 ctx->idx) {11821182+ if (!dpll_pin_available(pin))11831183+ continue;12041184 hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid,12051185 cb->nlh->nlmsg_seq,12061186 &dpll_nl_family, NLM_F_MULTI,···14651441 }14661442 info->user_ptr[0] = xa_load(&dpll_pin_xa,14671443 nla_get_u32(info->attrs[DPLL_A_PIN_ID]));14681468- if (!info->user_ptr[0]) {14441444+ if (!info->user_ptr[0] ||14451445+ !dpll_pin_available(info->user_ptr[0])) {14691446 NL_SET_ERR_MSG(info->extack, "pin not found");14701447 ret = -ENODEV;14711448 goto unlock_dev;
+7-2
drivers/gpu/drm/ttm/ttm_device.c
···195195 bool use_dma_alloc, bool use_dma32)196196{197197 struct ttm_global *glob = &ttm_glob;198198- int ret;198198+ int ret, nid;199199200200 if (WARN_ON(vma_manager == NULL))201201 return -EINVAL;···215215216216 ttm_sys_man_init(bdev);217217218218- ttm_pool_init(&bdev->pool, dev, dev_to_node(dev), use_dma_alloc, use_dma32);218218+ if (dev)219219+ nid = dev_to_node(dev);220220+ else221221+ nid = NUMA_NO_NODE;222222+223223+ ttm_pool_init(&bdev->pool, dev, nid, use_dma_alloc, use_dma32);219224220225 bdev->vma_manager = vma_manager;221226 spin_lock_init(&bdev->lru_lock);
···102102103103module_init(NS8390p_init_module);104104module_exit(NS8390p_cleanup_module);105105+MODULE_DESCRIPTION("National Semiconductor 8390 core for ISA driver");105106MODULE_LICENSE("GPL");
···1485148514861486 xdp_prepare_buff(&xdp, page_address(entry->page),14871487 XDP_PACKET_HEADROOM + TSNEP_RX_INLINE_METADATA_SIZE,14881488- length, false);14881488+ length - ETH_FCS_LEN, false);1489148914901490 consume = tsnep_xdp_run_prog(rx, prog, &xdp,14911491 &xdp_status, tx_nq, tx);···15681568 prefetch(entry->xdp->data);15691569 length = __le32_to_cpu(entry->desc_wb->properties) &15701570 TSNEP_DESC_LENGTH_MASK;15711571- xsk_buff_set_size(entry->xdp, length);15711571+ xsk_buff_set_size(entry->xdp, length - ETH_FCS_LEN);15721572 xsk_buff_dma_sync_for_cpu(entry->xdp, rx->xsk_pool);1573157315741574 /* RX metadata with timestamps is in front of actual data,···1761176117621762 allocated--;17631763 }17641764+ }17651765+17661766+ /* set need wakeup flag immediately if ring is not filled completely,17671767+ * first polling would be too late as need wakeup signalisation would17681768+ * be delayed for an indefinite time17691769+ */17701770+ if (xsk_uses_need_wakeup(rx->xsk_pool)) {17711771+ int desc_available = tsnep_rx_desc_available(rx);17721772+17731773+ if (desc_available)17741774+ xsk_set_rx_need_wakeup(rx->xsk_pool);17751775+ else17761776+ xsk_clear_rx_need_wakeup(rx->xsk_pool);17641777 }17651778}17661779
···2036203620372037 /* if any of the above changed restart the FEC */20382038 if (status_change) {20392039+ netif_stop_queue(ndev);20392040 napi_disable(&fep->napi);20402041 netif_tx_lock_bh(ndev);20412042 fec_restart(ndev);···20462045 }20472046 } else {20482047 if (fep->link) {20482048+ netif_stop_queue(ndev);20492049 napi_disable(&fep->napi);20502050 netif_tx_lock_bh(ndev);20512051 fec_stop(ndev);···4771476947724770module_platform_driver(fec_driver);4773477147724772+MODULE_DESCRIPTION("NXP Fast Ethernet Controller (FEC) driver");47744773MODULE_LICENSE("GPL");
···35883588 struct i40e_hmc_obj_rxq rx_ctx;35893589 int err = 0;35903590 bool ok;35913591- int ret;3592359135933592 bitmap_zero(ring->state, __I40E_RING_STATE_NBITS);3594359335953594 /* clear the context structure first */35963595 memset(&rx_ctx, 0, sizeof(rx_ctx));3597359635983598- if (ring->vsi->type == I40E_VSI_MAIN)35993599- xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq);35973597+ ring->rx_buf_len = vsi->rx_buf_len;35983598+35993599+ /* XDP RX-queue info only needed for RX rings exposed to XDP */36003600+ if (ring->vsi->type != I40E_VSI_MAIN)36013601+ goto skip;36023602+36033603+ if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) {36043604+ err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,36053605+ ring->queue_index,36063606+ ring->q_vector->napi.napi_id,36073607+ ring->rx_buf_len);36083608+ if (err)36093609+ return err;36103610+ }3600361136013612 ring->xsk_pool = i40e_xsk_pool(ring);36023613 if (ring->xsk_pool) {36033603- ring->rx_buf_len =36043604- xsk_pool_get_rx_frame_size(ring->xsk_pool);36053605- ret = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,36143614+ xdp_rxq_info_unreg(&ring->xdp_rxq);36153615+ ring->rx_buf_len = xsk_pool_get_rx_frame_size(ring->xsk_pool);36163616+ err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,36173617+ ring->queue_index,36183618+ ring->q_vector->napi.napi_id,36193619+ ring->rx_buf_len);36203620+ if (err)36213621+ return err;36223622+ err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,36063623 MEM_TYPE_XSK_BUFF_POOL,36073624 NULL);36083608- if (ret)36093609- return ret;36253625+ if (err)36263626+ return err;36103627 dev_info(&vsi->back->pdev->dev,36113628 "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n",36123629 ring->queue_index);3613363036143631 } else {36153615- ring->rx_buf_len = vsi->rx_buf_len;36163616- if (ring->vsi->type == I40E_VSI_MAIN) {36173617- ret = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,36183618- MEM_TYPE_PAGE_SHARED,36193619- NULL);36203620- if (ret)36213621- return ret;36223622- }36323632+ err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,36333633+ MEM_TYPE_PAGE_SHARED,36343634+ NULL);36353635+ if (err)36363636+ return err;36233637 }3624363836393639+skip:36253640 xdp_init_buff(&ring->xdp, i40e_rx_pg_size(ring) / 2, &ring->xdp_rxq);3626364136273642 rx_ctx.dbuff = DIV_ROUND_UP(ring->rx_buf_len,
+23-26
drivers/net/ethernet/intel/i40e/i40e_txrx.c
···15481548int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring)15491549{15501550 struct device *dev = rx_ring->dev;15511551- int err;1552155115531552 u64_stats_init(&rx_ring->syncp);15541553···15671568 rx_ring->next_to_clean = 0;15681569 rx_ring->next_to_process = 0;15691570 rx_ring->next_to_use = 0;15701570-15711571- /* XDP RX-queue info only needed for RX rings exposed to XDP */15721572- if (rx_ring->vsi->type == I40E_VSI_MAIN) {15731573- err = xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev,15741574- rx_ring->queue_index, rx_ring->q_vector->napi.napi_id);15751575- if (err < 0)15761576- return err;15771577- }1578157115791572 rx_ring->xdp_prog = rx_ring->vsi->xdp_prog;15801573···20782087static void i40e_process_rx_buffs(struct i40e_ring *rx_ring, int xdp_res,20792088 struct xdp_buff *xdp)20802089{20812081- u32 next = rx_ring->next_to_clean;20902090+ u32 nr_frags = xdp_get_shared_info_from_buff(xdp)->nr_frags;20912091+ u32 next = rx_ring->next_to_clean, i = 0;20822092 struct i40e_rx_buffer *rx_buffer;2083209320842094 xdp->flags = 0;···20922100 if (!rx_buffer->page)20932101 continue;2094210220952095- if (xdp_res == I40E_XDP_CONSUMED)20962096- rx_buffer->pagecnt_bias++;20972097- else21032103+ if (xdp_res != I40E_XDP_CONSUMED)20982104 i40e_rx_buffer_flip(rx_buffer, xdp->frame_sz);21052105+ else if (i++ <= nr_frags)21062106+ rx_buffer->pagecnt_bias++;2099210721002108 /* EOP buffer will be put in i40e_clean_rx_irq() */21012109 if (next == rx_ring->next_to_process)···21092117 * i40e_construct_skb - Allocate skb and populate it21102118 * @rx_ring: rx descriptor ring to transact packets on21112119 * @xdp: xdp_buff pointing to the data21122112- * @nr_frags: number of buffers for the packet21132120 *21142121 * This function allocates an skb. It then populates it with the page21152122 * data from the current receive descriptor, taking care to set up the21162123 * skb correctly.21172124 */21182125static struct sk_buff *i40e_construct_skb(struct i40e_ring *rx_ring,21192119- struct xdp_buff *xdp,21202120- u32 nr_frags)21262126+ struct xdp_buff *xdp)21212127{21222128 unsigned int size = xdp->data_end - xdp->data;21232129 struct i40e_rx_buffer *rx_buffer;21302130+ struct skb_shared_info *sinfo;21242131 unsigned int headlen;21252132 struct sk_buff *skb;21332133+ u32 nr_frags = 0;2126213421272135 /* prefetch first cache line of first page */21282136 net_prefetch(xdp->data);···21602168 memcpy(__skb_put(skb, headlen), xdp->data,21612169 ALIGN(headlen, sizeof(long)));2162217021712171+ if (unlikely(xdp_buff_has_frags(xdp))) {21722172+ sinfo = xdp_get_shared_info_from_buff(xdp);21732173+ nr_frags = sinfo->nr_frags;21742174+ }21632175 rx_buffer = i40e_rx_bi(rx_ring, rx_ring->next_to_clean);21642176 /* update all of the pointers */21652177 size -= headlen;···21832187 }2184218821852189 if (unlikely(xdp_buff_has_frags(xdp))) {21862186- struct skb_shared_info *sinfo, *skinfo = skb_shinfo(skb);21902190+ struct skb_shared_info *skinfo = skb_shinfo(skb);2187219121882188- sinfo = xdp_get_shared_info_from_buff(xdp);21892192 memcpy(&skinfo->frags[skinfo->nr_frags], &sinfo->frags[0],21902193 sizeof(skb_frag_t) * nr_frags);21912194···22072212 * i40e_build_skb - Build skb around an existing buffer22082213 * @rx_ring: Rx descriptor ring to transact packets on22092214 * @xdp: xdp_buff pointing to the data22102210- * @nr_frags: number of buffers for the packet22112215 *22122216 * This function builds an skb around an existing Rx buffer, taking care22132217 * to set up the skb correctly and avoid any memcpy overhead.22142218 */22152219static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring,22162216- struct xdp_buff *xdp,22172217- u32 nr_frags)22202220+ struct xdp_buff *xdp)22182221{22192222 unsigned int metasize = xdp->data - xdp->data_meta;22232223+ struct skb_shared_info *sinfo;22202224 struct sk_buff *skb;22252225+ u32 nr_frags;2221222622222227 /* Prefetch first cache line of first page. If xdp->data_meta22232228 * is unused, this points exactly as xdp->data, otherwise we···22252230 * data, and then actual data.22262231 */22272232 net_prefetch(xdp->data_meta);22332233+22342234+ if (unlikely(xdp_buff_has_frags(xdp))) {22352235+ sinfo = xdp_get_shared_info_from_buff(xdp);22362236+ nr_frags = sinfo->nr_frags;22372237+ }2228223822292239 /* build an skb around the page buffer */22302240 skb = napi_build_skb(xdp->data_hard_start, xdp->frame_sz);···22432243 skb_metadata_set(skb, metasize);2244224422452245 if (unlikely(xdp_buff_has_frags(xdp))) {22462246- struct skb_shared_info *sinfo;22472247-22482248- sinfo = xdp_get_shared_info_from_buff(xdp);22492246 xdp_update_skb_shared_info(skb, nr_frags,22502247 sinfo->xdp_frags_size,22512248 nr_frags * xdp->frame_sz,···25862589 total_rx_bytes += size;25872590 } else {25882591 if (ring_uses_build_skb(rx_ring))25892589- skb = i40e_build_skb(rx_ring, xdp, nfrags);25922592+ skb = i40e_build_skb(rx_ring, xdp);25902593 else25912591- skb = i40e_construct_skb(rx_ring, xdp, nfrags);25942594+ skb = i40e_construct_skb(rx_ring, xdp);2592259525932596 /* drop if we failed to retrieve a buffer */25942597 if (!skb) {
···547547 ring->rx_buf_len = ring->vsi->rx_buf_len;548548549549 if (ring->vsi->type == ICE_VSI_PF) {550550- if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))551551- /* coverity[check_return] */552552- __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,553553- ring->q_index,554554- ring->q_vector->napi.napi_id,555555- ring->vsi->rx_buf_len);550550+ if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) {551551+ err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,552552+ ring->q_index,553553+ ring->q_vector->napi.napi_id,554554+ ring->rx_buf_len);555555+ if (err)556556+ return err;557557+ }556558557559 ring->xsk_pool = ice_xsk_pool(ring);558560 if (ring->xsk_pool) {559559- xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq);561561+ xdp_rxq_info_unreg(&ring->xdp_rxq);560562561563 ring->rx_buf_len =562564 xsk_pool_get_rx_frame_size(ring->xsk_pool);565565+ err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,566566+ ring->q_index,567567+ ring->q_vector->napi.napi_id,568568+ ring->rx_buf_len);569569+ if (err)570570+ return err;563571 err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,564572 MEM_TYPE_XSK_BUFF_POOL,565573 NULL);···579571 dev_info(dev, "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n",580572 ring->q_index);581573 } else {582582- if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))583583- /* coverity[check_return] */584584- __xdp_rxq_info_reg(&ring->xdp_rxq,585585- ring->netdev,586586- ring->q_index,587587- ring->q_vector->napi.napi_id,588588- ring->vsi->rx_buf_len);574574+ if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) {575575+ err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,576576+ ring->q_index,577577+ ring->q_vector->napi.napi_id,578578+ ring->rx_buf_len);579579+ if (err)580580+ return err;581581+ }589582590583 err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,591584 MEM_TYPE_PAGE_SHARED,
+9-10
drivers/net/ethernet/intel/ice/ice_txrx.c
···513513 if (ice_is_xdp_ena_vsi(rx_ring->vsi))514514 WRITE_ONCE(rx_ring->xdp_prog, rx_ring->vsi->xdp_prog);515515516516- if (rx_ring->vsi->type == ICE_VSI_PF &&517517- !xdp_rxq_info_is_reg(&rx_ring->xdp_rxq))518518- if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev,519519- rx_ring->q_index, rx_ring->q_vector->napi.napi_id))520520- goto err;521516 return 0;522517523518err:···598603 ret = ICE_XDP_CONSUMED;599604 }600605exit:601601- rx_buf->act = ret;602602- if (unlikely(xdp_buff_has_frags(xdp)))603603- ice_set_rx_bufs_act(xdp, rx_ring, ret);606606+ ice_set_rx_bufs_act(xdp, rx_ring, ret);604607}605608606609/**···886893 }887894888895 if (unlikely(sinfo->nr_frags == MAX_SKB_FRAGS)) {889889- if (unlikely(xdp_buff_has_frags(xdp)))890890- ice_set_rx_bufs_act(xdp, rx_ring, ICE_XDP_CONSUMED);896896+ ice_set_rx_bufs_act(xdp, rx_ring, ICE_XDP_CONSUMED);891897 return -ENOMEM;892898 }893899894900 __skb_fill_page_desc_noacc(sinfo, sinfo->nr_frags++, rx_buf->page,895901 rx_buf->page_offset, size);896902 sinfo->xdp_frags_size += size;903903+ /* remember frag count before XDP prog execution; bpf_xdp_adjust_tail()904904+ * can pop off frags but driver has to handle it on its own905905+ */906906+ rx_ring->nr_frags = sinfo->nr_frags;897907898908 if (page_is_pfmemalloc(rx_buf->page))899909 xdp_buff_set_frag_pfmemalloc(xdp);···1247125112481252 xdp->data = NULL;12491253 rx_ring->first_desc = ntc;12541254+ rx_ring->nr_frags = 0;12501255 continue;12511256construct_skb:12521257 if (likely(ice_ring_uses_build_skb(rx_ring)))···12631266 ICE_XDP_CONSUMED);12641267 xdp->data = NULL;12651268 rx_ring->first_desc = ntc;12691269+ rx_ring->nr_frags = 0;12661270 break;12671271 }12681272 xdp->data = NULL;12691273 rx_ring->first_desc = ntc;12741274+ rx_ring->nr_frags = 0;1270127512711276 stat_err_bits = BIT(ICE_RX_FLEX_DESC_STATUS0_RXE_S);12721277 if (unlikely(ice_test_staterr(rx_desc->wb.status_error0,
+1
drivers/net/ethernet/intel/ice/ice_txrx.h
···358358 struct ice_tx_ring *xdp_ring;359359 struct ice_rx_ring *next; /* pointer to next ring in q_vector */360360 struct xsk_buff_pool *xsk_pool;361361+ u32 nr_frags;361362 dma_addr_t dma; /* physical address of ring */362363 u16 rx_buf_len;363364 u8 dcb_tc; /* Traffic class of ring */
+22-9
drivers/net/ethernet/intel/ice/ice_txrx_lib.h
···1212 * act: action to store onto Rx buffers related to XDP buffer parts1313 *1414 * Set action that should be taken before putting Rx buffer from first frag1515- * to one before last. Last one is handled by caller of this function as it1616- * is the EOP frag that is currently being processed. This function is1717- * supposed to be called only when XDP buffer contains frags.1515+ * to the last.1816 */1917static inline void2018ice_set_rx_bufs_act(struct xdp_buff *xdp, const struct ice_rx_ring *rx_ring,2119 const unsigned int act)2220{2323- const struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);2424- u32 first = rx_ring->first_desc;2525- u32 nr_frags = sinfo->nr_frags;2121+ u32 sinfo_frags = xdp_get_shared_info_from_buff(xdp)->nr_frags;2222+ u32 nr_frags = rx_ring->nr_frags + 1;2323+ u32 idx = rx_ring->first_desc;2624 u32 cnt = rx_ring->count;2725 struct ice_rx_buf *buf;28262927 for (int i = 0; i < nr_frags; i++) {3030- buf = &rx_ring->rx_buf[first];2828+ buf = &rx_ring->rx_buf[idx];3129 buf->act = act;32303333- if (++first == cnt)3434- first = 0;3131+ if (++idx == cnt)3232+ idx = 0;3333+ }3434+3535+ /* adjust pagecnt_bias on frags freed by XDP prog */3636+ if (sinfo_frags < rx_ring->nr_frags && act == ICE_XDP_CONSUMED) {3737+ u32 delta = rx_ring->nr_frags - sinfo_frags;3838+3939+ while (delta) {4040+ if (idx == 0)4141+ idx = cnt - 1;4242+ else4343+ idx--;4444+ buf = &rx_ring->rx_buf[idx];4545+ buf->pagecnt_bias--;4646+ delta--;4747+ }3548 }3649}3750
···783783 /* setup watchdog timeout value to be 5 second */784784 netdev->watchdog_timeo = 5 * HZ;785785786786+ netdev->dev_port = idx;787787+786788 /* configure default MTU size */787789 netdev->min_mtu = ETH_MIN_MTU;788790 netdev->max_mtu = vport->max_mtu;
+1
drivers/net/ethernet/litex/litex_liteeth.c
···318318module_platform_driver(liteeth_driver);319319320320MODULE_AUTHOR("Joel Stanley <joel@jms.id.au>");321321+MODULE_DESCRIPTION("LiteX Liteeth Ethernet driver");321322MODULE_LICENSE("GPL");
+26-1
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
···614614 mvpp2_write(priv, MVPP22_BM_POOL_BASE_ADDR_HIGH_REG, val);615615}616616617617+/* Cleanup pool before actual initialization in the OS */618618+static void mvpp2_bm_pool_cleanup(struct mvpp2 *priv, int pool_id)619619+{620620+ unsigned int thread = mvpp2_cpu_to_thread(priv, get_cpu());621621+ u32 val;622622+ int i;623623+624624+ /* Drain the BM from all possible residues left by firmware */625625+ for (i = 0; i < MVPP2_BM_POOL_SIZE_MAX; i++)626626+ mvpp2_thread_read(priv, thread, MVPP2_BM_PHY_ALLOC_REG(pool_id));627627+628628+ put_cpu();629629+630630+ /* Stop the BM pool */631631+ val = mvpp2_read(priv, MVPP2_BM_POOL_CTRL_REG(pool_id));632632+ val |= MVPP2_BM_STOP_MASK;633633+ mvpp2_write(priv, MVPP2_BM_POOL_CTRL_REG(pool_id), val);634634+}635635+617636static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv)618637{619638 enum dma_data_direction dma_dir = DMA_FROM_DEVICE;620639 int i, err, poolnum = MVPP2_BM_POOLS_NUM;621640 struct mvpp2_port *port;641641+642642+ if (priv->percpu_pools)643643+ poolnum = mvpp2_get_nrxqs(priv) * 2;644644+645645+ /* Clean up the pool state in case it contains stale state */646646+ for (i = 0; i < poolnum; i++)647647+ mvpp2_bm_pool_cleanup(priv, i);622648623649 if (priv->percpu_pools) {624650 for (i = 0; i < priv->port_count; i++) {···655629 }656630 }657631658658- poolnum = mvpp2_get_nrxqs(priv) * 2;659632 for (i = 0; i < poolnum; i++) {660633 /* the pool in use */661634 int pn = i / (poolnum / 2);
+1
drivers/net/ethernet/marvell/octeontx2/af/mbox.c
···413413EXPORT_SYMBOL(otx2_mbox_id2name);414414415415MODULE_AUTHOR("Marvell.");416416+MODULE_DESCRIPTION("Marvell RVU NIC Mbox helpers");416417MODULE_LICENSE("GPL v2");
+3-2
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
···19231923{19241924 const char *namep = mlx5_command_str(opcode);19251925 struct mlx5_cmd_stats *stats;19261926+ unsigned long flags;1926192719271928 if (!err || !(strcmp(namep, "unknown command opcode")))19281929 return;···19311930 stats = xa_load(&dev->cmd.stats, opcode);19321931 if (!stats)19331932 return;19341934- spin_lock_irq(&stats->lock);19331933+ spin_lock_irqsave(&stats->lock, flags);19351934 stats->failed++;19361935 if (err < 0)19371936 stats->last_failed_errno = -err;···19401939 stats->last_failed_mbox_status = status;19411940 stats->last_failed_syndrome = syndrome;19421941 }19431943- spin_unlock_irq(&stats->lock);19421942+ spin_unlock_irqrestore(&stats->lock, flags);19441943}1945194419461945/* preserve -EREMOTEIO for outbox.status != OK, otherwise return err as is */
···783783 }784784785785 /* This should only be called once per mdev */786786- err = mlx5e_create_mdev_resources(mdev);786786+ err = mlx5e_create_mdev_resources(mdev, false);787787 if (err)788788 goto destroy_ht;789789 }
···788788 switch (action_type) {789789 case DR_ACTION_TYP_DROP:790790 attr.final_icm_addr = nic_dmn->drop_icm_addr;791791+ attr.hit_gvmi = nic_dmn->drop_icm_addr >> 48;791792 break;792793 case DR_ACTION_TYP_FT:793794 dest_action = action;···874873 action->sampler->tx_icm_addr;875874 break;876875 case DR_ACTION_TYP_VPORT:877877- attr.hit_gvmi = action->vport->caps->vhca_gvmi;878878- dest_action = action;879879- attr.final_icm_addr = rx_rule ?880880- action->vport->caps->icm_address_rx :881881- action->vport->caps->icm_address_tx;876876+ if (unlikely(rx_rule && action->vport->caps->num == MLX5_VPORT_UPLINK)) {877877+ /* can't go to uplink on RX rule - dropping instead */878878+ attr.final_icm_addr = nic_dmn->drop_icm_addr;879879+ attr.hit_gvmi = nic_dmn->drop_icm_addr >> 48;880880+ } else {881881+ attr.hit_gvmi = action->vport->caps->vhca_gvmi;882882+ dest_action = action;883883+ attr.final_icm_addr = rx_rule ?884884+ action->vport->caps->icm_address_rx :885885+ action->vport->caps->icm_address_tx;886886+ }882887 break;883888 case DR_ACTION_TYP_POP_VLAN:884889 if (!rx_rule && !(dmn->ste_ctx->actions_caps &
+21
drivers/net/ethernet/mellanox/mlx5/core/vport.c
···440440}441441EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_system_image_guid);442442443443+int mlx5_query_nic_vport_sd_group(struct mlx5_core_dev *mdev, u8 *sd_group)444444+{445445+ int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);446446+ u32 *out;447447+ int err;448448+449449+ out = kvzalloc(outlen, GFP_KERNEL);450450+ if (!out)451451+ return -ENOMEM;452452+453453+ err = mlx5_query_nic_vport_context(mdev, 0, out);454454+ if (err)455455+ goto out;456456+457457+ *sd_group = MLX5_GET(query_nic_vport_context_out, out,458458+ nic_vport_context.sd_group);459459+out:460460+ kvfree(out);461461+ return err;462462+}463463+443464int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)444465{445466 u32 *out;
+3
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
···75427542 dev_err(priv->device, "unable to bring out of ahb reset: %pe\n",75437543 ERR_PTR(ret));7544754475457545+ /* Wait a bit for the reset to take effect */75467546+ udelay(10);75477547+75457548 /* Init MAC and get the capabilities */75467549 ret = stmmac_hw_init(priv);75477550 if (ret)
+30-7
drivers/net/fjes/fjes_hw.c
···221221222222 mem_size = FJES_DEV_REQ_BUF_SIZE(hw->max_epid);223223 hw->hw_info.req_buf = kzalloc(mem_size, GFP_KERNEL);224224- if (!(hw->hw_info.req_buf))225225- return -ENOMEM;224224+ if (!(hw->hw_info.req_buf)) {225225+ result = -ENOMEM;226226+ goto free_ep_info;227227+ }226228227229 hw->hw_info.req_buf_size = mem_size;228230229231 mem_size = FJES_DEV_RES_BUF_SIZE(hw->max_epid);230232 hw->hw_info.res_buf = kzalloc(mem_size, GFP_KERNEL);231231- if (!(hw->hw_info.res_buf))232232- return -ENOMEM;233233+ if (!(hw->hw_info.res_buf)) {234234+ result = -ENOMEM;235235+ goto free_req_buf;236236+ }233237234238 hw->hw_info.res_buf_size = mem_size;235239236240 result = fjes_hw_alloc_shared_status_region(hw);237241 if (result)238238- return result;242242+ goto free_res_buf;239243240244 hw->hw_info.buffer_share_bit = 0;241245 hw->hw_info.buffer_unshare_reserve_bit = 0;···250246251247 result = fjes_hw_alloc_epbuf(&buf_pair->tx);252248 if (result)253253- return result;249249+ goto free_epbuf;254250255251 result = fjes_hw_alloc_epbuf(&buf_pair->rx);256252 if (result)257257- return result;253253+ goto free_epbuf;258254259255 spin_lock_irqsave(&hw->rx_status_lock, flags);260256 fjes_hw_setup_epbuf(&buf_pair->tx, mac,···277273 fjes_hw_init_command_registers(hw, ¶m);278274279275 return 0;276276+277277+free_epbuf:278278+ for (epidx = 0; epidx < hw->max_epid ; epidx++) {279279+ if (epidx == hw->my_epid)280280+ continue;281281+ fjes_hw_free_epbuf(&hw->ep_shm_info[epidx].tx);282282+ fjes_hw_free_epbuf(&hw->ep_shm_info[epidx].rx);283283+ }284284+ fjes_hw_free_shared_status_region(hw);285285+free_res_buf:286286+ kfree(hw->hw_info.res_buf);287287+ hw->hw_info.res_buf = NULL;288288+free_req_buf:289289+ kfree(hw->hw_info.req_buf);290290+ hw->hw_info.req_buf = NULL;291291+free_ep_info:292292+ kfree(hw->ep_shm_info);293293+ hw->ep_shm_info = NULL;294294+ return result;280295}281296282297static void fjes_hw_cleanup(struct fjes_hw *hw)
···67566756 goto err;67576757 }6758675867596759- /* In the case of hardware recovery, debugfs files are67606760- * not deleted since ieee80211_ops.remove_interface() is67616761- * not invoked. In such cases, try to delete the files.67626762- * These will be re-created later.67636763- */67646764- ath11k_debugfs_remove_interface(arvif);67656765-67666759 memset(arvif, 0, sizeof(*arvif));6767676067686761 arvif->ar = ar;···6932693969336940 ath11k_dp_vdev_tx_attach(ar, arvif);6934694169356935- ath11k_debugfs_add_interface(arvif);69366936-69376942 if (vif->type != NL80211_IFTYPE_MONITOR &&69386943 test_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags)) {69396944 ret = ath11k_mac_monitor_vdev_create(ar);···7046705570477056 /* Recalc txpower for remaining vdev */70487057 ath11k_mac_txpower_recalc(ar);70497049-70507050- ath11k_debugfs_remove_interface(arvif);7051705870527059 /* TODO: recal traffic pause state based on the available vdevs */70537060···91429153#endif9143915491449155#ifdef CONFIG_ATH11K_DEBUGFS91569156+ .vif_add_debugfs = ath11k_debugfs_op_vif_add,91459157 .sta_add_debugfs = ath11k_debugfs_sta_op_add,91469158#endif91479159
···141141}142142143143static int compression_decompress(int type, struct list_head *ws,144144- const u8 *data_in, struct page *dest_page,145145- unsigned long start_byte, size_t srclen, size_t destlen)144144+ const u8 *data_in, struct page *dest_page,145145+ unsigned long dest_pgoff, size_t srclen, size_t destlen)146146{147147 switch (type) {148148 case BTRFS_COMPRESS_ZLIB: return zlib_decompress(ws, data_in, dest_page,149149- start_byte, srclen, destlen);149149+ dest_pgoff, srclen, destlen);150150 case BTRFS_COMPRESS_LZO: return lzo_decompress(ws, data_in, dest_page,151151- start_byte, srclen, destlen);151151+ dest_pgoff, srclen, destlen);152152 case BTRFS_COMPRESS_ZSTD: return zstd_decompress(ws, data_in, dest_page,153153- start_byte, srclen, destlen);153153+ dest_pgoff, srclen, destlen);154154 case BTRFS_COMPRESS_NONE:155155 default:156156 /*···10371037 * start_byte tells us the offset into the compressed data we're interested in10381038 */10391039int btrfs_decompress(int type, const u8 *data_in, struct page *dest_page,10401040- unsigned long start_byte, size_t srclen, size_t destlen)10401040+ unsigned long dest_pgoff, size_t srclen, size_t destlen)10411041{10421042+ struct btrfs_fs_info *fs_info = btrfs_sb(dest_page->mapping->host->i_sb);10421043 struct list_head *workspace;10441044+ const u32 sectorsize = fs_info->sectorsize;10431045 int ret;10461046+10471047+ /*10481048+ * The full destination page range should not exceed the page size.10491049+ * And the @destlen should not exceed sectorsize, as this is only called for10501050+ * inline file extents, which should not exceed sectorsize.10511051+ */10521052+ ASSERT(dest_pgoff + destlen <= PAGE_SIZE && destlen <= sectorsize);1044105310451054 workspace = get_workspace(type, 0);10461055 ret = compression_decompress(type, workspace, data_in, dest_page,10471047- start_byte, srclen, destlen);10561056+ dest_pgoff, srclen, destlen);10481057 put_workspace(type, workspace);1049105810501059 return ret;
+2-2
fs/btrfs/compression.h
···148148 unsigned long *total_in, unsigned long *total_out);149149int zlib_decompress_bio(struct list_head *ws, struct compressed_bio *cb);150150int zlib_decompress(struct list_head *ws, const u8 *data_in,151151- struct page *dest_page, unsigned long start_byte, size_t srclen,151151+ struct page *dest_page, unsigned long dest_pgoff, size_t srclen,152152 size_t destlen);153153struct list_head *zlib_alloc_workspace(unsigned int level);154154void zlib_free_workspace(struct list_head *ws);···159159 unsigned long *total_in, unsigned long *total_out);160160int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb);161161int lzo_decompress(struct list_head *ws, const u8 *data_in,162162- struct page *dest_page, unsigned long start_byte, size_t srclen,162162+ struct page *dest_page, unsigned long dest_pgoff, size_t srclen,163163 size_t destlen);164164struct list_head *lzo_alloc_workspace(unsigned int level);165165void lzo_free_workspace(struct list_head *ws);
+39-14
fs/btrfs/extent-tree.c
···12601260 u64 bytes_left, end;12611261 u64 aligned_start = ALIGN(start, 1 << SECTOR_SHIFT);1262126212631263- if (WARN_ON(start != aligned_start)) {12631263+ /* Adjust the range to be aligned to 512B sectors if necessary. */12641264+ if (start != aligned_start) {12641265 len -= aligned_start - start;12651266 len = round_down(len, 1 << SECTOR_SHIFT);12661267 start = aligned_start;···42994298 return 0;43004299}4301430043014301+static int prepare_allocation_zoned(struct btrfs_fs_info *fs_info,43024302+ struct find_free_extent_ctl *ffe_ctl)43034303+{43044304+ if (ffe_ctl->for_treelog) {43054305+ spin_lock(&fs_info->treelog_bg_lock);43064306+ if (fs_info->treelog_bg)43074307+ ffe_ctl->hint_byte = fs_info->treelog_bg;43084308+ spin_unlock(&fs_info->treelog_bg_lock);43094309+ } else if (ffe_ctl->for_data_reloc) {43104310+ spin_lock(&fs_info->relocation_bg_lock);43114311+ if (fs_info->data_reloc_bg)43124312+ ffe_ctl->hint_byte = fs_info->data_reloc_bg;43134313+ spin_unlock(&fs_info->relocation_bg_lock);43144314+ } else if (ffe_ctl->flags & BTRFS_BLOCK_GROUP_DATA) {43154315+ struct btrfs_block_group *block_group;43164316+43174317+ spin_lock(&fs_info->zone_active_bgs_lock);43184318+ list_for_each_entry(block_group, &fs_info->zone_active_bgs, active_bg_list) {43194319+ /*43204320+ * No lock is OK here because avail is monotinically43214321+ * decreasing, and this is just a hint.43224322+ */43234323+ u64 avail = block_group->zone_capacity - block_group->alloc_offset;43244324+43254325+ if (block_group_bits(block_group, ffe_ctl->flags) &&43264326+ avail >= ffe_ctl->num_bytes) {43274327+ ffe_ctl->hint_byte = block_group->start;43284328+ break;43294329+ }43304330+ }43314331+ spin_unlock(&fs_info->zone_active_bgs_lock);43324332+ }43334333+43344334+ return 0;43354335+}43364336+43024337static int prepare_allocation(struct btrfs_fs_info *fs_info,43034338 struct find_free_extent_ctl *ffe_ctl,43044339 struct btrfs_space_info *space_info,···43454308 return prepare_allocation_clustered(fs_info, ffe_ctl,43464309 space_info, ins);43474310 case BTRFS_EXTENT_ALLOC_ZONED:43484348- if (ffe_ctl->for_treelog) {43494349- spin_lock(&fs_info->treelog_bg_lock);43504350- if (fs_info->treelog_bg)43514351- ffe_ctl->hint_byte = fs_info->treelog_bg;43524352- spin_unlock(&fs_info->treelog_bg_lock);43534353- }43544354- if (ffe_ctl->for_data_reloc) {43554355- spin_lock(&fs_info->relocation_bg_lock);43564356- if (fs_info->data_reloc_bg)43574357- ffe_ctl->hint_byte = fs_info->data_reloc_bg;43584358- spin_unlock(&fs_info->relocation_bg_lock);43594359- }43604360- return 0;43114311+ return prepare_allocation_zoned(fs_info, ffe_ctl);43614312 default:43624313 BUG();43634314 }
+13-9
fs/btrfs/inode.c
···44584458 u64 root_flags;44594459 int ret;4460446044614461+ down_write(&fs_info->subvol_sem);44624462+44614463 /*44624464 * Don't allow to delete a subvolume with send in progress. This is44634465 * inside the inode lock so the error handling that has to drop the bit···44714469 btrfs_warn(fs_info,44724470 "attempt to delete subvolume %llu during send",44734471 dest->root_key.objectid);44744474- return -EPERM;44724472+ ret = -EPERM;44734473+ goto out_up_write;44754474 }44764475 if (atomic_read(&dest->nr_swapfiles)) {44774476 spin_unlock(&dest->root_item_lock);44784477 btrfs_warn(fs_info,44794478 "attempt to delete subvolume %llu with active swapfile",44804479 root->root_key.objectid);44814481- return -EPERM;44804480+ ret = -EPERM;44814481+ goto out_up_write;44824482 }44834483 root_flags = btrfs_root_flags(&dest->root_item);44844484 btrfs_set_root_flags(&dest->root_item,44854485 root_flags | BTRFS_ROOT_SUBVOL_DEAD);44864486 spin_unlock(&dest->root_item_lock);4487448744884488- down_write(&fs_info->subvol_sem);44894489-44904488 ret = may_destroy_subvol(dest);44914489 if (ret)44924492- goto out_up_write;44904490+ goto out_undead;4493449144944492 btrfs_init_block_rsv(&block_rsv, BTRFS_BLOCK_RSV_TEMP);44954493 /*···44994497 */45004498 ret = btrfs_subvolume_reserve_metadata(root, &block_rsv, 5, true);45014499 if (ret)45024502- goto out_up_write;45004500+ goto out_undead;4503450145044502 trans = btrfs_start_transaction(root, 0);45054503 if (IS_ERR(trans)) {···45654563 inode->i_flags |= S_DEAD;45664564out_release:45674565 btrfs_subvolume_release_metadata(root, &block_rsv);45684568-out_up_write:45694569- up_write(&fs_info->subvol_sem);45664566+out_undead:45704567 if (ret) {45714568 spin_lock(&dest->root_item_lock);45724569 root_flags = btrfs_root_flags(&dest->root_item);45734570 btrfs_set_root_flags(&dest->root_item,45744571 root_flags & ~BTRFS_ROOT_SUBVOL_DEAD);45754572 spin_unlock(&dest->root_item_lock);45764576- } else {45734573+ }45744574+out_up_write:45754575+ up_write(&fs_info->subvol_sem);45764576+ if (!ret) {45774577 d_invalidate(dentry);45784578 btrfs_prune_dentries(dest);45794579 ASSERT(dest->send_in_progress == 0);
+7
fs/btrfs/ioctl.c
···790790 return -EOPNOTSUPP;791791 }792792793793+ if (btrfs_root_refs(&root->root_item) == 0)794794+ return -ENOENT;795795+793796 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))794797 return -EINVAL;795798···26092606 if (argp) {26102607 if (copy_from_user(&range, argp, sizeof(range))) {26112608 ret = -EFAULT;26092609+ goto out;26102610+ }26112611+ if (range.flags & ~BTRFS_DEFRAG_RANGE_FLAGS_SUPP) {26122612+ ret = -EOPNOTSUPP;26122613 goto out;26132614 }26142615 /* compression requires us to start the IO */
+9-25
fs/btrfs/lzo.c
···425425}426426427427int lzo_decompress(struct list_head *ws, const u8 *data_in,428428- struct page *dest_page, unsigned long start_byte, size_t srclen,428428+ struct page *dest_page, unsigned long dest_pgoff, size_t srclen,429429 size_t destlen)430430{431431 struct workspace *workspace = list_entry(ws, struct workspace, list);432432+ struct btrfs_fs_info *fs_info = btrfs_sb(dest_page->mapping->host->i_sb);433433+ const u32 sectorsize = fs_info->sectorsize;432434 size_t in_len;433435 size_t out_len;434436 size_t max_segment_len = WORKSPACE_BUF_LENGTH;435437 int ret = 0;436436- char *kaddr;437437- unsigned long bytes;438438439439 if (srclen < LZO_LEN || srclen > max_segment_len + LZO_LEN * 2)440440 return -EUCLEAN;···451451 }452452 data_in += LZO_LEN;453453454454- out_len = PAGE_SIZE;454454+ out_len = sectorsize;455455 ret = lzo1x_decompress_safe(data_in, in_len, workspace->buf, &out_len);456456 if (ret != LZO_E_OK) {457457 pr_warn("BTRFS: decompress failed!\n");···459459 goto out;460460 }461461462462- if (out_len < start_byte) {462462+ ASSERT(out_len <= sectorsize);463463+ memcpy_to_page(dest_page, dest_pgoff, workspace->buf, out_len);464464+ /* Early end, considered as an error. */465465+ if (unlikely(out_len < destlen)) {463466 ret = -EIO;464464- goto out;467467+ memzero_page(dest_page, dest_pgoff + out_len, destlen - out_len);465468 }466466-467467- /*468468- * the caller is already checking against PAGE_SIZE, but lets469469- * move this check closer to the memcpy/memset470470- */471471- destlen = min_t(unsigned long, destlen, PAGE_SIZE);472472- bytes = min_t(unsigned long, destlen, out_len - start_byte);473473-474474- kaddr = kmap_local_page(dest_page);475475- memcpy(kaddr, workspace->buf + start_byte, bytes);476476-477477- /*478478- * btrfs_getblock is doing a zero on the tail of the page too,479479- * but this will cover anything missing from the decompressed480480- * data.481481- */482482- if (bytes < destlen)483483- memset(kaddr+bytes, 0, destlen-bytes);484484- kunmap_local(kaddr);485469out:486470 return ret;487471}
+4-2
fs/btrfs/ref-verify.c
···889889out_unlock:890890 spin_unlock(&fs_info->ref_verify_lock);891891out:892892- if (ret)892892+ if (ret) {893893+ btrfs_free_ref_cache(fs_info);893894 btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY);895895+ }894896 return ret;895897}896898···10231021 }10241022 }10251023 if (ret) {10261026- btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY);10271024 btrfs_free_ref_cache(fs_info);10251025+ btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY);10281026 }10291027 btrfs_free_path(path);10301028 return ret;
+29-7
fs/btrfs/scrub.c
···10981098static void scrub_read_endio(struct btrfs_bio *bbio)10991099{11001100 struct scrub_stripe *stripe = bbio->private;11011101+ struct bio_vec *bvec;11021102+ int sector_nr = calc_sector_number(stripe, bio_first_bvec_all(&bbio->bio));11031103+ int num_sectors;11041104+ u32 bio_size = 0;11051105+ int i;11061106+11071107+ ASSERT(sector_nr < stripe->nr_sectors);11081108+ bio_for_each_bvec_all(bvec, &bbio->bio, i)11091109+ bio_size += bvec->bv_len;11101110+ num_sectors = bio_size >> stripe->bg->fs_info->sectorsize_bits;1101111111021112 if (bbio->bio.bi_status) {11031103- bitmap_set(&stripe->io_error_bitmap, 0, stripe->nr_sectors);11041104- bitmap_set(&stripe->error_bitmap, 0, stripe->nr_sectors);11131113+ bitmap_set(&stripe->io_error_bitmap, sector_nr, num_sectors);11141114+ bitmap_set(&stripe->error_bitmap, sector_nr, num_sectors);11051115 } else {11061106- bitmap_clear(&stripe->io_error_bitmap, 0, stripe->nr_sectors);11161116+ bitmap_clear(&stripe->io_error_bitmap, sector_nr, num_sectors);11071117 }11081118 bio_put(&bbio->bio);11091119 if (atomic_dec_and_test(&stripe->pending_io)) {···16461636{16471637 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;16481638 struct btrfs_bio *bbio = NULL;16391639+ unsigned int nr_sectors = min(BTRFS_STRIPE_LEN, stripe->bg->start +16401640+ stripe->bg->length - stripe->logical) >>16411641+ fs_info->sectorsize_bits;16491642 u64 stripe_len = BTRFS_STRIPE_LEN;16501643 int mirror = stripe->mirror_num;16511644 int i;···16581645 for_each_set_bit(i, &stripe->extent_sector_bitmap, stripe->nr_sectors) {16591646 struct page *page = scrub_stripe_get_page(stripe, i);16601647 unsigned int pgoff = scrub_stripe_get_page_offset(stripe, i);16481648+16491649+ /* We're beyond the chunk boundary, no need to read anymore. */16501650+ if (i >= nr_sectors)16511651+ break;1661165216621653 /* The current sector cannot be merged, submit the bio. */16631654 if (bbio &&···17181701{17191702 struct btrfs_fs_info *fs_info = sctx->fs_info;17201703 struct btrfs_bio *bbio;17041704+ unsigned int nr_sectors = min(BTRFS_STRIPE_LEN, stripe->bg->start +17051705+ stripe->bg->length - stripe->logical) >>17061706+ fs_info->sectorsize_bits;17211707 int mirror = stripe->mirror_num;1722170817231709 ASSERT(stripe->bg);···17351715 bbio = btrfs_bio_alloc(SCRUB_STRIPE_PAGES, REQ_OP_READ, fs_info,17361716 scrub_read_endio, stripe);1737171717381738- /* Read the whole stripe. */17391718 bbio->bio.bi_iter.bi_sector = stripe->logical >> SECTOR_SHIFT;17401740- for (int i = 0; i < BTRFS_STRIPE_LEN >> PAGE_SHIFT; i++) {17191719+ /* Read the whole range inside the chunk boundary. */17201720+ for (unsigned int cur = 0; cur < nr_sectors; cur++) {17211721+ struct page *page = scrub_stripe_get_page(stripe, cur);17221722+ unsigned int pgoff = scrub_stripe_get_page_offset(stripe, cur);17411723 int ret;1742172417431743- ret = bio_add_page(&bbio->bio, stripe->pages[i], PAGE_SIZE, 0);17251725+ ret = bio_add_page(&bbio->bio, page, fs_info->sectorsize, pgoff);17441726 /* We should have allocated enough bio vectors. */17451745- ASSERT(ret == PAGE_SIZE);17271727+ ASSERT(ret == fs_info->sectorsize);17461728 }17471729 atomic_inc(&stripe->pending_io);17481730
···475475476476 spin_lock_irqsave(&subpage->lock, flags);477477 bitmap_set(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);478478- folio_start_writeback(folio);478478+ if (!folio_test_writeback(folio))479479+ folio_start_writeback(folio);479480 spin_unlock_irqrestore(&subpage->lock, flags);480481}481482
+8
fs/btrfs/super.c
···1457145714581458 btrfs_info_to_ctx(fs_info, &old_ctx);1459145914601460+ /*14611461+ * This is our "bind mount" trick, we don't want to allow the user to do14621462+ * anything other than mount a different ro/rw and a different subvol,14631463+ * all of the mount options should be maintained.14641464+ */14651465+ if (mount_reconfigure)14661466+ ctx->mount_opt = old_ctx.mount_opt;14671467+14601468 sync_filesystem(sb);14611469 set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);14621470
···30873087 map = btrfs_find_chunk_map(fs_info, logical, length);3088308830893089 if (unlikely(!map)) {30903090- read_unlock(&fs_info->mapping_tree_lock);30913090 btrfs_crit(fs_info,30923091 "unable to find chunk map for logical %llu length %llu",30933092 logical, length);···30943095 }3095309630963097 if (unlikely(map->start > logical || map->start + map->chunk_len <= logical)) {30973097- read_unlock(&fs_info->mapping_tree_lock);30983098 btrfs_crit(fs_info,30993099 "found a bad chunk map, wanted %llu-%llu, found %llu-%llu",31003100 logical, logical + length, map->start,
+19-54
fs/btrfs/zlib.c
···354354}355355356356int zlib_decompress(struct list_head *ws, const u8 *data_in,357357- struct page *dest_page, unsigned long start_byte, size_t srclen,357357+ struct page *dest_page, unsigned long dest_pgoff, size_t srclen,358358 size_t destlen)359359{360360 struct workspace *workspace = list_entry(ws, struct workspace, list);361361 int ret = 0;362362 int wbits = MAX_WBITS;363363- unsigned long bytes_left;364364- unsigned long total_out = 0;365365- unsigned long pg_offset = 0;366366-367367- destlen = min_t(unsigned long, destlen, PAGE_SIZE);368368- bytes_left = destlen;363363+ unsigned long to_copy;369364370365 workspace->strm.next_in = data_in;371366 workspace->strm.avail_in = srclen;···385390 return -EIO;386391 }387392388388- while (bytes_left > 0) {389389- unsigned long buf_start;390390- unsigned long buf_offset;391391- unsigned long bytes;393393+ /*394394+ * Everything (in/out buf) should be at most one sector, there should395395+ * be no need to switch any input/output buffer.396396+ */397397+ ret = zlib_inflate(&workspace->strm, Z_FINISH);398398+ to_copy = min(workspace->strm.total_out, destlen);399399+ if (ret != Z_STREAM_END)400400+ goto out;392401393393- ret = zlib_inflate(&workspace->strm, Z_NO_FLUSH);394394- if (ret != Z_OK && ret != Z_STREAM_END)395395- break;402402+ memcpy_to_page(dest_page, dest_pgoff, workspace->buf, to_copy);396403397397- buf_start = total_out;398398- total_out = workspace->strm.total_out;399399-400400- if (total_out == buf_start) {401401- ret = -EIO;402402- break;403403- }404404-405405- if (total_out <= start_byte)406406- goto next;407407-408408- if (total_out > start_byte && buf_start < start_byte)409409- buf_offset = start_byte - buf_start;410410- else411411- buf_offset = 0;412412-413413- bytes = min(PAGE_SIZE - pg_offset,414414- PAGE_SIZE - (buf_offset % PAGE_SIZE));415415- bytes = min(bytes, bytes_left);416416-417417- memcpy_to_page(dest_page, pg_offset,418418- workspace->buf + buf_offset, bytes);419419-420420- pg_offset += bytes;421421- bytes_left -= bytes;422422-next:423423- workspace->strm.next_out = workspace->buf;424424- workspace->strm.avail_out = workspace->buf_size;425425- }426426-427427- if (ret != Z_STREAM_END && bytes_left != 0)404404+out:405405+ if (unlikely(to_copy != destlen)) {406406+ pr_warn_ratelimited("BTRFS: infalte failed, decompressed=%lu expected=%zu\n",407407+ to_copy, destlen);428408 ret = -EIO;429429- else409409+ } else {430410 ret = 0;411411+ }431412432413 zlib_inflateEnd(&workspace->strm);433414434434- /*435435- * this should only happen if zlib returned fewer bytes than we436436- * expected. btrfs_get_block is responsible for zeroing from the437437- * end of the inline extent (destlen) to the end of the page438438- */439439- if (pg_offset < destlen) {440440- memzero_page(dest_page, pg_offset, destlen - pg_offset);441441- }415415+ if (unlikely(to_copy < destlen))416416+ memzero_page(dest_page, dest_pgoff + to_copy, destlen - to_copy);442417 return ret;443418}444419
+2-6
fs/btrfs/zoned.c
···2055205520562056 map = block_group->physical_map;2057205720582058+ spin_lock(&fs_info->zone_active_bgs_lock);20582059 spin_lock(&block_group->lock);20592060 if (test_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &block_group->runtime_flags)) {20602061 ret = true;···20682067 goto out_unlock;20692068 }2070206920712071- spin_lock(&fs_info->zone_active_bgs_lock);20722070 for (i = 0; i < map->num_stripes; i++) {20732071 struct btrfs_zoned_device_info *zinfo;20742072 int reserved = 0;···20872087 */20882088 if (atomic_read(&zinfo->active_zones_left) <= reserved) {20892089 ret = false;20902090- spin_unlock(&fs_info->zone_active_bgs_lock);20912090 goto out_unlock;20922091 }2093209220942093 if (!btrfs_dev_set_active_zone(device, physical)) {20952094 /* Cannot activate the zone */20962095 ret = false;20972097- spin_unlock(&fs_info->zone_active_bgs_lock);20982096 goto out_unlock;20992097 }21002098 if (!is_data)21012099 zinfo->reserved_active_zones--;21022100 }21032103- spin_unlock(&fs_info->zone_active_bgs_lock);2104210121052102 /* Successfully activated all the zones */21062103 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &block_group->runtime_flags);···2105210821062109 /* For the active block group list */21072110 btrfs_get_block_group(block_group);21082108-21092109- spin_lock(&fs_info->zone_active_bgs_lock);21102111 list_add_tail(&block_group->active_bg_list, &fs_info->zone_active_bgs);21112112 spin_unlock(&fs_info->zone_active_bgs_lock);21122113···2112211721132118out_unlock:21142119 spin_unlock(&block_group->lock);21202120+ spin_unlock(&fs_info->zone_active_bgs_lock);21152121 return ret;21162122}21172123
+3
fs/cachefiles/ondemand.c
···539539 struct fscache_volume *volume = object->volume->vcookie;540540 size_t volume_key_size, cookie_key_size, data_len;541541542542+ if (!object->ondemand)543543+ return 0;544544+542545 /*543546 * CacheFiles will firstly check the cache file under the root cache544547 * directory. If the coherency check failed, it will fallback to
+31-10
fs/exec.c
···128128 struct filename *tmp = getname(library);129129 int error = PTR_ERR(tmp);130130 static const struct open_flags uselib_flags = {131131- .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,131131+ .open_flag = O_LARGEFILE | O_RDONLY,132132 .acc_mode = MAY_READ | MAY_EXEC,133133 .intent = LOOKUP_OPEN,134134 .lookup_flags = LOOKUP_FOLLOW,···904904905905#endif /* CONFIG_MMU */906906907907+/*908908+ * On success, caller must call do_close_execat() on the returned909909+ * struct file to close it.910910+ */907911static struct file *do_open_execat(int fd, struct filename *name, int flags)908912{909913 struct file *file;···952948 return ERR_PTR(err);953949}954950951951+/**952952+ * open_exec - Open a path name for execution953953+ *954954+ * @name: path name to open with the intent of executing it.955955+ *956956+ * Returns ERR_PTR on failure or allocated struct file on success.957957+ *958958+ * As this is a wrapper for the internal do_open_execat(), callers959959+ * must call allow_write_access() before fput() on release. Also see960960+ * do_close_execat().961961+ */955962struct file *open_exec(const char *name)956963{957964 struct filename *filename = getname_kernel(name);···1424140914251410out_unlock:14261411 up_write(&me->signal->exec_update_lock);14121412+ if (!bprm->cred)14131413+ mutex_unlock(&me->signal->cred_guard_mutex);14141414+14271415out:14281416 return retval;14291417}···15021484 return -ENOMEM;15031485}1504148614871487+/* Matches do_open_execat() */14881488+static void do_close_execat(struct file *file)14891489+{14901490+ if (!file)14911491+ return;14921492+ allow_write_access(file);14931493+ fput(file);14941494+}14951495+15051496static void free_bprm(struct linux_binprm *bprm)15061497{15071498 if (bprm->mm) {···15221495 mutex_unlock(¤t->signal->cred_guard_mutex);15231496 abort_creds(bprm->cred);15241497 }15251525- if (bprm->file) {15261526- allow_write_access(bprm->file);15271527- fput(bprm->file);15281528- }14981498+ do_close_execat(bprm->file);15291499 if (bprm->executable)15301500 fput(bprm->executable);15311501 /* If a binfmt changed the interp, free it. */···1544152015451521 bprm = kzalloc(sizeof(*bprm), GFP_KERNEL);15461522 if (!bprm) {15471547- allow_write_access(file);15481548- fput(file);15231523+ do_close_execat(file);15491524 return ERR_PTR(-ENOMEM);15501525 }15511526···16331610 }16341611 rcu_read_unlock();1635161216131613+ /* "users" and "in_exec" locked for copy_fs() */16361614 if (p->fs->users > n_fs)16371615 bprm->unsafe |= LSM_UNSAFE_SHARE;16381616 else···18501826 return 0;18511827}1852182818531853-/*18541854- * sys_execve() executes a new program.18551855- */18561829static int bprm_execve(struct linux_binprm *bprm)18571830{18581831 int retval;
···221221 if (unlikely(fault_in_iov_iter_readable(iter, part) == part))222222 break;223223224224- ret = -ENOMEM;225224 folio = netfs_grab_folio_for_write(mapping, pos, part);226226- if (!folio)225225+ if (IS_ERR(folio)) {226226+ ret = PTR_ERR(folio);227227 break;228228+ }228229229230 flen = folio_size(folio);230231 offset = pos & (flen - 1);···344343 break;345344 default:346345 WARN(true, "Unexpected modify type %u ix=%lx\n",347347- howto, folio_index(folio));346346+ howto, folio->index);348347 ret = -EIO;349348 goto error_folio_unlock;350349 }···649648 xas_for_each(&xas, folio, last) {650649 WARN(!folio_test_writeback(folio),651650 "bad %zx @%llx page %lx %lx\n",652652- wreq->len, wreq->start, folio_index(folio), last);651651+ wreq->len, wreq->start, folio->index, last);653652654653 if ((finfo = netfs_folio_info(folio))) {655654 /* Streaming writes cannot be redirtied whilst under···796795 continue;797796 if (xa_is_value(folio))798797 break;799799- if (folio_index(folio) != index) {798798+ if (folio->index != index) {800799 xas_reset(xas);801800 break;802801 }···902901 long count = wbc->nr_to_write;903902 int ret;904903905905- _enter(",%lx,%llx-%llx,%u", folio_index(folio), start, end, caching);904904+ _enter(",%lx,%llx-%llx,%u", folio->index, start, end, caching);906905907906 wreq = netfs_alloc_request(mapping, NULL, start, folio_size(folio),908907 NETFS_WRITEBACK);···1048104710491048 start = folio_pos(folio); /* May regress with THPs */1050104910511051- _debug("wback %lx", folio_index(folio));10501050+ _debug("wback %lx", folio->index);1052105110531052 /* At this point we hold neither the i_pages lock nor the page lock:10541053 * the page may be truncated or invalidated (changing page->mapping to
+2-1
fs/netfs/fscache_cache.c
···179179void fscache_put_cache(struct fscache_cache *cache,180180 enum fscache_cache_trace where)181181{182182- unsigned int debug_id = cache->debug_id;182182+ unsigned int debug_id;183183 bool zero;184184 int ref;185185186186 if (IS_ERR_OR_NULL(cache))187187 return;188188189189+ debug_id = cache->debug_id;189190 zero = __refcount_dec_and_test(&cache->ref, &ref);190191 trace_fscache_cache(debug_id, ref - 1, where);191192
+1-1
fs/netfs/io.c
···124124 /* We might have multiple writes from the same huge125125 * folio, but we mustn't unlock a folio more than once.126126 */127127- if (have_unlocked && folio_index(folio) <= unlocked)127127+ if (have_unlocked && folio->index <= unlocked)128128 continue;129129 unlocked = folio_next_index(folio) - 1;130130 trace_netfs_folio(folio, netfs_folio_trace_end_copy);
···79117911{79127912 struct file_lock *fl;79137913 int status = false;79147914- struct nfsd_file *nf = find_any_file(fp);79147914+ struct nfsd_file *nf;79157915 struct inode *inode;79167916 struct file_lock_context *flctx;7917791779187918+ spin_lock(&fp->fi_lock);79197919+ nf = find_any_file_locked(fp);79187920 if (!nf) {79197921 /* Any valid lock stateid should have some sort of access */79207922 WARN_ON_ONCE(1);79217921- return status;79237923+ goto out;79227924 }7923792579247926 inode = file_inode(nf->nf_file);···79367934 }79377935 spin_unlock(&flctx->flc_lock);79387936 }79397939- nfsd_file_put(nf);79377937+out:79387938+ spin_unlock(&fp->fi_lock);79407939 return status;79417940}79427941···79477944 * @cstate: NFSv4 COMPOUND state79487945 * @u: RELEASE_LOCKOWNER arguments79497946 *79507950- * The lockowner's so_count is bumped when a lock record is added79517951- * or when copying a conflicting lock. The latter case is brief,79527952- * but can lead to fleeting false positives when looking for79537953- * locks-in-use.79477947+ * Check if theree are any locks still held and if not - free the lockowner79487948+ * and any lock state that is owned.79547949 *79557950 * Return values:79567951 * %nfs_ok: lockowner released or not found···79847983 spin_unlock(&clp->cl_lock);79857984 return nfs_ok;79867985 }79877987- if (atomic_read(&lo->lo_owner.so_count) != 2) {79887988- spin_unlock(&clp->cl_lock);79897989- nfs4_put_stateowner(&lo->lo_owner);79907990- return nfserr_locks_held;79867986+79877987+ list_for_each_entry(stp, &lo->lo_owner.so_stateids, st_perstateowner) {79887988+ if (check_for_locks(stp->st_stid.sc_file, lo)) {79897989+ spin_unlock(&clp->cl_lock);79907990+ nfs4_put_stateowner(&lo->lo_owner);79917991+ return nfserr_locks_held;79927992+ }79917993 }79927994 unhash_lockowner_locked(lo);79937995 while (!list_empty(&lo->lo_owner.so_stateids)) {
···4040 int idx;4141 /* One fsid per unique underlying sb (upper fsid == 0) */4242 int fsid;4343+ /* xwhiteouts were found on this layer */4444+ bool has_xwhiteouts;4345};44464547struct ovl_path {···6159 unsigned int numfs;6260 /* Number of data-only lower layers */6361 unsigned int numdatalayer;6464- const struct ovl_layer *layers;6262+ struct ovl_layer *layers;6563 struct ovl_sb *fs;6664 /* workbasedir is the path at workdir= mount option */6765 struct dentry *workbasedir;
···12491249 struct ovl_entry *oe)12501250{12511251 struct dentry *root;12521252+ struct ovl_fs *ofs = OVL_FS(sb);12521253 struct ovl_path *lowerpath = ovl_lowerstack(oe);12531254 unsigned long ino = d_inode(lowerpath->dentry)->i_ino;12541255 int fsid = lowerpath->layer->fsid;···12691268 ovl_dentry_set_upper_alias(root);12701269 if (ovl_is_impuredir(sb, upperdentry))12711270 ovl_set_flag(OVL_IMPURE, d_inode(root));12711271+ }12721272+12731273+ /* Look for xwhiteouts marker except in the lowermost layer */12741274+ for (int i = 0; i < ovl_numlower(oe) - 1; i++, lowerpath++) {12751275+ struct path path = {12761276+ .mnt = lowerpath->layer->mnt,12771277+ .dentry = lowerpath->dentry,12781278+ };12791279+12801280+ /* overlay.opaque=x means xwhiteouts directory */12811281+ if (ovl_get_opaquedir_val(ofs, &path) == 'x') {12821282+ ovl_layer_set_xwhiteouts(ofs, lowerpath->layer);12831283+ ovl_dentry_set_xwhiteouts(root);12841284+ }12721285 }1273128612741287 /* Root is always merge -> can have whiteouts */
+31-22
fs/overlayfs/util.c
···461461 ovl_dentry_set_flag(OVL_E_OPAQUE, dentry);462462}463463464464+bool ovl_dentry_has_xwhiteouts(struct dentry *dentry)465465+{466466+ return ovl_dentry_test_flag(OVL_E_XWHITEOUTS, dentry);467467+}468468+469469+void ovl_dentry_set_xwhiteouts(struct dentry *dentry)470470+{471471+ ovl_dentry_set_flag(OVL_E_XWHITEOUTS, dentry);472472+}473473+474474+/*475475+ * ovl_layer_set_xwhiteouts() is called before adding the overlay dir476476+ * dentry to dcache, while readdir of that same directory happens after477477+ * the overlay dir dentry is in dcache, so if some cpu observes that478478+ * ovl_dentry_is_xwhiteouts(), it will also observe layer->has_xwhiteouts479479+ * for the layers where xwhiteouts marker was found in that merge dir.480480+ */481481+void ovl_layer_set_xwhiteouts(struct ovl_fs *ofs,482482+ const struct ovl_layer *layer)483483+{484484+ if (layer->has_xwhiteouts)485485+ return;486486+487487+ /* Write once to read-mostly layer properties */488488+ ofs->layers[layer->idx].has_xwhiteouts = true;489489+}490490+464491/*465492 * For hard links and decoded file handles, it's possible for ovl_dentry_upper()466493 * to return positive, while there's no actual upper alias for the inode.···766739 return res >= 0;767740}768741769769-bool ovl_path_check_xwhiteouts_xattr(struct ovl_fs *ofs, const struct path *path)770770-{771771- struct dentry *dentry = path->dentry;772772- int res;773773-774774- /* xattr.whiteouts must be a directory */775775- if (!d_is_dir(dentry))776776- return false;777777-778778- res = ovl_path_getxattr(ofs, path, OVL_XATTR_XWHITEOUTS, NULL, 0);779779- return res >= 0;780780-}781781-782742/*783743 * Load persistent uuid from xattr into s_uuid if found, or store a new784744 * random generated value in s_uuid and in xattr.···825811 return false;826812}827813828828-bool ovl_path_check_dir_xattr(struct ovl_fs *ofs, const struct path *path,829829- enum ovl_xattr ox)814814+char ovl_get_dir_xattr_val(struct ovl_fs *ofs, const struct path *path,815815+ enum ovl_xattr ox)830816{831817 int res;832818 char val;833819834820 if (!d_is_dir(path->dentry))835835- return false;821821+ return 0;836822837823 res = ovl_path_getxattr(ofs, path, ox, &val, 1);838838- if (res == 1 && val == 'y')839839- return true;840840-841841- return false;824824+ return res == 1 ? val : 0;842825}843826844827#define OVL_XATTR_OPAQUE_POSTFIX "opaque"···848837#define OVL_XATTR_METACOPY_POSTFIX "metacopy"849838#define OVL_XATTR_PROTATTR_POSTFIX "protattr"850839#define OVL_XATTR_XWHITEOUT_POSTFIX "whiteout"851851-#define OVL_XATTR_XWHITEOUTS_POSTFIX "whiteouts"852840853841#define OVL_XATTR_TAB_ENTRY(x) \854842 [x] = { [false] = OVL_XATTR_TRUSTED_PREFIX x ## _POSTFIX, \···864854 OVL_XATTR_TAB_ENTRY(OVL_XATTR_METACOPY),865855 OVL_XATTR_TAB_ENTRY(OVL_XATTR_PROTATTR),866856 OVL_XATTR_TAB_ENTRY(OVL_XATTR_XWHITEOUT),867867- OVL_XATTR_TAB_ENTRY(OVL_XATTR_XWHITEOUTS),868857};869858870859int ovl_check_setxattr(struct ovl_fs *ofs, struct dentry *upperdentry,
···34343535/* Choose something "unique" ;-) */3636#define EVENTFS_FILE_INODE_INO 0x12c4e373737-#define EVENTFS_DIR_INODE_INO 0x134b2f53737+3838+/* Just try to make something consistent and unique */3939+static int eventfs_dir_ino(struct eventfs_inode *ei)4040+{4141+ if (!ei->ino)4242+ ei->ino = get_next_ino();4343+4444+ return ei->ino;4545+}38463947/*4048 * The eventfs_inode (ei) itself is protected by SRCU. It is released from···404396 inode->i_fop = &eventfs_file_operations;405397406398 /* All directories will have the same inode number */407407- inode->i_ino = EVENTFS_DIR_INODE_INO;399399+ inode->i_ino = eventfs_dir_ino(ei);408400409401 ti = get_tracefs(inode);410402 ti->flags |= TRACEFS_EVENT_INODE;···810802811803 name = ei_child->name;812804813813- ino = EVENTFS_DIR_INODE_INO;805805+ ino = eventfs_dir_ino(ei_child);814806815807 if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR))816808 goto out_dec;
+4-3
fs/tracefs/internal.h
···5555 struct eventfs_attr *entry_attrs;5656 struct eventfs_attr attr;5757 void *data;5858+ unsigned int is_freed:1;5959+ unsigned int is_events:1;6060+ unsigned int nr_entries:30;6161+ unsigned int ino;5862 /*5963 * Union - used for deletion6064 * @llist: for calling dput() if needed after RCU···6864 struct llist_node llist;6965 struct rcu_head rcu;7066 };7171- unsigned int is_freed:1;7272- unsigned int is_events:1;7373- unsigned int nr_entries:30;7467};75687669static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
···920920 unsigned sched_rt_mutex:1;921921#endif922922923923- /* Bit to tell LSMs we're in execve(): */923923+ /* Bit to tell TOMOYO we're in execve(): */924924 unsigned in_execve:1;925925 unsigned in_iowait:1;926926#ifndef TIF_RESTORE_SIGMASK
···205205 * @nla: netlink attributes206206 * @portid: netlink portID of the original message207207 * @seq: netlink sequence number208208+ * @flags: modifiers to new request208209 * @family: protocol family209210 * @level: depth of the chains210211 * @report: notify via unicast netlink message···283282 *284283 * @key: element key285284 * @key_end: closing element key285285+ * @data: element data286286 * @priv: element private data and extensions287287 */288288struct nft_set_elem {···327325 * @dtype: data type328326 * @dlen: data length329327 * @objtype: object type330330- * @flags: flags331328 * @size: number of set elements332329 * @policy: set policy333330 * @gc_int: garbage collector interval331331+ * @timeout: element timeout334332 * @field_len: length of each field in concatenation, bytes335333 * @field_count: number of concatenated fields in element336334 * @expr: set must support for expressions···353351/**354352 * enum nft_set_class - performance class355353 *356356- * @NFT_LOOKUP_O_1: constant, O(1)357357- * @NFT_LOOKUP_O_LOG_N: logarithmic, O(log N)358358- * @NFT_LOOKUP_O_N: linear, O(N)354354+ * @NFT_SET_CLASS_O_1: constant, O(1)355355+ * @NFT_SET_CLASS_O_LOG_N: logarithmic, O(log N)356356+ * @NFT_SET_CLASS_O_N: linear, O(N)359357 */360358enum nft_set_class {361359 NFT_SET_CLASS_O_1,···424422 * @remove: remove element from set425423 * @walk: iterate over all set elements426424 * @get: get set elements425425+ * @commit: commit set elements426426+ * @abort: abort set elements427427 * @privsize: function to return size of set private data428428+ * @estimate: estimate the required memory size and the lookup complexity class428429 * @init: initialize private data of new set instance429430 * @destroy: destroy private data of set instance431431+ * @gc_init: initialize garbage collection430432 * @elemsize: element private size431433 *432434 * Operations lookup, update and delete have simpler interfaces, are faster···546540 * @policy: set parameterization (see enum nft_set_policies)547541 * @udlen: user data length548542 * @udata: user data549549- * @expr: stateful expression543543+ * @pending_update: list of pending update set element550544 * @ops: set ops551545 * @flags: set flags552546 * @dead: set will be freed, never cleared553547 * @genmask: generation mask554548 * @klen: key length555549 * @dlen: data length550550+ * @num_exprs: numbers of exprs551551+ * @exprs: stateful expression552552+ * @catchall_list: list of catch-all set element556553 * @data: private set data557554 */558555struct nft_set {···701692 *702693 * @len: length of extension area703694 * @offset: offsets of individual extension types695695+ * @ext_len: length of the expected extension(used to sanity check)704696 */705697struct nft_set_ext_tmpl {706698 u16 len;···850840 * @select_ops: function to select nft_expr_ops851841 * @release_ops: release nft_expr_ops852842 * @ops: default ops, used when no select_ops functions is present843843+ * @inner_ops: inner ops, used for inner packet operation853844 * @list: used internally854845 * @name: Identifier855846 * @owner: module reference···892881 * struct nft_expr_ops - nf_tables expression operations893882 *894883 * @eval: Expression evaluation function884884+ * @clone: Expression clone function895885 * @size: full expression size, including private data size896886 * @init: initialization function897887 * @activate: activate expression in the next generation898888 * @deactivate: deactivate expression in next generation899889 * @destroy: destruction function, called after synchronize_rcu890890+ * @destroy_clone: destruction clone function900891 * @dump: function to dump parameters901901- * @type: expression type902892 * @validate: validate expression, called during loop detection893893+ * @reduce: reduce expression894894+ * @gc: garbage collection expression895895+ * @offload: hardware offload expression896896+ * @offload_action: function to report true/false to allocate one slot or not in the flow897897+ * offload array898898+ * @offload_stats: function to synchronize hardware stats via updating the counter expression899899+ * @type: expression type903900 * @data: extra data to attach to this expression operation904901 */905902struct nft_expr_ops {···10601041/**10611042 * struct nft_chain - nf_tables chain10621043 *10441044+ * @blob_gen_0: rule blob pointer to the current generation10451045+ * @blob_gen_1: rule blob pointer to the future generation10631046 * @rules: list of rules in the chain10641047 * @list: used internally10651048 * @rhlhead: used internally10661049 * @table: table that this chain belongs to10671050 * @handle: chain handle10681051 * @use: number of jump references to this chain10691069- * @flags: bitmask of enum nft_chain_flags10521052+ * @flags: bitmask of enum NFTA_CHAIN_FLAGS10531053+ * @bound: bind or not10541054+ * @genmask: generation mask10701055 * @name: name of the chain10561056+ * @udlen: user data length10571057+ * @udata: user data in the chain10581058+ * @blob_next: rule blob pointer to the next in the chain10711059 */10721060struct nft_chain {10731061 struct nft_rule_blob __rcu *blob_gen_0;···11721146 * @hook_list: list of netfilter hooks (for NFPROTO_NETDEV family)11731147 * @type: chain type11741148 * @policy: default policy11491149+ * @flags: indicate the base chain disabled or not11751150 * @stats: per-cpu chain stats11761151 * @chain: the chain11771152 * @flow_block: flow block (for hardware offload)···13011274 * struct nft_object - nf_tables stateful object13021275 *13031276 * @list: table stateful object list node13041304- * @key: keys that identify this object13051277 * @rhlhead: nft_objname_ht node12781278+ * @key: keys that identify this object13061279 * @genmask: generation mask13071280 * @use: number of references to this stateful object13081281 * @handle: unique object handle12821282+ * @udlen: length of user data12831283+ * @udata: user data13091284 * @ops: object operations13101285 * @data: object data, layout depends on type13111286 */···13731344 * @destroy: release existing stateful object13741345 * @dump: netlink dump stateful object13751346 * @update: update stateful object13471347+ * @type: pointer to object type13761348 */13771349struct nft_object_ops {13781350 void (*eval)(struct nft_object *obj,···14091379 * @genmask: generation mask14101380 * @use: number of references to this flow table14111381 * @handle: unique object handle14121412- * @dev_name: array of device names13821382+ * @hook_list: hook list for hooks per net_device in flowtables14131383 * @data: rhashtable and garbage collector14141414- * @ops: array of hooks14151384 */14161385struct nft_flowtable {14171386 struct list_head list;
···876876 bool877877 default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC11_NO_ARRAY_BOUNDS878878879879+# Currently, disable -Wstringop-overflow for GCC 11, globally.880880+config GCC11_NO_STRINGOP_OVERFLOW881881+ def_bool y882882+883883+config CC_NO_STRINGOP_OVERFLOW884884+ bool885885+ default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC_VERSION < 120000 && GCC11_NO_STRINGOP_OVERFLOW886886+887887+config CC_STRINGOP_OVERFLOW888888+ bool889889+ default y if CC_IS_GCC && !CC_NO_STRINGOP_OVERFLOW890890+879891#880892# For architectures that know their GCC __int128 support is sound881893#
+1
kernel/fork.c
···17481748 if (clone_flags & CLONE_FS) {17491749 /* tsk->fs is already what we want */17501750 spin_lock(&fs->lock);17511751+ /* "users" and "in_exec" locked for check_unsafe_exec() */17511752 if (fs->in_exec) {17521753 spin_unlock(&fs->lock);17531754 return -EAGAIN;
+33-1
kernel/rcu/tree.c
···10131013 return needmore;10141014}1015101510161016+static void swake_up_one_online_ipi(void *arg)10171017+{10181018+ struct swait_queue_head *wqh = arg;10191019+10201020+ swake_up_one(wqh);10211021+}10221022+10231023+static void swake_up_one_online(struct swait_queue_head *wqh)10241024+{10251025+ int cpu = get_cpu();10261026+10271027+ /*10281028+ * If called from rcutree_report_cpu_starting(), wake up10291029+ * is dangerous that late in the CPU-down hotplug process. The10301030+ * scheduler might queue an ignored hrtimer. Defer the wake up10311031+ * to an online CPU instead.10321032+ */10331033+ if (unlikely(cpu_is_offline(cpu))) {10341034+ int target;10351035+10361036+ target = cpumask_any_and(housekeeping_cpumask(HK_TYPE_RCU),10371037+ cpu_online_mask);10381038+10391039+ smp_call_function_single(target, swake_up_one_online_ipi,10401040+ wqh, 0);10411041+ put_cpu();10421042+ } else {10431043+ put_cpu();10441044+ swake_up_one(wqh);10451045+ }10461046+}10471047+10161048/*10171049 * Awaken the grace-period kthread. Don't do a self-awaken (unless in an10181050 * interrupt or softirq handler, in which case we just might immediately···10691037 return;10701038 WRITE_ONCE(rcu_state.gp_wake_time, jiffies);10711039 WRITE_ONCE(rcu_state.gp_wake_seq, READ_ONCE(rcu_state.gp_seq));10721072- swake_up_one(&rcu_state.gp_wq);10401040+ swake_up_one_online(&rcu_state.gp_wq);10731041}1074104210751043/*
+1-2
kernel/rcu/tree_exp.h
···173173 return ret;174174}175175176176-177176/*178177 * Report the exit from RCU read-side critical section for the last task179178 * that queued itself during or before the current expedited preemptible-RCU···200201 raw_spin_unlock_irqrestore_rcu_node(rnp, flags);201202 if (wake) {202203 smp_mb(); /* EGP done before wake_up(). */203203- swake_up_one(&rcu_state.expedited_wq);204204+ swake_up_one_online(&rcu_state.expedited_wq);204205 }205206 break;206207 }
+6-1
kernel/trace/tracing_map.c
···574574 }575575576576 memcpy(elt->key, key, map->key_size);577577- entry->val = elt;577577+ /*578578+ * Ensure the initialization is visible and579579+ * publish the elt.580580+ */581581+ smp_wmb();582582+ WRITE_ONCE(entry->val, elt);578583 atomic64_inc(&map->hits);579584580585 return entry->val;
+4
net/8021q/vlan_netlink.c
···118118 }119119 if (data[IFLA_VLAN_INGRESS_QOS]) {120120 nla_for_each_nested(attr, data[IFLA_VLAN_INGRESS_QOS], rem) {121121+ if (nla_type(attr) != IFLA_VLAN_QOS_MAPPING)122122+ continue;121123 m = nla_data(attr);122124 vlan_dev_set_ingress_priority(dev, m->to, m->from);123125 }124126 }125127 if (data[IFLA_VLAN_EGRESS_QOS]) {126128 nla_for_each_nested(attr, data[IFLA_VLAN_EGRESS_QOS], rem) {129129+ if (nla_type(attr) != IFLA_VLAN_QOS_MAPPING)130130+ continue;127131 m = nla_data(attr);128132 err = vlan_dev_set_egress_priority(dev, m->from, m->to);129133 if (err)
+9
net/core/dev.c
···11551115511155211552static void __net_exit default_device_exit_net(struct net *net)1155311553{1155411554+ struct netdev_name_node *name_node, *tmp;1155411555 struct net_device *dev, *aux;1155511556 /*1155611557 * Push all migratable network devices back to the···1157411573 snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex);1157511574 if (netdev_name_in_use(&init_net, fb_name))1157611575 snprintf(fb_name, IFNAMSIZ, "dev%%d");1157611576+1157711577+ netdev_for_each_altname_safe(dev, name_node, tmp)1157811578+ if (netdev_name_in_use(&init_net, name_node->name)) {1157911579+ netdev_name_node_del(name_node);1158011580+ synchronize_rcu();1158111581+ __netdev_name_node_alt_destroy(name_node);1158211582+ }1158311583+1157711584 err = dev_change_net_namespace(dev, &init_net, fb_name);1157811585 if (err) {1157911586 pr_emerg("%s: failed to move %s to init_net: %d\n",
···722722 if (!test_bit(TSQ_THROTTLED, &sk->sk_tsq_flags)) {723723 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPAUTOCORKING);724724 set_bit(TSQ_THROTTLED, &sk->sk_tsq_flags);725725+ smp_mb__after_atomic();725726 }726727 /* It is possible TX completion already happened727728 * before we set TSQ_THROTTLED.
···6262 depends on KUNIT6363 depends on MAC802116464 default KUNIT_ALL_TESTS6565- depends on !KERNEL_6_26665 help6766 Enable this option to test mac80211 internals with kunit.6867
+6-1
net/mac80211/sta_info.c
···404404 int i;405405406406 for (i = 0; i < ARRAY_SIZE(sta->link); i++) {407407- if (!(sta->sta.valid_links & BIT(i)))407407+ struct link_sta_info *link_sta;408408+409409+ link_sta = rcu_access_pointer(sta->link[i]);410410+ if (!link_sta)408411 continue;409412410413 sta_remove_link(sta, i, false);···912909913910 if (ieee80211_vif_is_mesh(&sdata->vif))914911 mesh_accept_plinks_update(sdata);912912+913913+ ieee80211_check_fast_xmit(sta);915914916915 return 0;917916 out_remove:
+1-1
net/mac80211/tx.c
···30483048 sdata->vif.type == NL80211_IFTYPE_STATION)30493049 goto out;3050305030513051- if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED))30513051+ if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) || !sta->uploaded)30523052 goto out;3053305330543054 if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
+10-10
net/netfilter/nf_tables_api.c
···2424#include <net/sock.h>25252626#define NFT_MODULE_AUTOLOAD_LIMIT (MODULE_NAME_LEN - sizeof("nft-expr-255-"))2727+#define NFT_SET_MAX_ANONLEN 1627282829unsigned int nf_tables_net_id __read_mostly;2930···44124411 p = strchr(name, '%');44134412 if (p != NULL) {44144413 if (p[1] != 'd' || strchr(p + 2, '%'))44144414+ return -EINVAL;44154415+44164416+ if (strnlen(name, NFT_SET_MAX_ANONLEN) >= NFT_SET_MAX_ANONLEN)44154417 return -EINVAL;4416441844174419 inuse = (unsigned long *)get_zeroed_page(GFP_KERNEL);···1099210988 data->verdict.code = ntohl(nla_get_be32(tb[NFTA_VERDICT_CODE]));10993109891099410990 switch (data->verdict.code) {1099510995- default:1099610996- switch (data->verdict.code & NF_VERDICT_MASK) {1099710997- case NF_ACCEPT:1099810998- case NF_DROP:1099910999- case NF_QUEUE:1100011000- break;1100111001- default:1100211002- return -EINVAL;1100311003- }1100411004- fallthrough;1099110991+ case NF_ACCEPT:1099210992+ case NF_DROP:1099310993+ case NF_QUEUE:1099410994+ break;1100510995 case NFT_CONTINUE:1100610996 case NFT_BREAK:1100710997 case NFT_RETURN:···11030110321103111033 data->verdict.chain = chain;1103211034 break;1103511035+ default:1103611036+ return -EINVAL;1103311037 }11034110381103511039 desc->len = sizeof(data->verdict);
···206206 depends on KUNIT207207 depends on CFG80211208208 default KUNIT_ALL_TESTS209209- depends on !KERNEL_6_2210209 help211210 Enable this option to test cfg80211 functions with kunit.212211
···469469 * Cache permissions granted by the previous exec check, with470470 * implicit read and executable mmap which are required to471471 * actually execute the image.472472+ *473473+ * Illogically, FMODE_EXEC is in f_flags, not f_mode.472474 */473473- if (current->in_execve) {475475+ if (file->f_flags & __FMODE_EXEC) {474476 fctx->allow = MAY_EXEC | MAY_READ | AA_EXEC_MMAP;475477 return 0;476478 }
-4
security/keys/encrypted-keys/encrypted.c
···237237 break;238238 }239239 *decrypted_data = strsep(&datablob, " \t");240240- if (!*decrypted_data) {241241- pr_info("encrypted_key: decrypted_data is missing\n");242242- break;243243- }244240 ret = 0;245241 break;246242 case Opt_load:
+2-1
security/tomoyo/tomoyo.c
···328328static int tomoyo_file_open(struct file *f)329329{330330 /* Don't check read permission here if called from execve(). */331331- if (current->in_execve)331331+ /* Illogically, FMODE_EXEC is in f_flags, not f_mode. */332332+ if (f->f_flags & __FMODE_EXEC)332333 return 0;333334 return tomoyo_check_open_permission(tomoyo_domain(), &f->f_path,334335 f->f_flags);
+7-1
tools/arch/x86/include/asm/cpufeatures.h
···198198#define X86_FEATURE_CAT_L3 ( 7*32+ 4) /* Cache Allocation Technology L3 */199199#define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */200200#define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */201201+#define X86_FEATURE_TDX_HOST_PLATFORM ( 7*32+ 7) /* Platform supports being a TDX host */201202#define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */202203#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */203204#define X86_FEATURE_XCOMPACTED ( 7*32+10) /* "" Use compacted XSTATE (XSAVES or XSAVEC) */···309308#define X86_FEATURE_SMBA (11*32+21) /* "" Slow Memory Bandwidth Allocation */310309#define X86_FEATURE_BMEC (11*32+22) /* "" Bandwidth Monitoring Event Configuration */311310#define X86_FEATURE_USER_SHSTK (11*32+23) /* Shadow stack support for user mode applications */312312-313311#define X86_FEATURE_SRSO (11*32+24) /* "" AMD BTB untrain RETs */314312#define X86_FEATURE_SRSO_ALIAS (11*32+25) /* "" AMD BTB untrain RETs through aliasing */315313#define X86_FEATURE_IBPB_ON_VMEXIT (11*32+26) /* "" Issue an IBPB only on VMEXIT */314314+#define X86_FEATURE_APIC_MSRS_FENCE (11*32+27) /* "" IA32_TSC_DEADLINE and X2APIC MSRs need fencing */315315+#define X86_FEATURE_ZEN2 (11*32+28) /* "" CPU based on Zen2 microarchitecture */316316+#define X86_FEATURE_ZEN3 (11*32+29) /* "" CPU based on Zen3 microarchitecture */317317+#define X86_FEATURE_ZEN4 (11*32+30) /* "" CPU based on Zen4 microarchitecture */318318+#define X86_FEATURE_ZEN1 (11*32+31) /* "" CPU based on Zen1 microarchitecture */316319317320/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */318321#define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */···500495#define X86_BUG_EIBRS_PBRSB X86_BUG(28) /* EIBRS is vulnerable to Post Barrier RSB Predictions */501496#define X86_BUG_SMT_RSB X86_BUG(29) /* CPU is vulnerable to Cross-Thread Return Address Predictions */502497#define X86_BUG_GDS X86_BUG(30) /* CPU is affected by Gather Data Sampling */498498+#define X86_BUG_TDX_PW_MCE X86_BUG(31) /* CPU may incur #MC if non-TD software does partial write to TDX private memory */503499504500/* BUG word 2 */505501#define X86_BUG_SRSO X86_BUG(1*32 + 0) /* AMD SRSO bug */
+8
tools/arch/x86/include/asm/msr-index.h
···237237#define LBR_INFO_CYCLES 0xffff238238#define LBR_INFO_BR_TYPE_OFFSET 56239239#define LBR_INFO_BR_TYPE (0xfull << LBR_INFO_BR_TYPE_OFFSET)240240+#define LBR_INFO_BR_CNTR_OFFSET 32241241+#define LBR_INFO_BR_CNTR_NUM 4242242+#define LBR_INFO_BR_CNTR_BITS 2243243+#define LBR_INFO_BR_CNTR_MASK GENMASK_ULL(LBR_INFO_BR_CNTR_BITS - 1, 0)244244+#define LBR_INFO_BR_CNTR_FULL_MASK GENMASK_ULL(LBR_INFO_BR_CNTR_NUM * LBR_INFO_BR_CNTR_BITS - 1, 0)240245241246#define MSR_ARCH_LBR_CTL 0x000014ce242247#define ARCH_LBR_CTL_LBREN BIT(0)···540535/* Auto-reload via MSR instead of DS area */541536#define MSR_RELOAD_PMC0 0x000014c1542537#define MSR_RELOAD_FIXED_CTR0 0x00001309538538+539539+/* KeyID partitioning between MKTME and TDX */540540+#define MSR_IA32_MKTME_KEYID_PARTITIONING 0x00000087543541544542/*545543 * AMD64 MSRs. Not complete. See the architecture manual for a more
···829829#define __NR_futex_requeue 456830830__SYSCALL(__NR_futex_requeue, sys_futex_requeue)831831832832+#define __NR_statmount 457833833+__SYSCALL(__NR_statmount, sys_statmount)834834+835835+#define __NR_listmount 458836836+__SYSCALL(__NR_listmount, sys_listmount)837837+838838+#define __NR_lsm_get_self_attr 459839839+__SYSCALL(__NR_lsm_get_self_attr, sys_lsm_get_self_attr)840840+#define __NR_lsm_set_self_attr 460841841+__SYSCALL(__NR_lsm_set_self_attr, sys_lsm_set_self_attr)842842+#define __NR_lsm_list_modules 461843843+__SYSCALL(__NR_lsm_list_modules, sys_lsm_list_modules)844844+832845#undef __NR_syscalls833833-#define __NR_syscalls 457846846+#define __NR_syscalls 462834847835848/*836849 * 32 bit systems traditionally used different
+71-1
tools/include/uapi/drm/drm.h
···713713/**714714 * DRM_CAP_ASYNC_PAGE_FLIP715715 *716716- * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC.716716+ * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for legacy717717+ * page-flips.717718 */718719#define DRM_CAP_ASYNC_PAGE_FLIP 0x7719720/**···774773 * :ref:`drm_sync_objects`.775774 */776775#define DRM_CAP_SYNCOBJ_TIMELINE 0x14776776+/**777777+ * DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP778778+ *779779+ * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for atomic780780+ * commits.781781+ */782782+#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15777783778784/* DRM_IOCTL_GET_CAP ioctl argument type */779785struct drm_get_cap {···850842 */851843#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5852844845845+/**846846+ * DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT847847+ *848848+ * Drivers for para-virtualized hardware (e.g. vmwgfx, qxl, virtio and849849+ * virtualbox) have additional restrictions for cursor planes (thus850850+ * making cursor planes on those drivers not truly universal,) e.g.851851+ * they need cursor planes to act like one would expect from a mouse852852+ * cursor and have correctly set hotspot properties.853853+ * If this client cap is not set the DRM core will hide cursor plane on854854+ * those virtualized drivers because not setting it implies that the855855+ * client is not capable of dealing with those extra restictions.856856+ * Clients which do set cursor hotspot and treat the cursor plane857857+ * like a mouse cursor should set this property.858858+ * The client must enable &DRM_CLIENT_CAP_ATOMIC first.859859+ *860860+ * Setting this property on drivers which do not special case861861+ * cursor planes (i.e. non-virtualized drivers) will return862862+ * EOPNOTSUPP, which can be used by userspace to gauge863863+ * requirements of the hardware/drivers they're running on.864864+ *865865+ * This capability is always supported for atomic-capable virtualized866866+ * drivers starting from kernel version 6.6.867867+ */868868+#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6869869+853870/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */854871struct drm_set_client_cap {855872 __u64 capability;···926893#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)927894#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)928895#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */896896+#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE (1 << 3) /* set fence deadline to deadline_nsec */929897struct drm_syncobj_wait {930898 __u64 handles;931899 /* absolute timeout */···935901 __u32 flags;936902 __u32 first_signaled; /* only valid when not waiting all */937903 __u32 pad;904904+ /**905905+ * @deadline_nsec - fence deadline hint906906+ *907907+ * Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing908908+ * fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is909909+ * set.910910+ */911911+ __u64 deadline_nsec;938912};939913940914struct drm_syncobj_timeline_wait {···955913 __u32 flags;956914 __u32 first_signaled; /* only valid when not waiting all */957915 __u32 pad;916916+ /**917917+ * @deadline_nsec - fence deadline hint918918+ *919919+ * Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing920920+ * fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is921921+ * set.922922+ */923923+ __u64 deadline_nsec;958924};959925960926/**···12671217#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)1268121812691219#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)12201220+12211221+/**12221222+ * DRM_IOCTL_MODE_CLOSEFB - Close a framebuffer.12231223+ *12241224+ * This closes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL12251225+ * argument is a framebuffer object ID.12261226+ *12271227+ * This IOCTL is similar to &DRM_IOCTL_MODE_RMFB, except it doesn't disable12281228+ * planes and CRTCs. As long as the framebuffer is used by a plane, it's kept12291229+ * alive. When the plane no longer uses the framebuffer (because the12301230+ * framebuffer is replaced with another one, or the plane is disabled), the12311231+ * framebuffer is cleaned up.12321232+ *12331233+ * This is useful to implement flicker-free transitions between two processes.12341234+ *12351235+ * Depending on the threat model, user-space may want to ensure that the12361236+ * framebuffer doesn't expose any sensitive user information: closed12371237+ * framebuffers attached to a plane can be read back by the next DRM master.12381238+ */12391239+#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb)1270124012711241/*12721242 * Device specific ioctls should only be in their respective headers
+6-6
tools/include/uapi/drm/i915_drm.h
···693693#define I915_PARAM_HAS_EXEC_FENCE 44694694695695/* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture696696- * user specified bufffers for post-mortem debugging of GPU hangs. See696696+ * user-specified buffers for post-mortem debugging of GPU hangs. See697697 * EXEC_OBJECT_CAPTURE.698698 */699699#define I915_PARAM_HAS_EXEC_CAPTURE 45···16061606 * is accurate.16071607 *16081608 * The returned dword is split into two fields to indicate both16091609- * the engine classess on which the object is being read, and the16091609+ * the engine classes on which the object is being read, and the16101610 * engine class on which it is currently being written (if any).16111611 *16121612 * The low word (bits 0:15) indicate if the object is being written···18151815 __u32 handle;1816181618171817 /* Advice: either the buffer will be needed again in the near future,18181818- * or wont be and could be discarded under memory pressure.18181818+ * or won't be and could be discarded under memory pressure.18191819 */18201820 __u32 madv;18211821···32463246 * // enough to hold our array of engines. The kernel will fill out the32473247 * // item.length for us, which is the number of bytes we need.32483248 * //32493249- * // Alternatively a large buffer can be allocated straight away enabling32493249+ * // Alternatively a large buffer can be allocated straightaway enabling32503250 * // querying in one pass, in which case item.length should contain the32513251 * // length of the provided buffer.32523252 * err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);···32563256 * // Now that we allocated the required number of bytes, we call the ioctl32573257 * // again, this time with the data_ptr pointing to our newly allocated32583258 * // blob, which the kernel can then populate with info on all engines.32593259- * item.data_ptr = (uintptr_t)&info,32593259+ * item.data_ptr = (uintptr_t)&info;32603260 *32613261 * err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);32623262 * if (err) ...···32863286/**32873287 * struct drm_i915_engine_info32883288 *32893289- * Describes one engine and it's capabilities as known to the driver.32893289+ * Describes one engine and its capabilities as known to the driver.32903290 */32913291struct drm_i915_engine_info {32923292 /** @engine: Engine class and instance. */
+3
tools/include/uapi/linux/fcntl.h
···116116#define AT_HANDLE_FID AT_REMOVEDIR /* file handle is needed to117117 compare object identity and may not118118 be usable to open_by_handle_at(2) */119119+#if defined(__KERNEL__)120120+#define AT_GETATTR_NOSEC 0x80000000121121+#endif119122120123#endif /* _UAPI_LINUX_FCNTL_H */
···138138/* List of all mount_attr versions. */139139#define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */140140141141+142142+/*143143+ * Structure for getting mount/superblock/filesystem info with statmount(2).144144+ *145145+ * The interface is similar to statx(2): individual fields or groups can be146146+ * selected with the @mask argument of statmount(). Kernel will set the @mask147147+ * field according to the supported fields.148148+ *149149+ * If string fields are selected, then the caller needs to pass a buffer that150150+ * has space after the fixed part of the structure. Nul terminated strings are151151+ * copied there and offsets relative to @str are stored in the relevant fields.152152+ * If the buffer is too small, then EOVERFLOW is returned. The actually used153153+ * size is returned in @size.154154+ */155155+struct statmount {156156+ __u32 size; /* Total size, including strings */157157+ __u32 __spare1;158158+ __u64 mask; /* What results were written */159159+ __u32 sb_dev_major; /* Device ID */160160+ __u32 sb_dev_minor;161161+ __u64 sb_magic; /* ..._SUPER_MAGIC */162162+ __u32 sb_flags; /* SB_{RDONLY,SYNCHRONOUS,DIRSYNC,LAZYTIME} */163163+ __u32 fs_type; /* [str] Filesystem type */164164+ __u64 mnt_id; /* Unique ID of mount */165165+ __u64 mnt_parent_id; /* Unique ID of parent (for root == mnt_id) */166166+ __u32 mnt_id_old; /* Reused IDs used in proc/.../mountinfo */167167+ __u32 mnt_parent_id_old;168168+ __u64 mnt_attr; /* MOUNT_ATTR_... */169169+ __u64 mnt_propagation; /* MS_{SHARED,SLAVE,PRIVATE,UNBINDABLE} */170170+ __u64 mnt_peer_group; /* ID of shared peer group */171171+ __u64 mnt_master; /* Mount receives propagation from this ID */172172+ __u64 propagate_from; /* Propagation from in current namespace */173173+ __u32 mnt_root; /* [str] Root of mount relative to root of fs */174174+ __u32 mnt_point; /* [str] Mountpoint relative to current root */175175+ __u64 __spare2[50];176176+ char str[]; /* Variable size part containing strings */177177+};178178+179179+/*180180+ * Structure for passing mount ID and miscellaneous parameters to statmount(2)181181+ * and listmount(2).182182+ *183183+ * For statmount(2) @param represents the request mask.184184+ * For listmount(2) @param represents the last listed mount id (or zero).185185+ */186186+struct mnt_id_req {187187+ __u32 size;188188+ __u32 spare;189189+ __u64 mnt_id;190190+ __u64 param;191191+};192192+193193+/* List of all mnt_id_req versions. */194194+#define MNT_ID_REQ_SIZE_VER0 24 /* sizeof first published struct */195195+196196+/*197197+ * @mask bits for statmount(2)198198+ */199199+#define STATMOUNT_SB_BASIC 0x00000001U /* Want/got sb_... */200200+#define STATMOUNT_MNT_BASIC 0x00000002U /* Want/got mnt_... */201201+#define STATMOUNT_PROPAGATE_FROM 0x00000004U /* Want/got propagate_from */202202+#define STATMOUNT_MNT_ROOT 0x00000008U /* Want/got mnt_root */203203+#define STATMOUNT_MNT_POINT 0x00000010U /* Want/got mnt_point */204204+#define STATMOUNT_FS_TYPE 0x00000020U /* Want/got fs_type */205205+206206+/*207207+ * Special @mnt_id values that can be passed to listmount208208+ */209209+#define LSMT_ROOT 0xffffffffffffffff /* root mount */210210+141211#endif /* _UAPI_LINUX_MOUNT_H */
···4747--json::4848Output in JSON format.49495050+-o::5151+--output=::5252+ Output file name. By default output is written to stdout.5353+5054[[EVENT_MODIFIERS]]5155EVENT MODIFIERS5256---------------
+10
tools/perf/Makefile.perf
···236236 SHELLCHECK := $(shell which shellcheck 2> /dev/null)237237endif238238239239+# shellcheck is using in tools/perf/tests/Build with option -a/--check-sourced (240240+# introduced in v0.4.7) and -S/--severity (introduced in v0.6.0). So make the241241+# minimal shellcheck version as v0.6.0.242242+ifneq ($(SHELLCHECK),)243243+ ifeq ($(shell expr $(shell $(SHELLCHECK) --version | grep version: | \244244+ sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 060), 1)245245+ SHELLCHECK :=246246+ endif247247+endif248248+239249export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK240250export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK241251
···195195 },196196 {197197 "BriefDescription": "Counts the number of cycles the core is stalled due to a demand load miss which hit in DRAM or MMIO (Non-DRAM).",198198- "MetricConstraint": "NO_GROUP_EVENTS",199198 "MetricExpr": "MEM_BOUND_STALLS.LOAD_DRAM_HIT / tma_info_core_clks - max((MEM_BOUND_STALLS.LOAD - LD_HEAD.L1_MISS_AT_RET) / tma_info_core_clks, 0) * MEM_BOUND_STALLS.LOAD_DRAM_HIT / MEM_BOUND_STALLS.LOAD",200199 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",201200 "MetricName": "tma_dram_bound",···456457 },457458 {458459 "BriefDescription": "Counts the number of cycles a core is stalled due to a demand load which hit in the L2 Cache.",459459- "MetricConstraint": "NO_GROUP_EVENTS",460460 "MetricExpr": "MEM_BOUND_STALLS.LOAD_L2_HIT / tma_info_core_clks - max((MEM_BOUND_STALLS.LOAD - LD_HEAD.L1_MISS_AT_RET) / tma_info_core_clks, 0) * MEM_BOUND_STALLS.LOAD_L2_HIT / MEM_BOUND_STALLS.LOAD",461461 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",462462 "MetricName": "tma_l2_bound",···464466 },465467 {466468 "BriefDescription": "Counts the number of cycles a core is stalled due to a demand load which hit in the Last Level Cache (LLC) or other core with HITE/F/M.",467467- "MetricConstraint": "NO_GROUP_EVENTS_NMI",468469 "MetricExpr": "MEM_BOUND_STALLS.LOAD_LLC_HIT / tma_info_core_clks - max((MEM_BOUND_STALLS.LOAD - LD_HEAD.L1_MISS_AT_RET) / tma_info_core_clks, 0) * MEM_BOUND_STALLS.LOAD_LLC_HIT / MEM_BOUND_STALLS.LOAD",469470 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",470471 "MetricName": "tma_l3_bound",···680683 },681684 {682685 "BriefDescription": "Counts the number of cycles that the oldest load of the load buffer is stalled at retirement due to a store forward block.",683683- "MetricConstraint": "NO_GROUP_EVENTS_NMI",684686 "MetricExpr": "LD_HEAD.ST_ADDR_AT_RET / tma_info_core_clks",685687 "MetricGroup": "TopdownL4;tma_L4_group;tma_l1_bound_group",686688 "MetricName": "tma_store_fwd_blk",
···491491 }492492493493 if (symbol_conf.res_sample) {494494- he->res_samples = calloc(sizeof(struct res_sample),495495- symbol_conf.res_sample);494494+ he->res_samples = calloc(symbol_conf.res_sample,495495+ sizeof(struct res_sample));496496 if (!he->res_samples)497497 goto err_srcline;498498 }
+4
tools/perf/util/include/linux/linkage.h
···115115 SYM_ALIAS(alias, name, SYM_T_FUNC, SYM_L_WEAK)116116#endif117117118118+#ifndef SYM_FUNC_ALIAS_MEMFUNC119119+#define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS120120+#endif121121+118122// In the kernel sources (include/linux/cfi_types.h), this has a different119123// definition when CONFIG_CFI_CLANG is used, for tools/ just use the !clang120124// definition:
···66666767 put_tracing_file(events_path);6868 if (events_fd < 0) {6969- printf("Error: failed to open tracing events directory\n");6969+ pr_err("Error: failed to open tracing events directory\n");7070 return;7171 }7272
···11-#!/bin/sh11+#!/bin/bash22# SPDX-License-Identifier: GPL-2.03344readonly ksft_skip=4···33333434 rps_mask=$($cmd /sys/class/net/$dev_name/queues/rx-0/rps_cpus)3535 printf "%-60s" "$msg"3636+3737+ # In case there is more than 32 CPUs we need to remove commas from masks3838+ rps_mask=${rps_mask//,}3939+ expected_rps_mask=${expected_rps_mask//,}3640 if [ $rps_mask -eq $expected_rps_mask ]; then3741 echo "[ ok ]"3842 else
+50-18
tools/testing/selftests/net/so_incoming_cpu.c
···33#define _GNU_SOURCE44#include <sched.h>5566+#include <fcntl.h>77+68#include <netinet/in.h>79#include <sys/socket.h>810#include <sys/sysinfo.h>9111012#include "../kselftest_harness.h"11131212-#define CLIENT_PER_SERVER 32 /* More sockets, more reliable */1313-#define NR_SERVER self->nproc1414-#define NR_CLIENT (CLIENT_PER_SERVER * NR_SERVER)1515-1614FIXTURE(so_incoming_cpu)1715{1818- int nproc;1916 int *servers;2017 union {2118 struct sockaddr addr;···5356 .when_to_set = AFTER_ALL_LISTEN,5457};55585959+static void write_sysctl(struct __test_metadata *_metadata,6060+ char *filename, char *string)6161+{6262+ int fd, len, ret;6363+6464+ fd = open(filename, O_WRONLY);6565+ ASSERT_NE(fd, -1);6666+6767+ len = strlen(string);6868+ ret = write(fd, string, len);6969+ ASSERT_EQ(ret, len);7070+}7171+7272+static void setup_netns(struct __test_metadata *_metadata)7373+{7474+ ASSERT_EQ(unshare(CLONE_NEWNET), 0);7575+ ASSERT_EQ(system("ip link set lo up"), 0);7676+7777+ write_sysctl(_metadata, "/proc/sys/net/ipv4/ip_local_port_range", "10000 60001");7878+ write_sysctl(_metadata, "/proc/sys/net/ipv4/tcp_tw_reuse", "0");7979+}8080+8181+#define NR_PORT (60001 - 10000 - 1)8282+#define NR_CLIENT_PER_SERVER_DEFAULT 328383+static int nr_client_per_server, nr_server, nr_client;8484+5685FIXTURE_SETUP(so_incoming_cpu)5786{5858- self->nproc = get_nprocs();5959- ASSERT_LE(2, self->nproc);8787+ setup_netns(_metadata);60886161- self->servers = malloc(sizeof(int) * NR_SERVER);8989+ nr_server = get_nprocs();9090+ ASSERT_LE(2, nr_server);9191+9292+ if (NR_CLIENT_PER_SERVER_DEFAULT * nr_server < NR_PORT)9393+ nr_client_per_server = NR_CLIENT_PER_SERVER_DEFAULT;9494+ else9595+ nr_client_per_server = NR_PORT / nr_server;9696+9797+ nr_client = nr_client_per_server * nr_server;9898+9999+ self->servers = malloc(sizeof(int) * nr_server);62100 ASSERT_NE(self->servers, NULL);6310164102 self->in_addr.sin_family = AF_INET;···10674{10775 int i;10876109109- for (i = 0; i < NR_SERVER; i++)7777+ for (i = 0; i < nr_server; i++)11078 close(self->servers[i]);1117911280 free(self->servers);···142110 if (variant->when_to_set == BEFORE_LISTEN)143111 set_so_incoming_cpu(_metadata, fd, cpu);144112145145- /* We don't use CLIENT_PER_SERVER here not to block113113+ /* We don't use nr_client_per_server here not to block146114 * this test at connect() if SO_INCOMING_CPU is broken.147115 */148148- ret = listen(fd, NR_CLIENT);116116+ ret = listen(fd, nr_client);149117 ASSERT_EQ(ret, 0);150118151119 if (variant->when_to_set == AFTER_LISTEN)···160128{161129 int i, ret;162130163163- for (i = 0; i < NR_SERVER; i++) {131131+ for (i = 0; i < nr_server; i++) {164132 self->servers[i] = create_server(_metadata, self, variant, i);165133166134 if (i == 0) {···170138 }171139172140 if (variant->when_to_set == AFTER_ALL_LISTEN) {173173- for (i = 0; i < NR_SERVER; i++)141141+ for (i = 0; i < nr_server; i++)174142 set_so_incoming_cpu(_metadata, self->servers[i], i);175143 }176144}···181149 cpu_set_t cpu_set;182150 int i, j, fd, ret;183151184184- for (i = 0; i < NR_SERVER; i++) {152152+ for (i = 0; i < nr_server; i++) {185153 CPU_ZERO(&cpu_set);186154187155 CPU_SET(i, &cpu_set);···194162 ret = sched_setaffinity(0, sizeof(cpu_set), &cpu_set);195163 ASSERT_EQ(ret, 0);196164197197- for (j = 0; j < CLIENT_PER_SERVER; j++) {165165+ for (j = 0; j < nr_client_per_server; j++) {198166 fd = socket(AF_INET, SOCK_STREAM, 0);199167 ASSERT_NE(fd, -1);200168···212180 int i, j, fd, cpu, ret, total = 0;213181 socklen_t len = sizeof(int);214182215215- for (i = 0; i < NR_SERVER; i++) {216216- for (j = 0; j < CLIENT_PER_SERVER; j++) {183183+ for (i = 0; i < nr_server; i++) {184184+ for (j = 0; j < nr_client_per_server; j++) {217185 /* If we see -EAGAIN here, SO_INCOMING_CPU is broken */218186 fd = accept(self->servers[i], &self->addr, &self->addrlen);219187 ASSERT_NE(fd, -1);···227195 }228196 }229197230230- ASSERT_EQ(total, NR_CLIENT);198198+ ASSERT_EQ(total, nr_client);231199 TH_LOG("SO_INCOMING_CPU is very likely to be "232200 "working correctly with %d sockets.", total);233201}