Skip to content

Instantly share code, notes, and snippets.

@ivan
Last active November 20, 2026 22:56
Show Gist options
  • Select an option

  • Save ivan/e69e790d27ff397f39cee920c6472467 to your computer and use it in GitHub Desktop.

Select an option

Save ivan/e69e790d27ff397f39cee920c6472467 to your computer and use it in GitHub Desktop.
nixpkgs/pkgs/os-specific/linux/kernel/patches.nix
{
lib,
fetchpatch,
fetchurl,
}:
{
ath_regd_optional = rec {
name = "ath_regd_optional";
patch = fetchpatch {
name = name + ".patch";
url = "https://github.com/openwrt/openwrt/raw/ed2015c38617ed6624471e77f27fbb0c58c8c660/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch";
sha256 = "1ssDXSweHhF+pMZyd6kSrzeW60eb6MO6tlf0il17RC0=";
postFetch = ''
sed -i 's/CPTCFG_/CONFIG_/g' $out
sed -i '/--- a\/local-symbols/,$d' $out
'';
};
};
bridge_stp_helper = {
name = "bridge-stp-helper";
patch = ./bridge-stp-helper.patch;
};
btrfs_dedupe_no_time_update_6_18 = {
name = "btrfs_dedupe_no_time_update_6_18";
patch = ./btrfs_dedupe_no_time_update_6_18.patch;
};
# ie31200_edac: report each DIMM's ECC mode as SECDED or None (instead of Unknown) on Sandy
# Bridge, Ivy Bridge and Haswell, from the ECC bits of MAD_DIMM. It isn't in Linus's tree
edac_ie31200_ecc_mode_6_18 = {
name = "edac_ie31200_ecc_mode_6_18";
patch = ./edac_ie31200_ecc_mode_6_18.patch;
};
mq_default_scheduler_bfq_6_12 = {
name = "mq_default_scheduler_bfq_6_12";
patch = ./mq_default_scheduler_bfq_6_12.patch;
};
mq_default_scheduler_bfq_6_18 = {
name = "mq_default_scheduler_bfq_6_18";
patch = ./mq_default_scheduler_bfq_6_18.patch;
};
request_key_helper = {
name = "request-key-helper";
patch = ./request-key-helper.patch;
};
libbpf_C23_compat = {
name = "c23-compat-libbpf";
patch = ./C23-compat-6.1.patch;
};
tools_128bit_types = rec {
name = "tools-add-128-bit-integer-types-for-aarch64";
patch = fetchpatch {
name = name + ".patch";
url = "https://github.com/torvalds/linux/commit/10a47fb67340bca274276faf855d7d460afd9a7a.patch";
hash = "sha256-w6ZnvodW2kS3bqtZVvVN5qDt1Zc7fJvnywki3MBsER0=";
};
};
# https://lore.kernel.org/netdev/20261022104217.1852191-1-pointerliu@126.com/, with its
# context adjusted for kernels before 7.3 (no from->unreadable check after the frag loop).
# Merged as 79dc34beb1fd for 7.4; remove it from a kernel's patch list once that kernel's
# release contains 79dc34beb1fd
skb_zerocopy_shared_frag_pre_7_3 = {
name = "skb-zerocopy-shared-frag-pre-7.3";
patch = ./skb-zerocopy-shared-frag-pre-7.3.patch;
};
# Security fixes from Linus's tree (the 7.3 rc cycle, the 7.4 merge window
# and the 7.4 rc cycle) that the 6.18.y release in kernels-org.json lacks,
# in the order they apply; postFetch adapts a patch's context to 6.18, and
# `backport` names a vendored file for a fix that needed a real backport.
# Once a 6.18.y release contains one, the build fails in patchPhase (usually
# "Reversed (or previously applied) patch detected"); remove that entry then.
security_fixes_6_18 =
map
(
{
commit,
hash ? null,
postFetch ? "",
backport ? null,
}:
let
name = "linux-${lib.substring 0 12 commit}";
in
assert lib.assertMsg (
if backport == null then hash != null else hash == null && postFetch == ""
) "security_fixes_6_18: ${commit} needs either hash (with an optional postFetch) or backport";
{
inherit name;
patch =
if backport != null then
backport
else
fetchpatch {
name = "${name}.patch";
# GitHub first: git.kernel.org's cgit answers parallel fetches with 503
urls = [
"https://github.com/torvalds/linux/commit/${commit}.patch"
"https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=${commit}"
];
inherit hash postFetch;
};
}
)
[
# ucount: read the parent ucounts before dropping the rlimit count (UAF, any user)
{
commit = "38bf603d1ea5d5a65a9cb277df75327ffec01ff1";
hash = "sha256-KPpHC9wwdKnGes2DIh/dTV1ho5I4BW38046h0OlLBTI=";
}
# xattr: always invoke cap_convert_nscap() for security.capability writes
# (any user could put an empty security.capability on any file and break its exec)
{
commit = "0f4a9e682f7fa5becc3af7204606d9bf4780e425";
hash = "sha256-0v3hSSOwsMywGDXM1gHGesPmBmVj3/nI6u20psYx3uQ=";
}
# net/sched: act_api: reject duplicate actions in a batch (UAF, any user via a user namespace)
{
commit = "f67b3ed1308d7a282e2d6202d61af052ab0da39e";
hash = "sha256-/3dsYOScdGJM7+Ohjsp/aAp3PnDtug3lRDnDJCKxYQw=";
}
# gro: do not GRO GSO packets with inconsistent payload (slab out-of-bounds write, any user via a user namespace)
{
commit = "de788d8a7032475f900c16e9cc0c1417f4f719eb";
hash = "sha256-F2MbT3v2ri9rRtInjzXggiWqU+kk3TfNcm2wzFReWoA=";
}
# netfilter: nft_set_rbtree: narrow down range completion to anonymous sets (UAF, any user via a user namespace)
{
commit = "86d47d4c84a1b8470ba3fc16df13ea2a220b74ff";
hash = "sha256-Y3r5wRjf26AVeDeh2/kV7vfUXkg5AVreN9eLLK+m/oc=";
}
# netfilter: nf_conntrack: avoid truncating IPv6 nexthdr offset
# (remote: conntrack can see a different port than the one the packet is delivered to)
{
commit = "48d522b65fb0ce2bd54f8f5838d77b48afcf1f3e";
hash = "sha256-cjL1sP5tBGrWXxHIx0BUZrmQjHOGobVB2HL+9zgkvYY=";
}
# sit: fix UAF in ipip6_tunnel_del_prl() (any user via a user namespace)
{
commit = "5145bb6a2c2683d541828f86d5321e0565f2e30c";
hash = "sha256-mKCXKcm1HEin9ISthiZnYvqOHJfZGG81e2KjwvWG9fo=";
}
# tcp: avoid double destroy in tcp_abort() of an unaccepted child (UAF, any user via a user namespace)
{
commit = "dbd62ad55a4c898f5a4c9edb20c0c062afb799df";
hash = "sha256-Xh0u+0lTyInkSKtVEBFktUvuIf0BYc3SkLTK9MeXlFQ=";
}
# xfrm: hold net_device reference under RCU in bundle creation (UAF, any user via a user namespace)
{
commit = "9fa903b24b1f46b4ff5443bcd4aca23e5c57f9c1";
hash = "sha256-B41fj/6P+vpYvX+Wkf+oXEAKDsBt3Qow3pYvN/vsrU8=";
}
# bpf: Require prog fd or capability for cgroup detach (permission bypass: any user
# who can open a cgroup's directory could detach a program that had been attached
# to that cgroup without BPF_F_ALLOW_MULTI)
{
commit = "2962329f7c86fc51c177d4049c0f15a95ebd270c";
hash = "sha256-1CPuFqBfvLYobuGgwZML3SP7saow3DAz8rlSwU+H8Ho=";
}
# tcp: wait for TIME_WAIT teardown before freeing per-netns ehash (UAF, any user via a
# user namespace)
{
commit = "647b81ddefc6364290e67bf33c89d54971f8995e";
hash = "sha256-RqxdfvbzfozopKnxGVeDKb25kY8fYkFqXe20AyrH18M=";
}
# ip6mr: Serialize multicast router socket ownership (UAF, any user via a user namespace)
{
commit = "c6b41de4dd9f2d6856d8d8d292348f7961034152";
hash = "sha256-jTt0bzDfX73gmSVeCxk2xC2nYKnjHrQ+K8QSvpbXcvg=";
}
# ipv6: fix fib6 walker UAF on NLM_F_REPLACE (any user via a user namespace);
# 6.18's fib6_del_route() has no del_reason argument
{
commit = "23fec4bd76904e9df7a8cc0a81ceb14c36971da4";
hash = "sha256-aBcCemtjq1wXcBXmNJsSRyBUUE7wiGx8XxOpstXQpc8=";
postFetch = ''
substituteInPlace $out --replace-fail 'enum rt_del_reason del_reason)' 'struct fib6_info __rcu **rtp, struct nl_info *info)'
'';
}
# inet: frags: limit the truesize of a reassembly queue (UAF of a socket, any user via
# a user namespace); backported, because 6.18 has no secpath check in
# inet_frag_queue_insert()
{
commit = "3ae20e4697eb969104fe4b1e98a675f0100382b6";
backport = ./inet-frags-limit-truesize-6.18.patch;
}
# tcp: ipv6: do not read ireq->pktopts from tcp_v6_send_synack() (UAF of the SYN skb,
# any user with a listener that reflects flow labels); 6.18 defines tcp_rsk() as a function
{
commit = "8e069fd3fd396b89af417e50b359bc9892dd41cd";
hash = "sha256-DtRfM4km0PRYoG+jHONEgtNuKTF0/U6qqZDvR4rQfPw=";
postFetch = ''
substituteInPlace $out --replace-fail '#define tcp_rsk(ptr) container_of_const(ptr, struct tcp_request_sock, req.req)' 'static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)'
'';
}
# aio: don't let exit_aio() return before complete() is done (write to a kernel stack
# frame that is gone; any user, with four io_setup() calls and an exit)
{
commit = "ac4b449b39e605123c12ea10042cafc9b6f39603";
hash = "sha256-ogMXCY4z4wqgo5Rxr8cdbz7A2unqQDFyf7/+4dZJhr4=";
}
# ipv4: keep XFRM headers out of corked skb lengths (a corked send through AH tunnel
# states overwrites an skb's shared info; any user via a user namespace)
{
commit = "0f47fce51a98d3d9f439c16861d519a7b833a176";
hash = "sha256-G4FATdAmuRh86lLp6rTde51ADqmSLORo+EgZmH6RuyM=";
}
# tcp: do not coalesce segments after FIN (coalesced FINs make tcp_inq() overcount: UAF in
# software kTLS receive, and TCP_ZEROCOPY_RECEIVE walks past the queue; a remote TCP peer can cause it)
{
commit = "1c46780dec48893b8c25fd5e33a3127e8dc39dd4";
hash = "sha256-ZRkaU97nkAjlAlflZgMabhUxxBEq0JJsVstDHo+ThaU=";
}
# net: gro: avoid parsing headers from shared fragments (headers change after
# validation: out-of-bounds write in GRO completion; any user)
{
commit = "44818c9a826d766dc0e21179dc76f229334f1dda";
hash = "sha256-wADh1ptfmHZtyK0d+rGpRmcByUwHSk0LVo5duZ2pxZw=";
}
# net: protect negative destination advice with RCU (UAF of a dst from SO_CNX_ADVICE
# racing a connected UDP send; any user)
{
commit = "4b77d2792c3e482afa108c08f224ea6fa396d80b";
hash = "sha256-nwinGhT9cmecknJs4kTVIXF7dFoxdnD6k+uF1Wl23CQ=";
}
# ipvs: fix protocol data lifetime during namespace teardown (UAF write from the
# secure_tcp defense work; any user via a user namespace)
{
commit = "832aa3e89e806bb2667fe4e656b705f4088b3c9d";
hash = "sha256-+3ChMqjn4JFDou/aE84qWYCXkOla7q99fmhDJOu3bkQ=";
}
# net: skbuff: preserve fclone lifetime when freeing stolen heads (UAF of an skb
# after IPv4 reassembly and GRO; any user via a user namespace)
{
commit = "86706ffa990ecd46a4326f8eecbccbbd60a6cb8d";
hash = "sha256-4YVvpUGOHoHTdCurRpAD+SZF8yCRsE6y7HL1nwr9bOQ=";
}
# net: skbuff: uncharge trimmed zerocopy frags on error (failed MSG_ZEROCOPY sends
# can wrap skb->truesize and free the socket while in use; any user)
{
commit = "8b67debdfbf6b370312ebec5c9e0a1c39b5c7733";
hash = "sha256-CqO3fUnLcxGlJxr5K+M1d7GO7MGs+epQGR5SkaJsS0w=";
}
# net/rds: Do not unpin a page after a failed atomic pin (UAF of a page; any user:
# socket(AF_RDS) autoloads rds, and setsockopt(SO_RDS_TRANSPORT) loads rds_tcp)
{
commit = "8d5ce4751fad9499ea408163af7f410f18a85782";
hash = "sha256-VoArEuU/AwDd8iR4oZ6GuYTglO3OOnDhoZdsSqVodfk=";
}
# net: require a full socket in sock_confirm_neigh() (out-of-bounds write past a request
# socket; any user via a user namespace)
{
commit = "c78b47704934e44442f4e48bfdcc99039e3b85a5";
hash = "sha256-6kpqvYzxi3U2TRzj/WAdjV0BsGknKd3sHo8ygwA3+2M=";
}
# net: gro: do not undo remote checksum offload on merged packets (a 2-byte write into another
# packet or into a released page; user namespace: VXLAN remote checksum offload, fraglist GRO)
{
commit = "c817ec1b06875b98460fbd19591be541bc3fa924";
hash = "sha256-O3Vy0PJx1lmVThfkowubvQZEjUwnWxCWPNbnUTPnync=";
}
# net: gro: invalidate frag0 after a pull (reads and a 2-byte write through a frag0 that a pull
# released; user namespace, as above); must come after c817ec1b0687
{
commit = "98d949a15ff9d3fffaa6983223178374aab92db6";
hash = "sha256-aWqyu+jCyhGiPihQ/Ss75OV+fzm0RCi9UHXPrNb5+UQ=";
}
# net: gro: compare skb->protocol in gro_list_prepare() (GRO on an L3 GRE device parses a held
# packet with the wrong layout and writes into skb_shared_info; user namespace)
{
commit = "511582022bfd07475d0daa209e6e6aa5a940740d";
hash = "sha256-mFKfhX4CjitdfhFsrSUiyUXeQ1PrYD2fPkexH0gEL9o=";
}
# udp: do not use a cross-family sk_rx_dst in early demux (IPv6 packets get an IPv4 dst on a
# dual-stack socket connected to a v4-mapped address; UAF of the socket; any user, or the peer)
{
commit = "5636e67320563be743d47706ef4914078c27edb2";
hash = "sha256-lklba8wpvIPjYpvQezQxWYNqH9W2t/AlzvzCbTC3AJM=";
}
# udp: check frag_list IP family before using skb_segment_list() (writes IPv6 addresses past
# IPv4 headers; user namespace: fraglist GRO and tc act_mpls)
{
commit = "22b7cb932c6a0f7566d41072be6956cb6c8af4e1";
hash = "sha256-mtyGqAtaHbDNliEwtYPeZZigS7BshgV0M986YOjR5FY=";
}
# net: skbuff: don't BUG() on bad arguments to pskb_expand_head() (taken for the ipvlan
# fix below: its skb_cow_head() reaches this BUG() for the shared skbs that pktgen sends)
{
commit = "c7d8bc3dd511dac309754543d3063f3950b364c2";
hash = "sha256-eUP4tzoehO8SFaXnkVPlWwYWQtY7axlAhaJri6pdcvc=";
}
# ipvlan: make outbound skb headers writable (L3/L3S output rewrites a header shared with
# another skb, which then writes past its linear data; user namespace)
{
commit = "a45dbf182137275f44ad7c8bc8acd23f7af6b2cf";
hash = "sha256-pvPzDbJPOZWQoS5SEcwsGQyznzGAzy4+bvRZO8RW1DY=";
}
# ipv6: Check the Home Address option again before its address is used (a write past the skb
# data after a seg6 route moved the headers; user namespace with seg6 routes)
{
commit = "30c71476d842b094651bd7712f6c8ee8716147d0";
hash = "sha256-0faWI3eP6L6c9/OTMIKfXikiT+m7lszhASRpRIP7bhE=";
}
# net: ipv6: keep room for the mac header in dst_dev_overhead() (seg6 encapsulation of
# packets that came in through a VLAN device with reorder_hdr off writes about 64 KB past
# skb->head; user namespace). It also changes the ioam6 and rpl lwtunnels, which our kernels
# don't build
{
commit = "87cd6b717e4069dca34e0866e57eaeb44d3b173e";
hash = "sha256-G5AdV4jAsnfSDKlg/5JncuFLZLSKljocIH1KyAyggOk=";
}
# seg6: fix transport header for inner IPv4 with IP options (with an inbound AH state, an IPv4
# packet that End.DT4, End.DT46 or End.DX4 decapsulated makes ah_input() write into
# skb_shared_info; user namespace)
{
commit = "5838f10563d58afca6711edb5e4eda968ca181d9";
hash = "sha256-8kWtF3GKYX/LrfYcq/J0V9mLov8HT5YNuuZvOiOEQE4=";
}
# tcp: Do not allow buggy transitions between ehash and lhash2 (prerequisite of 8c011697f76a;
# taken on purpose on 2026-11-13 although it changes behaviour: connect() on a socket that was
# a listener, and listen() on a socket that left the hash tables in another state, now fail
# with EINVAL). Drop it, 404381b4f105 and 8c011697f76a together. The postFetch adapts the
# context: 6.18's inet_hash() has no inet_init_ehash_secret() call, and 6.18's
# __inet_hash_connect() declares other locals
{
commit = "8cc3aef0cb198049805ecc061a2cc7b79b0ae43e";
hash = "sha256-AeUdhzgHNy+vtDENHtolJ4sP/fsXbSaoE/gRUbSmiNo=";
postFetch = ''
substituteInPlace $out \
--replace-fail $' \tinet_init_ehash_secret();\n \n' $' \t\treturn 0;\n \t}\n' \
--replace-fail $' \tint ret, i, low, high;\n \tbool local_ports;\n \n+' $' \tint step, l3mdev;\n \tu32 index;\n \n+'
'';
}
# tcp: Set unhashed_state in inet_twsk_hashdance_schedule() (Fixes: 8cc3aef0cb19, and goes
# with it); backported, because 6.18 still declares ehead in that function
{
commit = "404381b4f1053a271a85679cc76a543b10ae043e";
backport = ./tcp-set-unhashed-state-in-twsk-hashdance-6.18.patch;
}
# tcp: do not resurrect a former listener with SO_ATTACH_REUSEPORT_[CE]BPF (UAF in
# espintcp_destruct(); a user in a user and network namespace of their own, where they can
# turn on net.ipv4.tcp_migrate_req; espintcp is built in); needs 8cc3aef0cb19 and 404381b4f105
{
commit = "8c011697f76abf3b2302718a7a1c50e36d849f28";
hash = "sha256-m6hXnGZidAAnX8ndnjleX7CcGj5dFKMS8rsvtzkY+MQ=";
}
# net: wait for in-flight device unregistrations before netns dismantle (while a device waits
# for its last references, NETDEV_UNREGISTER is broadcast again, and the notifiers that run
# then use pernet state, or the netns itself, after it was freed; user namespace);
# backported, because 6.18's struct net has no dev_mc_genid and 6.18's
# default_device_exit_batch() has no rtnl_net_flush_workqueue()
{
commit = "c164a431a646983275d0076ff5b0e4c326fbc10b";
backport = ./net-wait-for-inflight-unregistrations-6.18.patch;
}
# ipv4: use RCU protection in inet_netconf_get_devconf() (an RTM_GETNETCONF request racing the
# destruction of a device's IPv4 state uses the device's in_device after the in_device was
# freed; any user via a user namespace: the request needs no capability, and destroying the
# IPv4 state needs CAP_NET_ADMIN in the device's network namespace)
{
commit = "b2039a6dd36b5c89142bfb95bc0205be8abcc600";
hash = "sha256-egdIWi/tcsaQjkhi3eP1QfKctQ96WE/IpstYFdJLT5g=";
}
# smb: client: validate absolute native symlink targets before NT fixups (creating a symlink
# with a short absolute target such as /ab, on a share mounted without symlinkroot, writes
# past two heap buffers and then copies 65534 bytes into a 24-byte one; any user who can
# write to the share, default mount options);
# backported, because 6.18 tests the mount flags with cifs_sb_flags(cifs_sb)
{
commit = "23c240d9509e15f72e4112fc95f0160ab32ec430";
backport = ./smb-client-validate-absolute-native-symlink-targets-6.18.patch;
}
# smb: client: bound invalid NTLMSSP signature diagnostic (a malicious server's challenge makes
# the client's log message read past the received blob)
{
commit = "0584b02669c3e76188097174b4f25ed13723e94c";
hash = "sha256-B729xmJx1lziP71TuBVIrZdWUEF80SesZr717BW7wO8=";
}
# smb: client: fix OOB write when compounding SMB2_IOCTL with encryption (on a mount with
# encryption, any user who can create a symlink with a long target there writes past a
# 448-byte slab buffer)
{
commit = "73a0060cb22a1d2bd8bff364c18a4259ec0cb528";
hash = "sha256-tqcqH+yFv+Wx0GOcteZ++3OgVAJ9Bga8upUc2LiHrwM=";
}
# smb: client: validate descriptor headers before query result allocation (a server's
# zero-length ACL response makes chown or chmod read through ZERO_SIZE_PTR); 6.18 still
# takes the owner and group SID offsets from the server unchecked, which mainline's
# 29f1005b8b4d validates
{
commit = "ffb59029c0d52bf76fdd2678f5d6fd13e26220dd";
hash = "sha256-ntqoTtJdXsc6NaLLgNmM5sDRpfYlXd5WPQiuByHO/Y8=";
}
# smb: client: fix out-of-bounds read in dfs_parse_target_referral() (a DFS mount with a mount
# charset other than utf8, when the server's referral consumes more of the path than the
# mount charset's string holds; an honest server fails such a mount earlier on 6.18, which
# lacks 92509ce64fff)
{
commit = "86aacc2f3f6ba18e1d87feee24f37c94b3ce863a";
hash = "sha256-LuIQUvFctfGsTy/OjvFUiAR9UaRPal+RWPojEp4ElvQ=";
}
# smb: client: hold the inode across cifs_oplock_break() (dropping the handle can evict the
# inode, for instance of an open file that was unlinked, and the oplock break handler then
# keeps using it; a server's oplock or lease break starts the handler)
{
commit = "fce78321f1b59531cf6fc94860550db1db8dec55";
hash = "sha256-2nhIoZ9JJcORccIKHcX+lnvTL1abiYdp0/zxm32pSHk=";
# 6.18 has no CONFIG_SWAP block after cifs_oplock_break()
postFetch = ''
substituteInPlace $out \
--replace-fail $' }\n \n #ifdef CONFIG_SWAP\n' $' }\n \n static int cifs_swap_activate(struct swap_info_struct *sis,\n'
'';
}
# smb: client: hold server ref while queueing reconnect work (on a multichannel mount, a
# reconnect that finds the server no longer supports multichannel can drop a secondary
# channel's last reference and then queue reconnect work on the freed server); backported,
# because 6.18 calls cifs_chan_skip_or_disable() and mod_delayed_work() directly
{
commit = "f02d249e9756b78990aaaa1635e47e06deb2cb51";
backport = ./smb-client-hold-server-ref-while-queueing-reconnect-work-6.18.patch;
}
# smb: client: skip NULL channel in __cifs_put_smb_ses() (on a multichannel mount, when a
# reconnect finds that the server no longer supports multichannel,
# cifs_chan_skip_or_disable() sets a secondary channel's server pointer to NULL without
# lowering chan_count; releasing the session before the primary channel's reconnect has
# lowered it calls cifs_put_tcp_session(NULL), which takes cifs_tcp_ses_lock and then
# oopses, so every later CIFS operation that takes the lock spins forever); DoS only,
# taken at the user's request on 2026-11-14
{
commit = "8deaf64a59a263161dfc5128f8398fb3dcba4fac";
hash = "sha256-Mv8YtrJxxAeXW+QPoTYbd5vER00YPhu04gSVKat5e3E=";
}
# perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit (when a context
# switch consumes the pending disable of a CPU's last cgroup event, perf_cgroup_switch()
# sets cpuctx->cgrp, which that disable has just cleared, to the incoming task's cgroup,
# without taking a reference; after that cgroup is removed and freed,
# perf_cgroup_set_timestamp() writes through the freed perf_cgroup's per-CPU pointer;
# reachable where kernel.perf_event_paranoid is 0 or lower, since a cgroup event is a
# per-CPU event, by any user who can also remove a cgroup that their tasks ran in, such
# as one in the subtree that systemd delegates to the user's own user manager)
{
commit = "59f1398140869432c7171b9a2a279ca315467c4e";
hash = "sha256-fYJ4QTjK/C45HeH1HoPF/E0VHvS7blD7pmVnMx2QC1w=";
}
# mm: limit pagecache folio refcount (5 patches: the refcount of a large pagecache folio
# could be overflowed into a use-after-free: each PTE that maps one of its pages holds a
# reference, a file can be mapped many times, and pipes and GUP take more; any user who
# can read a file on a cifs mount gets large folios, and so does any user from a tmpfs
# mounted with huge=always in a user namespace). The series' networking half, for
# references that skbs take, goes through the net tree and isn't merged yet. "when
# mapping pages" is backported, because 6.18 has no mm/folio.c,
# cond_install_uffd_wp_ptes() or uffd RWP, and its copy_huge_pud() takes no reference;
# a 6.18.y release with d90bdc02e36e (queued) makes copy_huge_pud() take one, and then
# needs mainline's check there too
{
commit = "26b8f029ce5224dd5c5f45a4bc964a209c259914";
backport = ./mm-limit-pagecache-folio-refcount-when-mapping-pages-6.18.patch;
}
# mm: limit pagecache folio refcount when splicing into pipes; 6.18's mm/internal.h has
# the vmalloc.c section after splice_folio_into_pipe()
{
commit = "c6c9a4c1c9a1669693330205cb9d86fafd3cf235";
hash = "sha256-c1yDW5ndPDbIb+mWpZFHVz1LLMtqsnWMP4ZsxhPCwPw=";
postFetch = ''
substituteInPlace $out \
--replace-fail $' \n static inline bool vma_is_single_threaded_private(struct vm_area_struct *vma)\n {\n' $' \n /*\n * mm/vmalloc.c\n'
'';
}
# mm/mmu_gather: flush pending references early before the folio limit
{
commit = "317bd7d28b248fd4d4e14614d7c30b17a36ef4d7";
hash = "sha256-6Q+cmuU2ignfjcScG8nNncF+0Wdr+lQuzj+vZdVr+B8=";
}
# iommufd: fix cleanup when adding memfd folio pins fails (the GUP limit below makes the
# failure easier to reach)
{
commit = "b8ba6cc9943222676d46ac77d3d3de2685a55bf8";
hash = "sha256-EE/jvY3mY7dRBr/efkx8Ay1eEVb85/NViux/kAvdUx0=";
}
# mm/gup: limit pagecache folio refcount when grabbing references
{
commit = "2d9bcd380585abc436f055fbb618b34f98882004";
hash = "sha256-jvLkXXtQncPzGTUh3zdtQr1Priu5mcpZCvM3Iju57Eo=";
}
# xarray: clear the new head's parent before freeing the old head. Unpatched,
# xas_shrink() queues the old head for RCU freeing before it clears the new head's
# parent pointer, so a lockless page cache walker that starts after the grace period
# has begun can climb from the new head into the old head after it is freed
# (use-after-free; any user who reads a file while it is truncated). It has no
# Cc: stable, so 6.18.y may never take it, and it may outlive the entries next to it
{
commit = "9378306c5d3db7e733d60a8b85a22b2b143ecffd";
hash = "sha256-O5B0hC4W4rsmsZdTgSuKj2e68n5RerlWejPCRtIwnDE=";
}
# mm/filemap: stop fault-around when the walk steps back. Unpatched, when the page
# cache walk in filemap_map_pages() returns a lower index, vmf->pte moves back and can
# leave the page table it locked: a use-after-free read of a freed page-table page, or
# a PTE write outside the locked page table. Any user can race read faults against the
# split of a large folio of at least 64 pages (a memfd collapsed with MADV_COLLAPSE, a
# tmpfs mounted with huge=always in a user namespace, or MADV_HUGEPAGE on a file on
# cifs, ext4 or XFS). 6.18's loop doesn't declare map_ret, so the postFetch replaces
# that context line with the `do {` line above it, which keeps the hunk's line counts
{
commit = "cf5518aa1832d82b391ac2492863ae6a7315827c";
hash = "sha256-dtaHsNdCFFrMI0sVqV3Z+qzHmyOPS8P68mMmiuBe7Zs=";
postFetch = ''
substituteInPlace $out \
--replace-fail $' \t\tunsigned long end;\n \t\tvm_fault_t map_ret;\n' $' \tdo {\n \t\tunsigned long end;\n'
'';
}
# xarray: fix index jumping backwards in xas_find() (one cause of the step back above:
# a multi-index entry in a non-leaf node that is split during the walk)
{
commit = "a4e667346a8d91e629a2ca9affc70dc28978f4a1";
hash = "sha256-CXCJDy9bdzHIFNgnRq34nZtsunhRWMXgoTmvD/32q+o=";
}
# ipv6: gro: limit the number of extension headers. Unpatched, a long chain of IPv6
# extension headers pushes a GRO packet's transport header offset past what 16 bits
# hold, and gro_receive_network_flush() then reads out of bounds with the truncated
# offset (any user via a user namespace, e.g. veth with GRO)
{
commit = "050f2adb60434a2b4dee2cf3350269379a32cf72";
hash = "sha256-QZglRKpQznoN/ugJ3pu4G3+XMLIZWdQv4kChuwp+Oq4=";
}
# net: make room for the tunnel header in skb_segment_list(). Unpatched, when a fraglist
# GRO packet is forwarded into a tunnel and segmented in software, the tunnel header
# is put in front of each segment without checking its headroom: skb_under_panic() on
# IPIP, and on VXLAN a copy in front of the segment's head (slab out-of-bounds write;
# any user via a user namespace). It has no Cc: stable, so 6.18.y may never take it,
# and it may outlive the entries next to it
{
commit = "abccf171fa8e97954e74934bde811d76a5410cbd";
hash = "sha256-tn7fjP+Tr4qST520ck/7GyjSDVNMEnPqZVCv0xYy9dE=";
}
# tcp: Fix the SO_REUSEPORT bind cache admitting a conflicting socket. Unpatched, any
# user can bind and listen on a port next to another user's listener where the bind
# conflict check should refuse it, and with a socket bound to a device, which the
# listener lookup prefers, take that listener's connections
{
commit = "f675070191f202010b010160b509a543dd232ae6";
hash = "sha256-1ea3y40cPIQK4K9jb6stKzR3sflaf5f3A5NgQYKO62U=";
}
# Bluetooth: SMP: Fail if local and remote public key X coords match. Unpatched, in
# Secure Connections pairing with Passkey Entry, a man in the middle can send the
# initiating device a public key with the X coordinate of that device's own key, and
# reflect its authentication values, to learn the passkey (CVE-2021-37577). It has no
# Cc: stable, so 6.18.y may never take it, and it may outlive the entries next to it
{
commit = "fd038b82c71baa8dfb80e1781e53c0dbbda84e70";
hash = "sha256-ntzTfq3Bea7YjgFMlM6DyHTsV6bhJFnR4H5410eEiXk=";
}
# ipvs: ftp: skip conntrack templates in ip_vs_ftp_out. Unpatched, IPVS's FTP helper
# (ip_vs_ftp) can make the conntrack template of a CT target with a conntrack helper
# the master of an expectation that outlives the template, and removing the
# expectation then reads and writes freed memory. Any user can set this up in a user
# namespace: a lookup of the IPVS generic netlink family loads ip_vs, and adding a
# service through IPVS's setsockopt interface with a scheduler named "ftp" loads
# ip_vs_ftp
{
commit = "4656934d460da68382cf91766a1ff2d0610554ae";
hash = "sha256-38egDMN7C8HyrcQdaJFXpaTiw2e0JYGETl4PJSM/y80=";
}
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment