Message ID | 20221117045925.14297-1-imv4bel@gmail.com |
---|---|
Headers | show |
Series | Fix multiple race condition vulnerabilities in dvb-core and device driver | expand |
On Wed, 22 Feb 2023, Lee Jones wrote: > On Tue, 10 Jan 2023, Takashi Iwai wrote: > > > On Thu, 17 Nov 2022 05:59:21 +0100, > > Hyunwoo Kim wrote: > > > > > > Dear, > > > > > > This patch set is a security patch for various race condition vulnerabilities that occur > > > in 'dvb-core' and 'ttusb_dec', a dvb-based device driver. > > > > > > > > > # 1. media: dvb-core: Fix use-after-free due to race condition occurring in dvb_frontend > > > This is a security patch for a race condition that occurs in the dvb_frontend system of dvb-core. > > > > > > The race condition that occurs here will occur with _any_ device driver using dvb_frontend. > > > > > > The race conditions that occur in dvb_frontend are as follows > > [...] > > > > # 4. media: ttusb-dec: Fix memory leak in ttusb_dec_exit_dvb() > > > This is a patch for a memory leak that occurs in the ttusb_dec_exit_dvb() function. > > > > > > Because ttusb_dec_exit_dvb() does not call dvb_frontend_detach(), > > > several fe related structures are not kfree()d. > > > > > > Users can trigger a memory leak just by repeating connecting and disconnecting > > > the ttusb_dec device. > > > > > > > > > Finally, most of these patches are similar to this one, the security patch for > > > CVE-2022-41218 that I reported: > > > https://lore.kernel.org/linux-media/20221031100245.23702-1-tiwai@suse.de/ > > > > > > > > > Regards, > > > Hyunwoo Kim > > > > Are those issues still seen with the latest 6.2-rc kernel? > > I'm asking because there have been a few fixes in dvb-core to deal > > with some UAFs. > > > > BTW, Mauro, the issues are tagged with several CVE's: > > CVE-2022-45884, CVE-2022-45886, CVE-2022-45885, CVE-2022-45887. > > Was there an answer to this question? > > Rightly or wrongly this patch is still being touted as the fix for some > reported CVEs [0]. > > Is this patch still required or has it been superseded? If the later, > which patch superseded it? > > Thanks. > > [0] https://nvd.nist.gov/vuln/detail/CVE-2022-45886 Have these issues been fixed already? If not, is this patch set due to be merged or reviewed?
On Tue, 28 Feb 2023, Lee Jones wrote: > On Wed, 22 Feb 2023, Lee Jones wrote: > > > On Tue, 10 Jan 2023, Takashi Iwai wrote: > > > > > On Thu, 17 Nov 2022 05:59:21 +0100, > > > Hyunwoo Kim wrote: > > > > > > > > Dear, > > > > > > > > This patch set is a security patch for various race condition vulnerabilities that occur > > > > in 'dvb-core' and 'ttusb_dec', a dvb-based device driver. > > > > > > > > > > > > # 1. media: dvb-core: Fix use-after-free due to race condition occurring in dvb_frontend > > > > This is a security patch for a race condition that occurs in the dvb_frontend system of dvb-core. > > > > > > > > The race condition that occurs here will occur with _any_ device driver using dvb_frontend. > > > > > > > > The race conditions that occur in dvb_frontend are as follows > > > > [...] > > > > > > # 4. media: ttusb-dec: Fix memory leak in ttusb_dec_exit_dvb() > > > > This is a patch for a memory leak that occurs in the ttusb_dec_exit_dvb() function. > > > > > > > > Because ttusb_dec_exit_dvb() does not call dvb_frontend_detach(), > > > > several fe related structures are not kfree()d. > > > > > > > > Users can trigger a memory leak just by repeating connecting and disconnecting > > > > the ttusb_dec device. > > > > > > > > > > > > Finally, most of these patches are similar to this one, the security patch for > > > > CVE-2022-41218 that I reported: > > > > https://lore.kernel.org/linux-media/20221031100245.23702-1-tiwai@suse.de/ > > > > > > > > > > > > Regards, > > > > Hyunwoo Kim > > > > > > Are those issues still seen with the latest 6.2-rc kernel? > > > I'm asking because there have been a few fixes in dvb-core to deal > > > with some UAFs. > > > > > > BTW, Mauro, the issues are tagged with several CVE's: > > > CVE-2022-45884, CVE-2022-45886, CVE-2022-45885, CVE-2022-45887. > > > > Was there an answer to this question? > > > > Rightly or wrongly this patch is still being touted as the fix for some > > reported CVEs [0]. > > > > Is this patch still required or has it been superseded? If the later, > > which patch superseded it? > > > > Thanks. > > > > [0] https://nvd.nist.gov/vuln/detail/CVE-2022-45886 > > Have these issues been fixed already? > > If not, is this patch set due to be merged or reviewed? Still nothing heard from the author or any maintainer. I'd take this as a hint if I had any social skills! Please could someone provide me with a status report on these patches? They appear to have CVEs associated with them. Have they been fixed? -- Lee Jones [李琼斯]
Dear, Sorry for the late reply. This patch hasn't been reviewed in a long time, and I had completely forgotten about it. I no longer have the emulating environment I was debugging this in at the time, but from looking at the code it appears that the vulnerability still exists. This means that this patch should be reviewed by the DVB maintainers, but my guess is that, as it has been, it's unlikely to get reviewed. Regards, Hyunwoo Kim 2023년 3월 7일 (화) 오후 7:37, Lee Jones <lee@kernel.org>님이 작성: > > On Tue, 28 Feb 2023, Lee Jones wrote: > > > On Wed, 22 Feb 2023, Lee Jones wrote: > > > > > On Tue, 10 Jan 2023, Takashi Iwai wrote: > > > > > > > On Thu, 17 Nov 2022 05:59:21 +0100, > > > > Hyunwoo Kim wrote: > > > > > > > > > > Dear, > > > > > > > > > > This patch set is a security patch for various race condition vulnerabilities that occur > > > > > in 'dvb-core' and 'ttusb_dec', a dvb-based device driver. > > > > > > > > > > > > > > > # 1. media: dvb-core: Fix use-after-free due to race condition occurring in dvb_frontend > > > > > This is a security patch for a race condition that occurs in the dvb_frontend system of dvb-core. > > > > > > > > > > The race condition that occurs here will occur with _any_ device driver using dvb_frontend. > > > > > > > > > > The race conditions that occur in dvb_frontend are as follows > > > > > > [...] > > > > > > > > # 4. media: ttusb-dec: Fix memory leak in ttusb_dec_exit_dvb() > > > > > This is a patch for a memory leak that occurs in the ttusb_dec_exit_dvb() function. > > > > > > > > > > Because ttusb_dec_exit_dvb() does not call dvb_frontend_detach(), > > > > > several fe related structures are not kfree()d. > > > > > > > > > > Users can trigger a memory leak just by repeating connecting and disconnecting > > > > > the ttusb_dec device. > > > > > > > > > > > > > > > Finally, most of these patches are similar to this one, the security patch for > > > > > CVE-2022-41218 that I reported: > > > > > https://lore.kernel.org/linux-media/20221031100245.23702-1-tiwai@suse.de/ > > > > > > > > > > > > > > > Regards, > > > > > Hyunwoo Kim > > > > > > > > Are those issues still seen with the latest 6.2-rc kernel? > > > > I'm asking because there have been a few fixes in dvb-core to deal > > > > with some UAFs. > > > > > > > > BTW, Mauro, the issues are tagged with several CVE's: > > > > CVE-2022-45884, CVE-2022-45886, CVE-2022-45885, CVE-2022-45887. > > > > > > Was there an answer to this question? > > > > > > Rightly or wrongly this patch is still being touted as the fix for some > > > reported CVEs [0]. > > > > > > Is this patch still required or has it been superseded? If the later, > > > which patch superseded it? > > > > > > Thanks. > > > > > > [0] https://nvd.nist.gov/vuln/detail/CVE-2022-45886 > > > > Have these issues been fixed already? > > > > If not, is this patch set due to be merged or reviewed? > > Still nothing heard from the author or any maintainer. > > I'd take this as a hint if I had any social skills! > > Please could someone provide me with a status report on these patches? > > They appear to have CVEs associated with them. Have they been fixed? > > -- > Lee Jones [李琼斯]
Em Wed, 16 Nov 2022 20:59:21 -0800 Hyunwoo Kim <imv4bel@gmail.com> escreveu: > Dear, > > This patch set is a security patch for various race condition vulnerabilities that occur > in 'dvb-core' and 'ttusb_dec', a dvb-based device driver. > > > # 1. media: dvb-core: Fix use-after-free due to race condition occurring in dvb_frontend > This is a security patch for a race condition that occurs in the dvb_frontend system of dvb-core. > > The race condition that occurs here will occur with _any_ device driver using dvb_frontend. > > The race conditions that occur in dvb_frontend are as follows > (Description is based on drivers/media/usb/as102/as102_drv.c using dvb_frontend): > ``` > cpu0 cpu1 > 1. open() > dvb_frontend_open() > dvb_frontend_get() // kref : 3 > > > 2. as102_usb_disconnect() > as102_dvb_unregister() > dvb_unregister_frontend() > dvb_frontend_put() // kref : 2 > dvb_frontend_detach() > dvb_frontend_put() // kref : 1 > 3. close() > __fput() > dvb_frontend_release() > dvb_frontend_put() // kref : 0 > dvb_frontend_free() > __dvb_frontend_free() > dvb_free_device() > kfree (dvbdev->fops); > ... > fops_put(file->f_op); // UAF!! Hmm... you're mentioning ttusb_dec at the comment, but here you're showing the race for as102, which is a different driver. I'm confused. Thanks, Mauro
On Tue, 07 Mar 2023, V4bel wrote: > Dear, > > Sorry for the late reply. > This patch hasn't been reviewed in a long time, and I had completely > forgotten about it. > > I no longer have the emulating environment I was debugging this in at > the time, but from looking at the code it appears that the > vulnerability still exists. > This means that this patch should be reviewed by the DVB maintainers, > but my guess is that, as it has been, it's unlikely to get reviewed. Mauro just provided some feedback. Please help by answering his queries, thank you. -- Lee Jones [李琼斯]
Em Tue, 7 Mar 2023 10:36:59 +0000 Lee Jones <lee@kernel.org> escreveu: > On Tue, 28 Feb 2023, Lee Jones wrote: > > > On Wed, 22 Feb 2023, Lee Jones wrote: > > > > > On Tue, 10 Jan 2023, Takashi Iwai wrote: > > > > > > > On Thu, 17 Nov 2022 05:59:21 +0100, > > > > Hyunwoo Kim wrote: > > > > > > > > > > Dear, > > > > > > > > > > This patch set is a security patch for various race condition vulnerabilities that occur > > > > > in 'dvb-core' and 'ttusb_dec', a dvb-based device driver. > > > > > > > > > > > > > > > # 1. media: dvb-core: Fix use-after-free due to race condition occurring in dvb_frontend > > > > > This is a security patch for a race condition that occurs in the dvb_frontend system of dvb-core. > > > > > > > > > > The race condition that occurs here will occur with _any_ device driver using dvb_frontend. > > > > > > > > > > The race conditions that occur in dvb_frontend are as follows > > > > > > [...] > > > > > > > > # 4. media: ttusb-dec: Fix memory leak in ttusb_dec_exit_dvb() > > > > > This is a patch for a memory leak that occurs in the ttusb_dec_exit_dvb() function. > > > > > > > > > > Because ttusb_dec_exit_dvb() does not call dvb_frontend_detach(), > > > > > several fe related structures are not kfree()d. > > > > > > > > > > Users can trigger a memory leak just by repeating connecting and disconnecting > > > > > the ttusb_dec device. > > > > > > > > > > > > > > > Finally, most of these patches are similar to this one, the security patch for > > > > > CVE-2022-41218 that I reported: > > > > > https://lore.kernel.org/linux-media/20221031100245.23702-1-tiwai@suse.de/ > > > > > > > > > > > > > > > Regards, > > > > > Hyunwoo Kim > > > > > > > > Are those issues still seen with the latest 6.2-rc kernel? > > > > I'm asking because there have been a few fixes in dvb-core to deal > > > > with some UAFs. > > > > > > > > BTW, Mauro, the issues are tagged with several CVE's: > > > > CVE-2022-45884, CVE-2022-45886, CVE-2022-45885, CVE-2022-45887. > > > > > > Was there an answer to this question? > > > > > > Rightly or wrongly this patch is still being touted as the fix for some > > > reported CVEs [0]. > > > > > > Is this patch still required or has it been superseded? If the later, > > > which patch superseded it? > > > > > > Thanks. > > > > > > [0] https://nvd.nist.gov/vuln/detail/CVE-2022-45886 > > > > Have these issues been fixed already? > > > > If not, is this patch set due to be merged or reviewed? > > Still nothing heard from the author or any maintainer. We're currently lacking a sub-maintainer for dvb. Changes at the DVB mutexes have been problematic and require tests on some devices, specially on those with multiple frontends. I'll try to find some time to review and test those patches. > > I'd take this as a hint if I had any social skills! > > Please could someone provide me with a status report on these patches? > > They appear to have CVEs associated with them. Have they been fixed? > > -- > Lee Jones [李琼斯] Thanks, Mauro
On Tue, Mar 07, 2023 at 09:57:13PM +0900, Hyunwoo Kim wrote: > ttusb_dec is a comment for patch #4 in the series. > And as102 is the #1 patch. > > > Regards, > Hyunwoo Kim I was using the wrong email client and the mailing list didn't get sent, sorry. Resend the mail for the mailing list. > > > 2023년 3월 7일 (화) 오후 9:41, Mauro Carvalho Chehab <mchehab@kernel.org>님이 작성: > > > Em Wed, 16 Nov 2022 20:59:21 -0800 > > Hyunwoo Kim <imv4bel@gmail.com> escreveu: > > > > > Dear, > > > > > > This patch set is a security patch for various race condition > > vulnerabilities that occur > > > in 'dvb-core' and 'ttusb_dec', a dvb-based device driver. > > > > > > > > > # 1. media: dvb-core: Fix use-after-free due to race condition occurring > > in dvb_frontend > > > This is a security patch for a race condition that occurs in the > > dvb_frontend system of dvb-core. > > > > > > The race condition that occurs here will occur with _any_ device driver > > using dvb_frontend. > > > > > > The race conditions that occur in dvb_frontend are as follows > > > (Description is based on drivers/media/usb/as102/as102_drv.c using > > dvb_frontend): > > > ``` > > > cpu0 cpu1 > > > 1. open() > > > dvb_frontend_open() > > > dvb_frontend_get() // kref : 3 > > > > > > > > > 2. > > as102_usb_disconnect() > > > > > as102_dvb_unregister() > > > > > dvb_unregister_frontend() > > > > > dvb_frontend_put() // kref : 2 > > > > > dvb_frontend_detach() > > > > > dvb_frontend_put() // kref : 1 > > > 3. close() > > > __fput() > > > dvb_frontend_release() > > > dvb_frontend_put() // kref : 0 > > > dvb_frontend_free() > > > __dvb_frontend_free() > > > dvb_free_device() > > > kfree (dvbdev->fops); > > > ... > > > fops_put(file->f_op); // UAF!! > > > > Hmm... you're mentioning ttusb_dec at the comment, but here you're showing > > the race for as102, which is a different driver. > > > > I'm confused. > > > > > > Thanks, > > Mauro > >
On Thu, 09 Mar 2023, Mauro Carvalho Chehab wrote: > Em Tue, 7 Mar 2023 10:36:59 +0000 > Lee Jones <lee@kernel.org> escreveu: > > > On Tue, 28 Feb 2023, Lee Jones wrote: > > > > > On Wed, 22 Feb 2023, Lee Jones wrote: > > > > > > > On Tue, 10 Jan 2023, Takashi Iwai wrote: > > > > > > > > > On Thu, 17 Nov 2022 05:59:21 +0100, > > > > > Hyunwoo Kim wrote: > > > > > > > > > > > > Dear, > > > > > > > > > > > > This patch set is a security patch for various race condition vulnerabilities that occur > > > > > > in 'dvb-core' and 'ttusb_dec', a dvb-based device driver. > > > > > > > > > > > > > > > > > > # 1. media: dvb-core: Fix use-after-free due to race condition occurring in dvb_frontend > > > > > > This is a security patch for a race condition that occurs in the dvb_frontend system of dvb-core. > > > > > > > > > > > > The race condition that occurs here will occur with _any_ device driver using dvb_frontend. > > > > > > > > > > > > The race conditions that occur in dvb_frontend are as follows > > > > > > > > [...] > > > > > > > > > > # 4. media: ttusb-dec: Fix memory leak in ttusb_dec_exit_dvb() > > > > > > This is a patch for a memory leak that occurs in the ttusb_dec_exit_dvb() function. > > > > > > > > > > > > Because ttusb_dec_exit_dvb() does not call dvb_frontend_detach(), > > > > > > several fe related structures are not kfree()d. > > > > > > > > > > > > Users can trigger a memory leak just by repeating connecting and disconnecting > > > > > > the ttusb_dec device. > > > > > > > > > > > > > > > > > > Finally, most of these patches are similar to this one, the security patch for > > > > > > CVE-2022-41218 that I reported: > > > > > > https://lore.kernel.org/linux-media/20221031100245.23702-1-tiwai@suse.de/ > > > > > > > > > > > > > > > > > > Regards, > > > > > > Hyunwoo Kim > > > > > > > > > > Are those issues still seen with the latest 6.2-rc kernel? > > > > > I'm asking because there have been a few fixes in dvb-core to deal > > > > > with some UAFs. > > > > > > > > > > BTW, Mauro, the issues are tagged with several CVE's: > > > > > CVE-2022-45884, CVE-2022-45886, CVE-2022-45885, CVE-2022-45887. > > > > > > > > Was there an answer to this question? > > > > > > > > Rightly or wrongly this patch is still being touted as the fix for some > > > > reported CVEs [0]. > > > > > > > > Is this patch still required or has it been superseded? If the later, > > > > which patch superseded it? > > > > > > > > Thanks. > > > > > > > > [0] https://nvd.nist.gov/vuln/detail/CVE-2022-45886 > > > > > > Have these issues been fixed already? > > > > > > If not, is this patch set due to be merged or reviewed? > > > > Still nothing heard from the author or any maintainer. > > We're currently lacking a sub-maintainer for dvb. Changes at the > DVB mutexes have been problematic and require tests on some > devices, specially on those with multiple frontends. > > I'll try to find some time to review and test those patches. Thank you Mauro, I fully appreciate the struggles and the effort. > > I'd take this as a hint if I had any social skills! > > > > Please could someone provide me with a status report on these patches? > > > > They appear to have CVEs associated with them. Have they been fixed? > > Thanks, > Mauro -- Lee Jones [李琼斯]
On Wed, 08 Mar 2023, Hyunwoo Kim wrote: > On Tue, Mar 07, 2023 at 09:57:13PM +0900, Hyunwoo Kim wrote: > > ttusb_dec is a comment for patch #4 in the series. > > And as102 is the #1 patch. > > > > > > Regards, > > Hyunwoo Kim > > I was using the wrong email client and the mailing list didn't get sent, sorry. > > Resend the mail for the mailing list. Please can you reply in-line - below the quote(s) you are replying to. Then snip the rest. > > 2023년 3월 7일 (화) 오후 9:41, Mauro Carvalho Chehab <mchehab@kernel.org>님이 작성: > > > > > Em Wed, 16 Nov 2022 20:59:21 -0800 > > > Hyunwoo Kim <imv4bel@gmail.com> escreveu: > > > > > > > Dear, > > > > > > > > This patch set is a security patch for various race condition > > > vulnerabilities that occur > > > > in 'dvb-core' and 'ttusb_dec', a dvb-based device driver. > > > > > > > > > > > > # 1. media: dvb-core: Fix use-after-free due to race condition occurring > > > in dvb_frontend > > > > This is a security patch for a race condition that occurs in the > > > dvb_frontend system of dvb-core. > > > > > > > > The race condition that occurs here will occur with _any_ device driver > > > using dvb_frontend. > > > > > > > > The race conditions that occur in dvb_frontend are as follows > > > > (Description is based on drivers/media/usb/as102/as102_drv.c using > > > dvb_frontend): > > > > ``` > > > > cpu0 cpu1 > > > > 1. open() > > > > dvb_frontend_open() > > > > dvb_frontend_get() // kref : 3 > > > > > > > > > > > > 2. > > > as102_usb_disconnect() > > > > > > > as102_dvb_unregister() > > > > > > > dvb_unregister_frontend() > > > > > > > dvb_frontend_put() // kref : 2 > > > > > > > dvb_frontend_detach() > > > > > > > dvb_frontend_put() // kref : 1 > > > > 3. close() > > > > __fput() > > > > dvb_frontend_release() > > > > dvb_frontend_put() // kref : 0 > > > > dvb_frontend_free() > > > > __dvb_frontend_free() > > > > dvb_free_device() > > > > kfree (dvbdev->fops); > > > > ... > > > > fops_put(file->f_op); // UAF!! > > > > > > Hmm... you're mentioning ttusb_dec at the comment, but here you're showing > > > the race for as102, which is a different driver. > > > > > > I'm confused. > > > > > > > > > Thanks, > > > Mauro > > > -- Lee Jones [李琼斯]
Hi Lee, Em Thu, 9 Mar 2023 17:17:14 +0000 Lee Jones <lee@kernel.org> escreveu: > > > Still nothing heard from the author or any maintainer. > > > > We're currently lacking a sub-maintainer for dvb. Changes at the > > DVB mutexes have been problematic and require tests on some > > devices, specially on those with multiple frontends. > > > > I'll try to find some time to review and test those patches. > > Thank you Mauro, I fully appreciate the struggles and the effort. It took more time than I originally anticipated, as I had to setup a way to test it here with some DVB-T devices, but I reviewed the code and tested it. I'm placing the patches I picked at this series: https://lore.kernel.org/lkml/53558de2b5c4f4ee6bfcfbe34e27071c2d0073d5.1684000646.git.mchehab@kernel.org/T/#t They seemed to work fine. I tested using two devices: USB ID 2013:0246 PCTV Systems PCTV 74E USB ID 2040:5200 Hauppauge NovaT 500Stick The second one has two DVB-T independent devices on it. I did some tests of removing and re-inserting them with the devices closed and with the device opened and streamed. I didn't find any regressions. I didn't try to use kmemleak or KASAN to detect UAF conditions, though. Regards, Mauro
Em Sat, 13 May 2023 19:09:01 +0100 Mauro Carvalho Chehab <mchehab@kernel.org> escreveu: > Hi Lee, > > Em Thu, 9 Mar 2023 17:17:14 +0000 > Lee Jones <lee@kernel.org> escreveu: > > > > > Still nothing heard from the author or any maintainer. > > > > > > We're currently lacking a sub-maintainer for dvb. Changes at the > > > DVB mutexes have been problematic and require tests on some > > > devices, specially on those with multiple frontends. > > > > > > I'll try to find some time to review and test those patches. > > > > Thank you Mauro, I fully appreciate the struggles and the effort. > > It took more time than I originally anticipated, as I had to setup > a way to test it here with some DVB-T devices, but I reviewed the > code and tested it. > > I'm placing the patches I picked at this series: > > https://lore.kernel.org/lkml/53558de2b5c4f4ee6bfcfbe34e27071c2d0073d5.1684000646.git.mchehab@kernel.org/T/#t > > They seemed to work fine. I tested using two devices: > > USB ID 2013:0246 PCTV Systems PCTV 74E > USB ID 2040:5200 Hauppauge NovaT 500Stick > > The second one has two DVB-T independent devices on it. > > I did some tests of removing and re-inserting them with the > devices closed and with the device opened and streamed. I didn't > find any regressions. I didn't try to use kmemleak or KASAN to > detect UAF conditions, though. Did some tests today: neither KASAN nor kmemleak pointed any issue. I found a few issues on one of the patches: some mutex unbalance at dvb_frontend at the error path. Already updated the patches to fix it. Should be merging at the media subsystem today and send a PR upstream along the next week with the fixes. Regards, Mauro