In the Linux kernel, the following vulnerability has been resolved:
bpf, sockmap: Fix memleak in skpsockqueue_msg
If tcpbpfsendmsg is running during a tear down operation we may enqueue data on the ingress msg queue while tear down is trying to free it.
sk1 (redirect sk2) sk2 ------------------- --------------- tcpbpfsendmsg() tcpbpfsendverdict() tcpbpfsendmsgredir() bpftcpingress() sockmapclose() locksock() locksock() ... blocking skpsockstop skpsockclearstate(psock, SKPSOCKTXENABLED); releasesock(sk); locksock() skmemcharge() getpage() skpsockqueuemsg() skpsockteststate(psock, SKPSOCKTXENABLED); dropskmsg() release_sock()
While dropskmsg(), the msg has charged memory form sk by skmemcharge and has sg pages need to put. To fix we use skmsgfree() and then kfee() msg.
This issue can cause the following info: WARNING: CPU: 0 PID: 9202 at net/core/stream.c:205 skstreamkillqueues+0xc8/0xe0 Call Trace: <IRQ> inetcskdestroysock+0x55/0x110 tcprcvstateprocess+0xe5f/0xe90 ? skfiltertrimcap+0x10d/0x230 ? tcpv4dorcv+0x161/0x250 tcpv4dorcv+0x161/0x250 tcpv4rcv+0xc3a/0xce0 ipprotocoldeliverrcu+0x3d/0x230 iplocaldeliverfinish+0x54/0x60 iplocaldeliver+0xfd/0x110 ? ipprotocoldeliverrcu+0x230/0x230 iprcv+0xd6/0x100 ? iplocaldeliver+0x110/0x110 _netifreceiveskbonecore+0x85/0xa0 processbacklog+0xa4/0x160 _napipoll+0x29/0x1b0 netrxaction+0x287/0x300 _dosoftirq+0xff/0x2fc do_softirq+0x79/0x90 </IRQ>
WARNING: CPU: 0 PID: 531 at net/ipv4/afinet.c:154 inetsockdestruct+0x175/0x1b0 Call Trace: <TASK> _skdestruct+0x24/0x1f0 skpsockdestroy+0x19b/0x1c0 processonework+0x1b3/0x3c0 ? processonework+0x3c0/0x3c0 workerthread+0x30/0x350 ? processonework+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthreadcompleteandexit+0x20/0x20 retfrom_fork+0x22/0x30 </TASK>
{ "vanir_signatures": [ { "digest": { "length": 282.0, "function_hash": "44097140197283893479078045568081170561" }, "target": { "function": "sk_psock_queue_msg", "file": "include/linux/skmsg.h" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4dd2e947d3be13a4de3b3028859b9a6497266bcf", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-0a13a741" }, { "digest": { "length": 282.0, "function_hash": "44097140197283893479078045568081170561" }, "target": { "function": "sk_psock_queue_msg", "file": "include/linux/skmsg.h" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@03948ed6553960db62f1c33bec29e64d7c191a3f", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-26032c53" }, { "digest": { "line_hashes": [ "192899186734178142369551629861073469730", "158001589014005701027985273730605042499", "217806889127226734831982947129734713521", "289276624005125166220330768741541212860", "320560485223018440510053400016223394634", "138618742501168261075703453823615400572", "200291382335321086897173462962518419333", "299225783202667300419350691525403627009", "182888595509341412476128831371841840058", "205364036142345018632200653016084573832", "60545495263353923343269470652297331310", "52076247972707424691091268770819528161", "332210977122461283855479998050765541303", "308070519189065551016872439760215143966", "10154597648955086645758210120559995882", "233413987872263595515421479785733714149", "300885899772070784484600361380204682305" ], "threshold": 0.9 }, "target": { "file": "include/linux/skmsg.h" }, "signature_type": "Line", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@938d3480b92fa5e454b7734294f12a7b75126f09", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-5abc721f" }, { "digest": { "length": 149.0, "function_hash": "321638140342476760902909089643327693137" }, "target": { "function": "drop_sk_msg", "file": "include/linux/skmsg.h" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ef9785f429794567792561a584901faa9291d3ee", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-814ec122" }, { "digest": { "line_hashes": [ "192899186734178142369551629861073469730", "158001589014005701027985273730605042499", "217806889127226734831982947129734713521", "289276624005125166220330768741541212860", "320560485223018440510053400016223394634", "138618742501168261075703453823615400572", "200291382335321086897173462962518419333", "299225783202667300419350691525403627009", "182888595509341412476128831371841840058", "205364036142345018632200653016084573832", "60545495263353923343269470652297331310", "52076247972707424691091268770819528161", "332210977122461283855479998050765541303", "308070519189065551016872439760215143966", "10154597648955086645758210120559995882", "233413987872263595515421479785733714149", "300885899772070784484600361380204682305" ], "threshold": 0.9 }, "target": { "file": "include/linux/skmsg.h" }, "signature_type": "Line", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@03948ed6553960db62f1c33bec29e64d7c191a3f", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-99e3cf41" }, { "digest": { "length": 282.0, "function_hash": "44097140197283893479078045568081170561" }, "target": { "function": "sk_psock_queue_msg", "file": "include/linux/skmsg.h" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ef9785f429794567792561a584901faa9291d3ee", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-a326a57c" }, { "digest": { "line_hashes": [ "192899186734178142369551629861073469730", "158001589014005701027985273730605042499", "217806889127226734831982947129734713521", "289276624005125166220330768741541212860", "320560485223018440510053400016223394634", "138618742501168261075703453823615400572", "200291382335321086897173462962518419333", "299225783202667300419350691525403627009", "182888595509341412476128831371841840058", "205364036142345018632200653016084573832", "60545495263353923343269470652297331310", "52076247972707424691091268770819528161", "332210977122461283855479998050765541303", "308070519189065551016872439760215143966", "10154597648955086645758210120559995882", "233413987872263595515421479785733714149", "300885899772070784484600361380204682305" ], "threshold": 0.9 }, "target": { "file": "include/linux/skmsg.h" }, "signature_type": "Line", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4dd2e947d3be13a4de3b3028859b9a6497266bcf", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-a44b5b8f" }, { "digest": { "line_hashes": [ "192899186734178142369551629861073469730", "158001589014005701027985273730605042499", "217806889127226734831982947129734713521", "289276624005125166220330768741541212860", "320560485223018440510053400016223394634", "138618742501168261075703453823615400572", "200291382335321086897173462962518419333", "299225783202667300419350691525403627009", "182888595509341412476128831371841840058", "205364036142345018632200653016084573832", "60545495263353923343269470652297331310", "52076247972707424691091268770819528161", "332210977122461283855479998050765541303", "308070519189065551016872439760215143966", "10154597648955086645758210120559995882", "233413987872263595515421479785733714149", "300885899772070784484600361380204682305" ], "threshold": 0.9 }, "target": { "file": "include/linux/skmsg.h" }, "signature_type": "Line", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ef9785f429794567792561a584901faa9291d3ee", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-a520b883" }, { "digest": { "length": 149.0, "function_hash": "321638140342476760902909089643327693137" }, "target": { "function": "drop_sk_msg", "file": "include/linux/skmsg.h" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@938d3480b92fa5e454b7734294f12a7b75126f09", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-cfe94253" }, { "digest": { "length": 282.0, "function_hash": "44097140197283893479078045568081170561" }, "target": { "function": "sk_psock_queue_msg", "file": "include/linux/skmsg.h" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@938d3480b92fa5e454b7734294f12a7b75126f09", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-d0e60ba9" }, { "digest": { "length": 149.0, "function_hash": "321638140342476760902909089643327693137" }, "target": { "function": "drop_sk_msg", "file": "include/linux/skmsg.h" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4dd2e947d3be13a4de3b3028859b9a6497266bcf", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-ea08dccf" }, { "digest": { "length": 149.0, "function_hash": "321638140342476760902909089643327693137" }, "target": { "function": "drop_sk_msg", "file": "include/linux/skmsg.h" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@03948ed6553960db62f1c33bec29e64d7c191a3f", "deprecated": false, "signature_version": "v1", "id": "CVE-2022-49207-f6e179bf" } ] }