linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Yoshiki Komachi <komachi.yoshiki@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>
Subject: [PATCH 4.19 074/116] bpf/btf: Fix BTF verification of enum members in struct/union
Date: Wed,  1 Apr 2020 18:17:30 +0200	[thread overview]
Message-ID: <20200401161552.305828471@linuxfoundation.org> (raw)
In-Reply-To: <20200401161542.669484650@linuxfoundation.org>

From: Yoshiki Komachi <komachi.yoshiki@gmail.com>

commit da6c7faeb103c493e505e87643272f70be586635 upstream.

btf_enum_check_member() was currently sure to recognize the size of
"enum" type members in struct/union as the size of "int" even if
its size was packed.

This patch fixes BTF enum verification to use the correct size
of member in BPF programs.

Fixes: 179cde8cef7e ("bpf: btf: Check members of struct/union")
Signed-off-by: Yoshiki Komachi <komachi.yoshiki@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/1583825550-18606-2-git-send-email-komachi.yoshiki@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/bpf/btf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -1763,7 +1763,7 @@ static int btf_enum_check_member(struct
 
 	struct_size = struct_type->size;
 	bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off);
-	if (struct_size - bytes_offset < sizeof(int)) {
+	if (struct_size - bytes_offset < member_type->size) {
 		btf_verifier_log_member(env, struct_type, member,
 					"Member exceeds struct_size");
 		return -EINVAL;



  parent reply	other threads:[~2020-04-01 16:26 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01 16:16 [PATCH 4.19 000/116] 4.19.114-rc1 review Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 001/116] mmc: core: Allow host controllers to require R1B for CMD6 Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 002/116] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 003/116] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for eMMC sleep command Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 004/116] mmc: sdhci-omap: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 005/116] mmc: sdhci-tegra: " Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 006/116] Revert "drm/dp_mst: Skip validating ports during destruction, just ref" Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 007/116] geneve: move debug check after netdev unregister Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 008/116] hsr: fix general protection fault in hsr_addr_is_self() Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 009/116] macsec: restrict to ethernet devices Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 010/116] mlxsw: spectrum_mr: Fix list iteration in error path Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 011/116] net: cbs: Fix software cbs to consider packet sending time Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 012/116] net: dsa: Fix duplicate frames flooded by learning Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 013/116] net: mvneta: Fix the case where the last poll did not process all rx Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 014/116] net/packet: tpacket_rcv: avoid a producer race condition Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 015/116] net: qmi_wwan: add support for ASKEY WWHC050 Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 016/116] net_sched: cls_route: remove the right filter from hashtable Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 017/116] net_sched: keep alloc_hash updated after hash allocation Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 018/116] net: stmmac: dwmac-rk: fix error path in rk_gmac_probe Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 019/116] NFC: fdp: Fix a signedness bug in fdp_nci_send_patch() Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 020/116] slcan: not call free_netdev before rtnl_unlock in slcan_open Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 021/116] bnxt_en: fix memory leaks in bnxt_dcbnl_ieee_getets() Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 022/116] bnxt_en: Reset rings if ring reservation fails during open() Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 023/116] net: ip_gre: Separate ERSPAN newlink / changelink callbacks Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 024/116] net: ip_gre: Accept IFLA_INFO_DATA-less configuration Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 025/116] net: dsa: mt7530: Change the LINK bit to reflect the link status Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 026/116] net: phy: mdio-mux-bcm-iproc: check clk_prepare_enable() return value Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 027/116] r8169: re-enable MSI on RTL8168c Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 028/116] tcp: repair: fix TCP_QUEUE_SEQ implementation Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 029/116] vxlan: check return value of gro_cells_init() Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 030/116] hsr: use rcu_read_lock() in hsr_get_node_{list/status}() Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 031/116] hsr: add restart routine into hsr_get_node_list() Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 032/116] hsr: set .netnsok flag Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 033/116] cgroup-v1: cgroup_pidlist_next should update position index Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 034/116] nfs: add minor version to nfs_server_key for fscache Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 035/116] cpupower: avoid multiple definition with gcc -fno-common Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 036/116] drivers/of/of_mdio.c:fix of_mdiobus_register() Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 037/116] cgroup1: dont call release_agent when it is "" Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 038/116] dt-bindings: net: FMan erratum A050385 Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 039/116] arm64: dts: ls1043a: " Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 040/116] fsl/fman: detect " Greg Kroah-Hartman
2020-04-02 10:42   ` Pavel Machek
2020-04-01 16:16 ` [PATCH 4.19 041/116] s390/qeth: handle error when backing RX buffer Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 042/116] scsi: ipr: Fix softlockup when rescanning devices in petitboot Greg Kroah-Hartman
2020-04-01 16:16 ` [PATCH 4.19 043/116] mac80211: Do not send mesh HWMP PREQ if HWMP is disabled Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 044/116] dpaa_eth: Remove unnecessary boolean expression in dpaa_get_headroom Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 045/116] sxgbe: Fix off by one in samsung driver strncpy size arg Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 046/116] ftrace/x86: Anotate text_mutex split between ftrace_arch_code_modify_post_process() and ftrace_arch_code_modify_prepare() Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 047/116] i2c: hix5hd2: add missed clk_disable_unprepare in remove Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 048/116] Input: raydium_i2c_ts - fix error codes in raydium_i2c_boot_trigger() Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 049/116] Input: synaptics - enable RMI on HP Envy 13-ad105ng Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 050/116] Input: avoid BIT() macro usage in the serio.h UAPI header Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 051/116] ceph: check POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 052/116] ARM: dts: dra7: Add bus_dma_limit for L3 bus Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 053/116] ARM: dts: omap5: " Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 054/116] perf probe: Do not depend on dwfl_module_addrsym() Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 055/116] tools: Let O= makes handle a relative path with -C option Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 056/116] scripts/dtc: Remove redundant YYLOC global declaration Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 057/116] scsi: sd: Fix optimal I/O size for devices that change reported values Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 058/116] nl80211: fix NL80211_ATTR_CHANNEL_WIDTH attribute type Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 059/116] mac80211: mark station unauthorized before key removal Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 060/116] gpiolib: acpi: Correct comment for HP x2 10 honor_wakeup quirk Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 061/116] gpiolib: acpi: Rework honor_wakeup option into an ignore_wake option Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 062/116] gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 BYT + AXP288 model Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 063/116] RDMA/core: Ensure security pkey modify is not lost Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 064/116] genirq: Fix reference leaks on irq affinity notifiers Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 065/116] xfrm: handle NETDEV_UNREGISTER for xfrm device Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 066/116] vti[6]: fix packet tx through bpf_redirect() in XinY cases Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 067/116] RDMA/mlx5: Block delay drop to unprivileged users Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 068/116] xfrm: fix uctx len check in verify_sec_ctx_len Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 069/116] xfrm: add the missing verify_sec_ctx_len check in xfrm_add_acquire Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 070/116] xfrm: policy: Fix doulbe free in xfrm_policy_timer Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 071/116] afs: Fix some tracing details Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 072/116] netfilter: flowtable: reload ip{v6}h in nf_flow_tuple_ip{v6} Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 073/116] netfilter: nft_fwd_netdev: validate family and chain type Greg Kroah-Hartman
2020-04-01 16:17 ` Greg Kroah-Hartman [this message]
2020-04-01 16:17 ` [PATCH 4.19 075/116] vti6: Fix memory leak of skb if input policy check fails Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 076/116] Revert "r8169: check that Realtek PHY driver module is loaded" Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 077/116] mac80211: add option for setting control flags Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 078/116] mac80211: set IEEE80211_TX_CTRL_PORT_CTRL_PROTO for nl80211 TX Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 079/116] USB: serial: option: add support for ASKEY WWHC050 Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 080/116] USB: serial: option: add BroadMobi BM806U Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 081/116] USB: serial: option: add Wistron Neweb D19Q1 Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 082/116] USB: cdc-acm: restore capability check order Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 083/116] USB: serial: io_edgeport: fix slab-out-of-bounds read in edge_interrupt_callback Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 084/116] usb: musb: fix crash with highmen PIO and usbmon Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 085/116] media: flexcop-usb: fix endpoint sanity check Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 086/116] media: usbtv: fix control-message timeouts Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 087/116] staging: rtl8188eu: Add ASUS USB-N10 Nano B1 to device table Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 088/116] staging: wlan-ng: fix ODEBUG bug in prism2sta_disconnect_usb Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 089/116] staging: wlan-ng: fix use-after-free Read in hfa384x_usbin_callback Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 090/116] ahci: Add Intel Comet Lake H RAID PCI ID Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 091/116] libfs: fix infoleak in simple_attr_read() Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 092/116] media: ov519: add missing endpoint sanity checks Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 093/116] media: dib0700: fix rc endpoint lookup Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 094/116] media: stv06xx: add missing descriptor sanity checks Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 095/116] media: xirlink_cit: " Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 096/116] mac80211: Check port authorization in the ieee80211_tx_dequeue() case Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 097/116] mac80211: fix authentication with iwlwifi/mvm Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 098/116] vt: selection, introduce vc_is_sel Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 099/116] vt: ioctl, switch VT_IS_IN_USE and VT_BUSY to inlines Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 100/116] vt: switch vt_dont_switch to bool Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 101/116] vt: vt_ioctl: remove unnecessary console allocation checks Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 102/116] vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console Greg Kroah-Hartman
2020-04-01 16:17 ` [PATCH 4.19 103/116] vt: vt_ioctl: fix use-after-free in vt_in_use() Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 104/116] platform/x86: pmc_atom: Add Lex 2I385SW to critclk_systems DMI table Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 105/116] bpf: Explicitly memset the bpf_attr structure Greg Kroah-Hartman
2020-04-02 18:53   ` Pavel Machek
2020-04-02 19:19     ` Greg Kroah-Hartman
2020-04-02 19:20     ` Greg Kroah-Hartman
2020-04-02 19:53       ` Pavel Machek
2020-04-02 20:04         ` Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 106/116] bpf: Explicitly memset some bpf info structures declared on the stack Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 107/116] gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 CHT + AXP288 model Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 108/116] net: ks8851-ml: Fix IO operations, again Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 109/116] arm64: alternative: fix build with clang integrated assembler Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 110/116] perf map: Fix off by one in strncpy() size argument Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 111/116] ARM: dts: oxnas: Fix clear-mask property Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 112/116] ARM: bcm2835-rpi-zero-w: Add missing pinctrl name Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 113/116] ARM: dts: imx6: phycore-som: fix arm and soc minimum voltage Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 114/116] ARM: dts: N900: fix onenand timings Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 115/116] arm64: dts: ls1043a-rdb: correct RGMII delay mode to rgmii-id Greg Kroah-Hartman
2020-04-01 16:18 ` [PATCH 4.19 116/116] arm64: dts: ls1046ardb: set RGMII interfaces to RGMII_ID mode Greg Kroah-Hartman
2020-04-01 20:15 ` [PATCH 4.19 000/116] 4.19.114-rc1 review Chris Paterson
2020-04-02 13:11   ` Greg Kroah-Hartman
2020-04-02  0:12 ` Guenter Roeck
2020-04-02  7:10 ` Jon Hunter
2020-04-02  8:07 ` Naresh Kamboju
2020-04-02 16:54 ` shuah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200401161552.305828471@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=ast@kernel.org \
    --cc=komachi.yoshiki@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).