lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <040d238e73a155789ff3cf2e6c70bbc27991cb81.camel@redhat.com>
Date:   Thu, 17 Nov 2022 15:58:24 +0100
From:   Paolo Abeni <pabeni@...hat.com>
To:     Dmitry Vyukov <dvyukov@...gle.com>
Cc:     bongsu.jeon@...sung.com, krzysztof.kozlowski@...aro.org,
        netdev@...r.kernel.org, syzkaller@...glegroups.com,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net-next] NFC: nci: Extend virtual NCI deinit test

On Thu, 2022-11-17 at 14:47 +0100, Dmitry Vyukov wrote:
> On Thu, 17 Nov 2022 at 13:47, Paolo Abeni <pabeni@...hat.com> wrote:
> > 
> > On Tue, 2022-11-15 at 10:59 +0100, Dmitry Vyukov wrote:
> > > Extend the test to check the scenario when NCI core tries to send data
> > > to already closed device to ensure that nothing bad happens.
> > > 
> > > Signed-off-by: Dmitry Vyukov <dvyukov@...gle.com>
> > > Cc: Bongsu Jeon <bongsu.jeon@...sung.com>
> > > Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> > > Cc: Jakub Kicinski <kuba@...nel.org>
> > > Cc: netdev@...r.kernel.org
> > > ---
> > >  tools/testing/selftests/nci/nci_dev.c | 10 ++++++++++
> > >  1 file changed, 10 insertions(+)
> > > 
> > > diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c
> > > index 162c41e9bcae8..272958a4ad102 100644
> > > --- a/tools/testing/selftests/nci/nci_dev.c
> > > +++ b/tools/testing/selftests/nci/nci_dev.c
> > > @@ -888,6 +888,16 @@ TEST_F(NCI, deinit)
> > >                          &msg);
> > >       ASSERT_EQ(rc, 0);
> > >       EXPECT_EQ(get_dev_enable_state(&msg), 0);
> > > +
> > > +     // Test that operations that normally send packets to the driver
> > > +     // don't cause issues when the device is already closed.
> > > +     // Note: the send of NFC_CMD_DEV_UP itself still succeeds it's just
> > > +     // that the device won't actually be up.
> > > +     close(self->virtual_nci_fd);
> > > +     self->virtual_nci_fd = -1;
> > 
> > I think you need to handle correctly negative value of virtual_nci_fd
> > in FIXTURE_TEARDOWN(NCI), otherwise it should trigger an assert on
> > pthread_join() - read() operation will fail in virtual_deinit*()
> 
> Hi Paolo,
> 
> In this test we also set self->open_state = 0. This will make
> FIXTURE_TEARDOWN(NCI) skip all of the deinit code. It will still do
> close(self->virtual_nci_fd) w/o checking the return value. So it will
> be close(-1), which will return an error, but we won't check it.

Thanks for the pointer. The code looks indeed correct.

And sorry for the late nit picking, but I guess it's better to avoid
the '//' comment marker and use instead the multi-line ones.

Thanks!

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ