You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller:
1) Fix several bpfilter/UMH bugs, in particular make the UMH build not
depend upon X86 specific Kconfig symbols. From Alexei Starovoitov.
2) Fix handling of modified context pointer in bpf verifier, from
Daniel Borkmann.
3) Kill regression in ifdown/ifup sequences for hv_netvsc driver, from
Dexuan Cui.
4) When the bonding primary member name changes, we have to re-evaluate
the bond->force_primary setting, from Xiangning Yu.
5) Eliminate possible padding beyone end of SKB in cdc_ncm driver, from
Bjørn Mork.
6) RX queue length reported for UDP sockets in procfs and socket diag
are inaccurate, from Paolo Abeni.
7) Fix br_fdb_find_port() locking, from Petr Machata.
8) Limit sk_rcvlowat values properly in TCP, from Soheil Hassas
Yeganeh.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (23 commits)
tcp: limit sk_rcvlowat by the maximum receive buffer
net: phy: dp83822: use BMCR_ANENABLE instead of BMSR_ANEGCAPABLE for DP83620
socket: close race condition between sock_close() and sockfs_setattr()
net: bridge: Fix locking in br_fdb_find_port()
udp: fix rx queue len reported by diag and proc interface
cdc_ncm: avoid padding beyond end of skb
net/sched: act_simple: fix parsing of TCA_DEF_DATA
net: fddi: fix a possible null-ptr-deref
net: aquantia: fix unsigned numvecs comparison with less than zero
net: stmmac: fix build failure due to missing COMMON_CLK dependency
bpfilter: fix race in pipe access
bpf, xdp: fix crash in xdp_umem_unaccount_pages
xsk: Fix umem fill/completion queue mmap on 32-bit
tools/bpf: fix selftest get_cgroup_id_user
bpfilter: fix OUTPUT_FORMAT
umh: fix race condition
net: mscc: ocelot: Fix uninitialized error in ocelot_netdevice_event()
bonding: re-evaluate force_primary when the primary slave name changes
ip_tunnel: Fix name string concatenate in __ip_tunnel_create()
hv_netvsc: Fix a network regression after ifdown/ifup
...
This commit is contained in:
@@ -120,7 +120,8 @@ static int raw_form_header(uint8_t *header,
|
||||
skb,
|
||||
vheader,
|
||||
virtio_legacy_is_little_endian(),
|
||||
false
|
||||
false,
|
||||
0
|
||||
);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1142,6 +1142,7 @@ static int bond_option_primary_set(struct bonding *bond,
|
||||
slave->dev->name);
|
||||
rcu_assign_pointer(bond->primary_slave, slave);
|
||||
strcpy(bond->params.primary, slave->dev->name);
|
||||
bond->force_primary = true;
|
||||
bond_select_active_slave(bond);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -267,14 +267,13 @@ static int aq_pci_probe(struct pci_dev *pdev,
|
||||
numvecs = min(numvecs, num_online_cpus());
|
||||
/*enable interrupts */
|
||||
#if !AQ_CFG_FORCE_LEGACY_INT
|
||||
numvecs = pci_alloc_irq_vectors(self->pdev, 1, numvecs,
|
||||
PCI_IRQ_MSIX | PCI_IRQ_MSI |
|
||||
PCI_IRQ_LEGACY);
|
||||
err = pci_alloc_irq_vectors(self->pdev, 1, numvecs,
|
||||
PCI_IRQ_MSIX | PCI_IRQ_MSI |
|
||||
PCI_IRQ_LEGACY);
|
||||
|
||||
if (numvecs < 0) {
|
||||
err = numvecs;
|
||||
if (err < 0)
|
||||
goto err_hwinit;
|
||||
}
|
||||
numvecs = err;
|
||||
#endif
|
||||
self->irqvecs = numvecs;
|
||||
|
||||
|
||||
@@ -1126,7 +1126,7 @@ static int ocelot_netdevice_event(struct notifier_block *unused,
|
||||
{
|
||||
struct netdev_notifier_changeupper_info *info = ptr;
|
||||
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (netif_is_lag_master(dev)) {
|
||||
struct net_device *slave;
|
||||
|
||||
@@ -33,7 +33,7 @@ config DWMAC_DWC_QOS_ETH
|
||||
select PHYLIB
|
||||
select CRC32
|
||||
select MII
|
||||
depends on OF && HAS_DMA
|
||||
depends on OF && COMMON_CLK && HAS_DMA
|
||||
help
|
||||
Support for chips using the snps,dwc-qos-ethernet.txt DT binding.
|
||||
|
||||
@@ -57,7 +57,7 @@ config DWMAC_ANARION
|
||||
config DWMAC_IPQ806X
|
||||
tristate "QCA IPQ806x DWMAC support"
|
||||
default ARCH_QCOM
|
||||
depends on OF && (ARCH_QCOM || COMPILE_TEST)
|
||||
depends on OF && COMMON_CLK && (ARCH_QCOM || COMPILE_TEST)
|
||||
select MFD_SYSCON
|
||||
help
|
||||
Support for QCA IPQ806X DWMAC Ethernet.
|
||||
@@ -100,7 +100,7 @@ config DWMAC_OXNAS
|
||||
config DWMAC_ROCKCHIP
|
||||
tristate "Rockchip dwmac support"
|
||||
default ARCH_ROCKCHIP
|
||||
depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
|
||||
depends on OF && COMMON_CLK && (ARCH_ROCKCHIP || COMPILE_TEST)
|
||||
select MFD_SYSCON
|
||||
help
|
||||
Support for Ethernet controller on Rockchip RK3288 SoC.
|
||||
@@ -123,7 +123,7 @@ config DWMAC_SOCFPGA
|
||||
config DWMAC_STI
|
||||
tristate "STi GMAC support"
|
||||
default ARCH_STI
|
||||
depends on OF && (ARCH_STI || COMPILE_TEST)
|
||||
depends on OF && COMMON_CLK && (ARCH_STI || COMPILE_TEST)
|
||||
select MFD_SYSCON
|
||||
---help---
|
||||
Support for ethernet controller on STi SOCs.
|
||||
@@ -147,7 +147,7 @@ config DWMAC_STM32
|
||||
config DWMAC_SUNXI
|
||||
tristate "Allwinner GMAC support"
|
||||
default ARCH_SUNXI
|
||||
depends on OF && (ARCH_SUNXI || COMPILE_TEST)
|
||||
depends on OF && COMMON_CLK && (ARCH_SUNXI || COMPILE_TEST)
|
||||
---help---
|
||||
Support for Allwinner A20/A31 GMAC ethernet controllers.
|
||||
|
||||
|
||||
@@ -297,11 +297,11 @@ static int skfp_init_one(struct pci_dev *pdev,
|
||||
return 0;
|
||||
err_out5:
|
||||
if (smc->os.SharedMemAddr)
|
||||
pci_free_consistent(pdev, smc->os.SharedMemSize,
|
||||
smc->os.SharedMemAddr,
|
||||
smc->os.SharedMemDMA);
|
||||
pci_free_consistent(pdev, MAX_FRAME_SIZE,
|
||||
smc->os.LocalRxBuffer, smc->os.LocalRxBufferDMA);
|
||||
dma_free_coherent(&pdev->dev, smc->os.SharedMemSize,
|
||||
smc->os.SharedMemAddr,
|
||||
smc->os.SharedMemDMA);
|
||||
dma_free_coherent(&pdev->dev, MAX_FRAME_SIZE,
|
||||
smc->os.LocalRxBuffer, smc->os.LocalRxBufferDMA);
|
||||
err_out4:
|
||||
free_netdev(dev);
|
||||
err_out3:
|
||||
@@ -328,17 +328,17 @@ static void skfp_remove_one(struct pci_dev *pdev)
|
||||
unregister_netdev(p);
|
||||
|
||||
if (lp->os.SharedMemAddr) {
|
||||
pci_free_consistent(&lp->os.pdev,
|
||||
lp->os.SharedMemSize,
|
||||
lp->os.SharedMemAddr,
|
||||
lp->os.SharedMemDMA);
|
||||
dma_free_coherent(&pdev->dev,
|
||||
lp->os.SharedMemSize,
|
||||
lp->os.SharedMemAddr,
|
||||
lp->os.SharedMemDMA);
|
||||
lp->os.SharedMemAddr = NULL;
|
||||
}
|
||||
if (lp->os.LocalRxBuffer) {
|
||||
pci_free_consistent(&lp->os.pdev,
|
||||
MAX_FRAME_SIZE,
|
||||
lp->os.LocalRxBuffer,
|
||||
lp->os.LocalRxBufferDMA);
|
||||
dma_free_coherent(&pdev->dev,
|
||||
MAX_FRAME_SIZE,
|
||||
lp->os.LocalRxBuffer,
|
||||
lp->os.LocalRxBufferDMA);
|
||||
lp->os.LocalRxBuffer = NULL;
|
||||
}
|
||||
#ifdef MEM_MAPPED_IO
|
||||
@@ -394,7 +394,9 @@ static int skfp_driver_init(struct net_device *dev)
|
||||
spin_lock_init(&bp->DriverLock);
|
||||
|
||||
// Allocate invalid frame
|
||||
bp->LocalRxBuffer = pci_alloc_consistent(&bp->pdev, MAX_FRAME_SIZE, &bp->LocalRxBufferDMA);
|
||||
bp->LocalRxBuffer = dma_alloc_coherent(&bp->pdev.dev, MAX_FRAME_SIZE,
|
||||
&bp->LocalRxBufferDMA,
|
||||
GFP_ATOMIC);
|
||||
if (!bp->LocalRxBuffer) {
|
||||
printk("could not allocate mem for ");
|
||||
printk("LocalRxBuffer: %d byte\n", MAX_FRAME_SIZE);
|
||||
@@ -407,23 +409,22 @@ static int skfp_driver_init(struct net_device *dev)
|
||||
if (bp->SharedMemSize > 0) {
|
||||
bp->SharedMemSize += 16; // for descriptor alignment
|
||||
|
||||
bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
|
||||
bp->SharedMemSize,
|
||||
&bp->SharedMemDMA);
|
||||
bp->SharedMemAddr = dma_zalloc_coherent(&bp->pdev.dev,
|
||||
bp->SharedMemSize,
|
||||
&bp->SharedMemDMA,
|
||||
GFP_ATOMIC);
|
||||
if (!bp->SharedMemAddr) {
|
||||
printk("could not allocate mem for ");
|
||||
printk("hardware module: %ld byte\n",
|
||||
bp->SharedMemSize);
|
||||
goto fail;
|
||||
}
|
||||
bp->SharedMemHeap = 0; // Nothing used yet.
|
||||
|
||||
} else {
|
||||
bp->SharedMemAddr = NULL;
|
||||
bp->SharedMemHeap = 0;
|
||||
} // SharedMemSize > 0
|
||||
}
|
||||
|
||||
memset(bp->SharedMemAddr, 0, bp->SharedMemSize);
|
||||
bp->SharedMemHeap = 0;
|
||||
|
||||
card_stop(smc); // Reset adapter.
|
||||
|
||||
@@ -442,15 +443,15 @@ static int skfp_driver_init(struct net_device *dev)
|
||||
|
||||
fail:
|
||||
if (bp->SharedMemAddr) {
|
||||
pci_free_consistent(&bp->pdev,
|
||||
bp->SharedMemSize,
|
||||
bp->SharedMemAddr,
|
||||
bp->SharedMemDMA);
|
||||
dma_free_coherent(&bp->pdev.dev,
|
||||
bp->SharedMemSize,
|
||||
bp->SharedMemAddr,
|
||||
bp->SharedMemDMA);
|
||||
bp->SharedMemAddr = NULL;
|
||||
}
|
||||
if (bp->LocalRxBuffer) {
|
||||
pci_free_consistent(&bp->pdev, MAX_FRAME_SIZE,
|
||||
bp->LocalRxBuffer, bp->LocalRxBufferDMA);
|
||||
dma_free_coherent(&bp->pdev.dev, MAX_FRAME_SIZE,
|
||||
bp->LocalRxBuffer, bp->LocalRxBufferDMA);
|
||||
bp->LocalRxBuffer = NULL;
|
||||
}
|
||||
return err;
|
||||
|
||||
@@ -125,8 +125,10 @@ static int netvsc_open(struct net_device *net)
|
||||
}
|
||||
|
||||
rdev = nvdev->extension;
|
||||
if (!rdev->link_state)
|
||||
if (!rdev->link_state) {
|
||||
netif_carrier_on(net);
|
||||
netif_tx_wake_all_queues(net);
|
||||
}
|
||||
|
||||
if (vf_netdev) {
|
||||
/* Setting synthetic device up transparently sets
|
||||
|
||||
@@ -74,6 +74,25 @@ static int dp83848_config_intr(struct phy_device *phydev)
|
||||
return phy_write(phydev, DP83848_MICR, control);
|
||||
}
|
||||
|
||||
static int dp83848_config_init(struct phy_device *phydev)
|
||||
{
|
||||
int err;
|
||||
int val;
|
||||
|
||||
err = genphy_config_init(phydev);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
/* DP83620 always reports Auto Negotiation Ability on BMSR. Instead,
|
||||
* we check initial value of BMCR Auto negotiation enable bit
|
||||
*/
|
||||
val = phy_read(phydev, MII_BMCR);
|
||||
if (!(val & BMCR_ANENABLE))
|
||||
phydev->autoneg = AUTONEG_DISABLE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct mdio_device_id __maybe_unused dp83848_tbl[] = {
|
||||
{ TI_DP83848C_PHY_ID, 0xfffffff0 },
|
||||
{ NS_DP83848C_PHY_ID, 0xfffffff0 },
|
||||
@@ -83,7 +102,7 @@ static struct mdio_device_id __maybe_unused dp83848_tbl[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(mdio, dp83848_tbl);
|
||||
|
||||
#define DP83848_PHY_DRIVER(_id, _name) \
|
||||
#define DP83848_PHY_DRIVER(_id, _name, _config_init) \
|
||||
{ \
|
||||
.phy_id = _id, \
|
||||
.phy_id_mask = 0xfffffff0, \
|
||||
@@ -92,7 +111,7 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl);
|
||||
.flags = PHY_HAS_INTERRUPT, \
|
||||
\
|
||||
.soft_reset = genphy_soft_reset, \
|
||||
.config_init = genphy_config_init, \
|
||||
.config_init = _config_init, \
|
||||
.suspend = genphy_suspend, \
|
||||
.resume = genphy_resume, \
|
||||
\
|
||||
@@ -102,10 +121,14 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl);
|
||||
}
|
||||
|
||||
static struct phy_driver dp83848_driver[] = {
|
||||
DP83848_PHY_DRIVER(TI_DP83848C_PHY_ID, "TI DP83848C 10/100 Mbps PHY"),
|
||||
DP83848_PHY_DRIVER(NS_DP83848C_PHY_ID, "NS DP83848C 10/100 Mbps PHY"),
|
||||
DP83848_PHY_DRIVER(TI_DP83620_PHY_ID, "TI DP83620 10/100 Mbps PHY"),
|
||||
DP83848_PHY_DRIVER(TLK10X_PHY_ID, "TI TLK10X 10/100 Mbps PHY"),
|
||||
DP83848_PHY_DRIVER(TI_DP83848C_PHY_ID, "TI DP83848C 10/100 Mbps PHY",
|
||||
genphy_config_init),
|
||||
DP83848_PHY_DRIVER(NS_DP83848C_PHY_ID, "NS DP83848C 10/100 Mbps PHY",
|
||||
genphy_config_init),
|
||||
DP83848_PHY_DRIVER(TI_DP83620_PHY_ID, "TI DP83620 10/100 Mbps PHY",
|
||||
dp83848_config_init),
|
||||
DP83848_PHY_DRIVER(TLK10X_PHY_ID, "TI TLK10X 10/100 Mbps PHY",
|
||||
genphy_config_init),
|
||||
};
|
||||
module_phy_driver(dp83848_driver);
|
||||
|
||||
|
||||
+4
-1
@@ -774,13 +774,16 @@ static ssize_t tap_put_user(struct tap_queue *q,
|
||||
int total;
|
||||
|
||||
if (q->flags & IFF_VNET_HDR) {
|
||||
int vlan_hlen = skb_vlan_tag_present(skb) ? VLAN_HLEN : 0;
|
||||
struct virtio_net_hdr vnet_hdr;
|
||||
|
||||
vnet_hdr_len = READ_ONCE(q->vnet_hdr_sz);
|
||||
if (iov_iter_count(iter) < vnet_hdr_len)
|
||||
return -EINVAL;
|
||||
|
||||
if (virtio_net_hdr_from_skb(skb, &vnet_hdr,
|
||||
tap_is_little_endian(q), true))
|
||||
tap_is_little_endian(q), true,
|
||||
vlan_hlen))
|
||||
BUG();
|
||||
|
||||
if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=
|
||||
|
||||
+2
-1
@@ -2089,7 +2089,8 @@ static ssize_t tun_put_user(struct tun_struct *tun,
|
||||
return -EINVAL;
|
||||
|
||||
if (virtio_net_hdr_from_skb(skb, &gso,
|
||||
tun_is_little_endian(tun), true)) {
|
||||
tun_is_little_endian(tun), true,
|
||||
vlan_hlen)) {
|
||||
struct skb_shared_info *sinfo = skb_shinfo(skb);
|
||||
pr_err("unexpected GSO type: "
|
||||
"0x%x, gso_size %d, hdr_len %d\n",
|
||||
|
||||
@@ -1124,7 +1124,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
|
||||
* accordingly. Otherwise, we should check here.
|
||||
*/
|
||||
if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)
|
||||
delayed_ndp_size = ctx->max_ndp_size;
|
||||
delayed_ndp_size = ALIGN(ctx->max_ndp_size, ctx->tx_ndp_modulus);
|
||||
else
|
||||
delayed_ndp_size = 0;
|
||||
|
||||
@@ -1285,7 +1285,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
|
||||
/* If requested, put NDP at end of frame. */
|
||||
if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
|
||||
nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data;
|
||||
cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size);
|
||||
cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size - ctx->max_ndp_size);
|
||||
nth16->wNdpIndex = cpu_to_le16(skb_out->len);
|
||||
skb_put_data(skb_out, ctx->delayed_ndp16, ctx->max_ndp_size);
|
||||
|
||||
|
||||
@@ -1411,7 +1411,8 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
|
||||
hdr = skb_vnet_hdr(skb);
|
||||
|
||||
if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
|
||||
virtio_is_little_endian(vi->vdev), false))
|
||||
virtio_is_little_endian(vi->vdev), false,
|
||||
0))
|
||||
BUG();
|
||||
|
||||
if (vi->mergeable_rx_bufs)
|
||||
|
||||
@@ -58,7 +58,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
|
||||
static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
|
||||
struct virtio_net_hdr *hdr,
|
||||
bool little_endian,
|
||||
bool has_data_valid)
|
||||
bool has_data_valid,
|
||||
int vlan_hlen)
|
||||
{
|
||||
memset(hdr, 0, sizeof(*hdr)); /* no info leak */
|
||||
|
||||
@@ -83,12 +84,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
|
||||
if (skb_vlan_tag_present(skb))
|
||||
hdr->csum_start = __cpu_to_virtio16(little_endian,
|
||||
skb_checksum_start_offset(skb) + VLAN_HLEN);
|
||||
else
|
||||
hdr->csum_start = __cpu_to_virtio16(little_endian,
|
||||
skb_checksum_start_offset(skb));
|
||||
hdr->csum_start = __cpu_to_virtio16(little_endian,
|
||||
skb_checksum_start_offset(skb) + vlan_hlen);
|
||||
hdr->csum_offset = __cpu_to_virtio16(little_endian,
|
||||
skb->csum_offset);
|
||||
} else if (has_data_valid &&
|
||||
|
||||
@@ -45,8 +45,15 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg,
|
||||
struct flowi6 *fl6, struct ipcm6_cookie *ipc6,
|
||||
struct sockcm_cookie *sockc);
|
||||
|
||||
void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
|
||||
__u16 srcp, __u16 destp, int bucket);
|
||||
void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
|
||||
__u16 srcp, __u16 destp, int rqueue, int bucket);
|
||||
static inline void
|
||||
ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp, __u16 srcp,
|
||||
__u16 destp, int bucket)
|
||||
{
|
||||
__ip6_dgram_sock_seq_show(seq, sp, srcp, destp, sk_rmem_alloc_get(sp),
|
||||
bucket);
|
||||
}
|
||||
|
||||
#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
|
||||
|
||||
|
||||
@@ -247,6 +247,11 @@ static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
|
||||
return htons((((u64) hash * (max - min)) >> 32) + min);
|
||||
}
|
||||
|
||||
static inline int udp_rqueue_get(struct sock *sk)
|
||||
{
|
||||
return sk_rmem_alloc_get(sk) - READ_ONCE(udp_sk(sk)->forward_deficit);
|
||||
}
|
||||
|
||||
/* net/ipv4/udp.c */
|
||||
void udp_destruct_sock(struct sock *sk);
|
||||
void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len);
|
||||
|
||||
@@ -63,8 +63,8 @@ struct xdp_statistics {
|
||||
/* Pgoff for mmaping the rings */
|
||||
#define XDP_PGOFF_RX_RING 0
|
||||
#define XDP_PGOFF_TX_RING 0x80000000
|
||||
#define XDP_UMEM_PGOFF_FILL_RING 0x100000000
|
||||
#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000
|
||||
#define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
|
||||
#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
|
||||
|
||||
/* Rx/Tx descriptor */
|
||||
struct xdp_desc {
|
||||
|
||||
@@ -1099,9 +1099,31 @@ enum nft_log_attributes {
|
||||
#define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1)
|
||||
|
||||
/**
|
||||
* LOGLEVEL_AUDIT - a pseudo log level enabling audit logging
|
||||
* enum nft_log_level - nf_tables log levels
|
||||
*
|
||||
* @NFT_LOGLEVEL_EMERG: system is unusable
|
||||
* @NFT_LOGLEVEL_ALERT: action must be taken immediately
|
||||
* @NFT_LOGLEVEL_CRIT: critical conditions
|
||||
* @NFT_LOGLEVEL_ERR: error conditions
|
||||
* @NFT_LOGLEVEL_WARNING: warning conditions
|
||||
* @NFT_LOGLEVEL_NOTICE: normal but significant condition
|
||||
* @NFT_LOGLEVEL_INFO: informational
|
||||
* @NFT_LOGLEVEL_DEBUG: debug-level messages
|
||||
* @NFT_LOGLEVEL_AUDIT: enabling audit logging
|
||||
*/
|
||||
#define LOGLEVEL_AUDIT 8
|
||||
enum nft_log_level {
|
||||
NFT_LOGLEVEL_EMERG,
|
||||
NFT_LOGLEVEL_ALERT,
|
||||
NFT_LOGLEVEL_CRIT,
|
||||
NFT_LOGLEVEL_ERR,
|
||||
NFT_LOGLEVEL_WARNING,
|
||||
NFT_LOGLEVEL_NOTICE,
|
||||
NFT_LOGLEVEL_INFO,
|
||||
NFT_LOGLEVEL_DEBUG,
|
||||
NFT_LOGLEVEL_AUDIT,
|
||||
__NFT_LOGLEVEL_MAX
|
||||
};
|
||||
#define NFT_LOGLEVEL_MAX (__NFT_LOGLEVEL_MAX + 1)
|
||||
|
||||
/**
|
||||
* enum nft_queue_attributes - nf_tables queue expression netlink attributes
|
||||
|
||||
+31
-17
@@ -1617,6 +1617,30 @@ static int get_callee_stack_depth(struct bpf_verifier_env *env,
|
||||
}
|
||||
#endif
|
||||
|
||||
static int check_ctx_reg(struct bpf_verifier_env *env,
|
||||
const struct bpf_reg_state *reg, int regno)
|
||||
{
|
||||
/* Access to ctx or passing it to a helper is only allowed in
|
||||
* its original, unmodified form.
|
||||
*/
|
||||
|
||||
if (reg->off) {
|
||||
verbose(env, "dereference of modified ctx ptr R%d off=%d disallowed\n",
|
||||
regno, reg->off);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
if (!tnum_is_const(reg->var_off) || reg->var_off.value) {
|
||||
char tn_buf[48];
|
||||
|
||||
tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off);
|
||||
verbose(env, "variable ctx access var_off=%s disallowed\n", tn_buf);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* truncate register to smaller size (in bytes)
|
||||
* must be called with size < BPF_REG_SIZE
|
||||
*/
|
||||
@@ -1686,24 +1710,11 @@ static int check_mem_access(struct bpf_verifier_env *env, int insn_idx, u32 regn
|
||||
verbose(env, "R%d leaks addr into ctx\n", value_regno);
|
||||
return -EACCES;
|
||||
}
|
||||
/* ctx accesses must be at a fixed offset, so that we can
|
||||
* determine what type of data were returned.
|
||||
*/
|
||||
if (reg->off) {
|
||||
verbose(env,
|
||||
"dereference of modified ctx ptr R%d off=%d+%d, ctx+const is allowed, ctx+const+const is not\n",
|
||||
regno, reg->off, off - reg->off);
|
||||
return -EACCES;
|
||||
}
|
||||
if (!tnum_is_const(reg->var_off) || reg->var_off.value) {
|
||||
char tn_buf[48];
|
||||
|
||||
tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off);
|
||||
verbose(env,
|
||||
"variable ctx access var_off=%s off=%d size=%d",
|
||||
tn_buf, off, size);
|
||||
return -EACCES;
|
||||
}
|
||||
err = check_ctx_reg(env, reg, regno);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = check_ctx_access(env, insn_idx, off, size, t, ®_type);
|
||||
if (!err && t == BPF_READ && value_regno >= 0) {
|
||||
/* ctx access returns either a scalar, or a
|
||||
@@ -1984,6 +1995,9 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 regno,
|
||||
expected_type = PTR_TO_CTX;
|
||||
if (type != expected_type)
|
||||
goto err_type;
|
||||
err = check_ctx_reg(env, reg, regno);
|
||||
if (err < 0)
|
||||
return err;
|
||||
} else if (arg_type_is_mem_ptr(arg_type)) {
|
||||
expected_type = PTR_TO_STACK;
|
||||
/* One exception here. In case function allows for NULL to be
|
||||
|
||||
+1
-2
@@ -99,6 +99,7 @@ static int call_usermodehelper_exec_async(void *data)
|
||||
|
||||
commit_creds(new);
|
||||
|
||||
sub_info->pid = task_pid_nr(current);
|
||||
if (sub_info->file)
|
||||
retval = do_execve_file(sub_info->file,
|
||||
sub_info->argv, sub_info->envp);
|
||||
@@ -191,8 +192,6 @@ static void call_usermodehelper_exec_work(struct work_struct *work)
|
||||
if (pid < 0) {
|
||||
sub_info->retval = pid;
|
||||
umh_complete(sub_info);
|
||||
} else {
|
||||
sub_info->pid = pid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ endif
|
||||
# which bpfilter_kern.c passes further into umh blob loader at run-time
|
||||
quiet_cmd_copy_umh = GEN $@
|
||||
cmd_copy_umh = echo ':' > $(obj)/.bpfilter_umh.o.cmd; \
|
||||
$(OBJCOPY) -I binary -O $(CONFIG_OUTPUT_FORMAT) \
|
||||
$(OBJCOPY) -I binary -O `$(OBJDUMP) -f $<|grep format|cut -d' ' -f8` \
|
||||
-B `$(OBJDUMP) -f $<|grep architecture|cut -d, -f1|cut -d' ' -f2` \
|
||||
--rename-section .data=.init.rodata $< $@
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user