In the Linux kernel, the following vulnerability has been resolved:
bpf: Make sure internal and UAPI bpf_redirect flags don't overlap
The bpfredirectinfo is shared between the SKB and XDP redirect paths, and the two paths use the same numeric flag values in the ri->flags field (specifically, BPFFBROADCAST == BPFFNEXTHOP). This means that if skb bpfredirectneigh() is used with a non-NULL params argument and, subsequently, an XDP redirect is performed using the same bpfredirectinfo struct, the XDP path will get confused and end up crashing, which syzbot managed to trigger.
With the stack-allocated bpfredirectinfo, the structure is no longer shared between the SKB and XDP paths, so the crash doesn't happen anymore. However, different code paths using identically-numbered flag values in the same struct field still seems like a bit of a mess, so this patch cleans that up by moving the flag definitions together and redefining the three flags in BPFFREDIRECTINTERNAL to not overlap with the flags used for XDP. It also adds a BUILDBUG_ON() check to make sure the overlap is not re-introduced by mistake.
[
{
"id": "CVE-2024-50163-0b6c9b06",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0fca5ed4be8e8bfbfb9bd97845af596bab7192d3",
"target": {
"file": "include/uapi/linux/bpf.h"
},
"deprecated": false,
"digest": {
"line_hashes": [
"170791657915746644106868085955437206680",
"261662788960117911079247225438508801150",
"331209758463528225923592260265885266184",
"33533544664468471557930979744770856638",
"77256644155422760356034807860059255299",
"306117312568765829829457210611901030818",
"55396547808159180015647479479848405242",
"52464718600733809229945139721725134407",
"32203621523137124589235289856733173334",
"287816094595006854548874326757414854660",
"221117626039606579728728100204557495407",
"229342867620578986828597946432906270107"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-0def769d",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0fca5ed4be8e8bfbfb9bd97845af596bab7192d3",
"target": {
"file": "net/core/filter.c",
"function": "BPF_CALL_3"
},
"deprecated": false,
"digest": {
"length": 523.0,
"function_hash": "219366814127278722297164400422248913042"
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-169bc976",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0fca5ed4be8e8bfbfb9bd97845af596bab7192d3",
"target": {
"file": "net/core/filter.c"
},
"deprecated": false,
"digest": {
"line_hashes": [
"100628999878544909861582216464755898718",
"51727874818333412734936891652369786225",
"213833032144347156172660683324679965495",
"133515785256573597398967034930542031609",
"176316243713724143479301165128005466959",
"87835855180021789725859200515875983129",
"286471692760771463977575278574554576543",
"207671235374241354263402129548260438520",
"75256825477349485897317002668794730267"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-22f2292f",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4e1e428533845d48828bd3875c0e92e8565b9962",
"target": {
"file": "include/uapi/linux/bpf.h"
},
"deprecated": false,
"digest": {
"line_hashes": [
"170791657915746644106868085955437206680",
"261662788960117911079247225438508801150",
"331209758463528225923592260265885266184",
"33533544664468471557930979744770856638",
"77256644155422760356034807860059255299",
"306117312568765829829457210611901030818",
"55396547808159180015647479479848405242",
"52464718600733809229945139721725134407",
"32203621523137124589235289856733173334",
"287816094595006854548874326757414854660",
"221117626039606579728728100204557495407",
"229342867620578986828597946432906270107"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-364c25df",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@09d88791c7cd888d5195c84733caf9183dcfbd16",
"target": {
"file": "net/core/filter.c"
},
"deprecated": false,
"digest": {
"line_hashes": [
"100628999878544909861582216464755898718",
"51727874818333412734936891652369786225",
"213833032144347156172660683324679965495",
"133515785256573597398967034930542031609",
"176316243713724143479301165128005466959",
"87835855180021789725859200515875983129",
"286471692760771463977575278574554576543",
"207671235374241354263402129548260438520",
"75256825477349485897317002668794730267"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-551da7f6",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@314dbee9fe4f5cee36435465de52c988d7caa466",
"target": {
"file": "include/uapi/linux/bpf.h"
},
"deprecated": false,
"digest": {
"line_hashes": [
"170791657915746644106868085955437206680",
"261662788960117911079247225438508801150",
"331209758463528225923592260265885266184",
"33533544664468471557930979744770856638",
"77256644155422760356034807860059255299",
"306117312568765829829457210611901030818",
"55396547808159180015647479479848405242",
"52464718600733809229945139721725134407",
"32203621523137124589235289856733173334",
"287816094595006854548874326757414854660",
"221117626039606579728728100204557495407",
"229342867620578986828597946432906270107"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-5552254f",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cec288e05ceac9a0d3a3a1fd279534b11844c826",
"target": {
"file": "net/core/filter.c",
"function": "BPF_CALL_3"
},
"deprecated": false,
"digest": {
"length": 523.0,
"function_hash": "219366814127278722297164400422248913042"
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-652d3e8e",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@09d88791c7cd888d5195c84733caf9183dcfbd16",
"target": {
"file": "include/uapi/linux/bpf.h"
},
"deprecated": false,
"digest": {
"line_hashes": [
"170791657915746644106868085955437206680",
"261662788960117911079247225438508801150",
"331209758463528225923592260265885266184",
"33533544664468471557930979744770856638",
"77256644155422760356034807860059255299",
"306117312568765829829457210611901030818",
"55396547808159180015647479479848405242",
"52464718600733809229945139721725134407",
"32203621523137124589235289856733173334",
"287816094595006854548874326757414854660",
"221117626039606579728728100204557495407",
"229342867620578986828597946432906270107"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-6a519239",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@09d88791c7cd888d5195c84733caf9183dcfbd16",
"target": {
"file": "net/core/filter.c",
"function": "BPF_CALL_3"
},
"deprecated": false,
"digest": {
"length": 523.0,
"function_hash": "219366814127278722297164400422248913042"
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-98d6c503",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@314dbee9fe4f5cee36435465de52c988d7caa466",
"target": {
"file": "net/core/filter.c",
"function": "BPF_CALL_3"
},
"deprecated": false,
"digest": {
"length": 523.0,
"function_hash": "219366814127278722297164400422248913042"
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-a12cb898",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@314dbee9fe4f5cee36435465de52c988d7caa466",
"target": {
"file": "net/core/filter.c"
},
"deprecated": false,
"digest": {
"line_hashes": [
"100628999878544909861582216464755898718",
"51727874818333412734936891652369786225",
"213833032144347156172660683324679965495",
"133515785256573597398967034930542031609",
"176316243713724143479301165128005466959",
"87835855180021789725859200515875983129",
"286471692760771463977575278574554576543",
"207671235374241354263402129548260438520",
"75256825477349485897317002668794730267"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-b4cac425",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cec288e05ceac9a0d3a3a1fd279534b11844c826",
"target": {
"file": "net/core/filter.c"
},
"deprecated": false,
"digest": {
"line_hashes": [
"100628999878544909861582216464755898718",
"51727874818333412734936891652369786225",
"213833032144347156172660683324679965495",
"133515785256573597398967034930542031609",
"176316243713724143479301165128005466959",
"87835855180021789725859200515875983129",
"286471692760771463977575278574554576543",
"207671235374241354263402129548260438520",
"75256825477349485897317002668794730267"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-c44e894d",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cec288e05ceac9a0d3a3a1fd279534b11844c826",
"target": {
"file": "include/uapi/linux/bpf.h"
},
"deprecated": false,
"digest": {
"line_hashes": [
"170791657915746644106868085955437206680",
"261662788960117911079247225438508801150",
"331209758463528225923592260265885266184",
"33533544664468471557930979744770856638",
"77256644155422760356034807860059255299",
"306117312568765829829457210611901030818",
"55396547808159180015647479479848405242",
"52464718600733809229945139721725134407",
"32203621523137124589235289856733173334",
"287816094595006854548874326757414854660",
"221117626039606579728728100204557495407",
"229342867620578986828597946432906270107"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-d6685dc2",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4e1e428533845d48828bd3875c0e92e8565b9962",
"target": {
"file": "net/core/filter.c"
},
"deprecated": false,
"digest": {
"line_hashes": [
"100628999878544909861582216464755898718",
"51727874818333412734936891652369786225",
"213833032144347156172660683324679965495",
"133515785256573597398967034930542031609",
"176316243713724143479301165128005466959",
"87835855180021789725859200515875983129",
"286471692760771463977575278574554576543",
"207671235374241354263402129548260438520",
"75256825477349485897317002668794730267"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-50163-e25a71d0",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4e1e428533845d48828bd3875c0e92e8565b9962",
"target": {
"file": "net/core/filter.c",
"function": "BPF_CALL_3"
},
"deprecated": false,
"digest": {
"length": 523.0,
"function_hash": "219366814127278722297164400422248913042"
},
"signature_version": "v1"
}
]