Review Request 125717: initialize socket size with correct value

Harald Sitter sitter at kde.org
Tue Oct 20 05:23:26 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125717/
-----------------------------------------------------------

Review request for KDE Frameworks and Martin Klapetek.


Bugs: 351805
    https://bugs.kde.org/show_bug.cgi?id=351805


Repository: kwallet


Description
-------

to quote man 2 accept:
> The addrlen argument is a value-result argument: the caller must
> initialize it to contain the size (in bytes) of the structure pointed
> to by addr; on return it will contain the actual size of the peer
> address.

If addrlen is not correct we may get EINVAL on trying to connect to the
environment socket which in turn results in a broken environment of the
daemon when started through pam as it will inherit the DM environment.
This doesn't have to happen, it does however reproducibly with nvidia-352
on Kubuntu 15.10. Why or how nvidia plays into this is not entirely clear,
best bet is that it simply is a coincidence where nvidia would have
something allocated in the memory beforehand and since the addrlen
stack variable was not explicitly initialized to anything it would could
potentially be negative (EINVAL condition) or wrong such that it meets
an internal error check within accept().

BUG: 351805


Diffs
-----

  src/runtime/kwalletd/main.cpp 39b5ae97ae0984a9acb1efffa73e492f4b3e6a71 

Diff: https://git.reviewboard.kde.org/r/125717/diff/


Testing
-------

- got error with Kubuntu build of kwallet using nvidia driver
- applied patch
- no longer got error in multiple test runs
- removed patch and rebuilt kwallet
- error returns


Thanks,

Harald Sitter

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20151020/4874438e/attachment.html>


More information about the Kde-frameworks-devel mailing list