Skip to content

Commit

Permalink
HACK: net: Avoid ABI change in 4.9.115
Browse files Browse the repository at this point in the history
Commit 2d08921 "tcp: free batches of packets in tcp_prune_ofo_queue()"
moved sk_buff::pfmemalloc to a different place in the structure, so that
__copy_skb_header() wouldn't copy it.

To avoid an ABI change, move it back.  Change __copy_skb_header() to
save and restore pfmemalloc so that it it not overwritten.

[nc: Resolve conflicts and add HACK tag. A proper fix would just be to
     rebuild the Wi-Fi module against the new change but that isn't as
     easy as on regular Linux]
Signed-off-by: Nathan Chancellor <[email protected]>
Signed-off-by: Raphiel Rollerscaperers <[email protected]>
  • Loading branch information
bwhacks authored and raphielscape committed Oct 30, 2018
1 parent f993c03 commit 82076ab
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
11 changes: 10 additions & 1 deletion arch/arm64/configs/raph_defconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONFIG_LOCALVERSION="-Tanya-Kat-r0.5"
CONFIG_LOCALVERSION="-Spooky-Kat-r0.5H1"
# CONFIG_FHANDLE is not set
CONFIG_AUDIT=y
# CONFIG_AUDITSYSCALL is not set
Expand Down Expand Up @@ -446,6 +446,15 @@ CONFIG_USB_CONFIGFS_F_CDEV=y
CONFIG_USB_CONFIGFS_F_CCID=y
CONFIG_USB_CONFIGFS_F_GSI=y
CONFIG_USB_CONFIGFS_F_QDSS=y
CONFIG_MMC=y
CONFIG_MMC_PERF_PROFILING=y
CONFIG_MMC_PARANOID_SD_INIT=y
CONFIG_MMC_CLKGATE=y
CONFIG_MMC_BLOCK_DEFERRED_RESUME=y
CONFIG_MMC_TEST=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_MSM=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_LM3644=y
Expand Down
10 changes: 5 additions & 5 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ static inline bool skb_mstamp_after(const struct skb_mstamp *t1,
* @hash: the packet hash
* @queue_mapping: Queue mapping for multiqueue devices
* @xmit_more: More SKBs are pending for this queue
* @pfmemalloc: skbuff was allocated from PFMEMALLOC reserves
* @ndisc_nodetype: router type (from link layer)
* @ooo_okay: allow the mapping of a socket to a queue to be changed
* @l4_hash: indicate hash is a canonical 4-tuple hash over transport
Expand Down Expand Up @@ -698,7 +697,7 @@ struct sk_buff {
peeked:1,
head_frag:1,
xmit_more:1,
pfmemalloc:1;
__unused:1; /* one bit hole */
kmemcheck_bitfield_end(flags1);

/* fields enclosed in headers_start/headers_end are copied
Expand All @@ -718,30 +717,31 @@ struct sk_buff {

__u8 __pkt_type_offset[0];
__u8 pkt_type:3;
__u8 pfmemalloc:1;
__u8 ignore_df:1;
__u8 nfctinfo:3;
__u8 nf_trace:1;

__u8 nf_trace:1;
__u8 ip_summed:2;
__u8 ooo_okay:1;
__u8 l4_hash:1;
__u8 sw_hash:1;
__u8 wifi_acked_valid:1;
__u8 wifi_acked:1;
__u8 no_fcs:1;

__u8 no_fcs:1;
/* Indicates the inner headers are valid in the skbuff. */
__u8 encapsulation:1;
__u8 encap_hdr_csum:1;
__u8 csum_valid:1;
__u8 csum_complete_sw:1;
__u8 csum_level:2;
__u8 csum_bad:1;

#ifdef CONFIG_IPV6_NDISC_NODETYPE
__u8 ndisc_nodetype:2;
#endif
__u8 ipvs_property:1;

__u8 inner_protocol_type:1;
__u8 fast_forwarded:1;
__u8 remcsum_offload:1;
Expand Down
5 changes: 5 additions & 0 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,8 @@ EXPORT_SYMBOL(napi_consume_skb);

static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
{
bool pfmemalloc;

new->tstamp = old->tstamp;
/* We do not copy old->sk */
new->dev = old->dev;
Expand All @@ -855,6 +857,8 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
*/
new->queue_mapping = old->queue_mapping;

pfmemalloc = new->pfmemalloc;

memcpy(&new->headers_start, &old->headers_start,
offsetof(struct sk_buff, headers_end) -
offsetof(struct sk_buff, headers_start));
Expand Down Expand Up @@ -889,6 +893,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
#endif
#endif

new->pfmemalloc = pfmemalloc;
}

/*
Expand Down

0 comments on commit 82076ab

Please sign in to comment.