Skip to content

test_aead_aes_gcm fails on Kernel 4.9 #73510

Closed

Description

@tiran
BPO 29324
Nosy @warsaw, @nascheme, @vstinner, @tiran, @matejcik, @stratakis
PRs
  • bpo-29324 update test_socket AEAD test for kernel 4.9 and up #133
  • Files
  • test_socket_aead_kernel49.patch: updating AEAD test for kernel 4.9
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tiran'
    closed_at = <Date 2017-06-09.21:30:06.580>
    created_at = <Date 2017-01-19.15:01:06.592>
    labels = ['extension-modules', 'type-bug', '3.7']
    title = 'test_aead_aes_gcm fails on Kernel 4.9'
    updated_at = <Date 2017-10-09.15:28:12.017>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2017-10-09.15:28:12.017>
    actor = 'vstinner'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2017-06-09.21:30:06.580>
    closer = 'nascheme'
    components = ['Extension Modules']
    creation = <Date 2017-01-19.15:01:06.592>
    creator = 'christian.heimes'
    dependencies = []
    files = ['46494']
    hgrepos = []
    issue_num = 29324
    keywords = ['patch']
    message_count = 14.0
    messages = ['285794', '285797', '286808', '286811', '287509', '287614', '287616', '287902', '287943', '295561', '295569', '295583', '295621', '303976']
    nosy_count = 6.0
    nosy_names = ['barry', 'nascheme', 'vstinner', 'christian.heimes', 'matejcik', 'cstratak']
    pr_nums = ['133']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue29324'
    versions = ['Python 3.6', 'Python 3.7']

    Activity

    1. tiran commented on Jan 19, 2017

      @tiran
      MemberAuthor
      $ ./python -m test -m test_aead_aes_gcm test_socket
      Run tests sequentially
      0:00:00 [1/1] test_socket
      test test_socket failed -- Traceback (most recent call last):
        File "/home/heimes/dev/python/cpython/Lib/test/support/__init__.py", line 556, in wrapper
          return func(*args, **kw)
        File "/home/heimes/dev/python/cpython/Lib/test/test_socket.py", line 5515, in test_aead_aes_gcm
          res = op.recv(assoclen + len(plain) + taglen)
      OSError: [Errno 22] Invalid argument

      The tests were written and passed under Linux Kernel 4.7. I was under the assumption that the API is stable. But the most recent version 4.9 has changed the API for AEAD mode slightly. libkcapi project maintain a well written documentation of the Kernel crypto API,
      smuellerDD/libkcapi@be242c3

      Fedora 24 and 25 are affected. I'm going to update the tests. Downstream distributors: Feel free to disable the test in the mean time. The feature is not critical.

    2. self-assigned this
      on Jan 19, 2017
    3. tiran commented on Jan 19, 2017

      @tiran
      MemberAuthor

      recv(64) works. I need to figure out why 64 and what's in the extra bytes.

    4. matejcik commented on Feb 2, 2017

      matejcikmannequin
      Mannequin

      The "'0' * taglen" part is now considered part of plaintext. Which makes a lot of sense :)
      Removing the "empty taglen" fixes the encryption part of the tests for me. Similarly, for the decryption test, we must only read and check the message without the tag.

    5. matejcik commented on Feb 2, 2017

      matejcikmannequin
      Mannequin

      the attached patch fixes the test for me

    6. vstinner commented on Feb 10, 2017

      @vstinner
      Member

      I confirm that test_socket pass with test_socket_aead_kernel49.patch on my Fedora 25 (kernel 4.9.5-200.fc25.x86_64).

      I would be nice to fix test_socket which is currently broken ;-)

    7. warsaw commented on Feb 11, 2017

      @warsaw
      Member

      Confirmed that test_socket_aead_kernel49.patch fixes the problem for Ubuntu 17.04. It'll probably fix it for Debian Stretch too give its kernel version number, but I haven't tested that yet.

    8. tiran commented on Feb 11, 2017

      @tiran
      MemberAuthor

      Thx Barry,

      I'll try to find some time to verify the new Kernel API and commit the patch early next week.

    9. vstinner commented on Feb 15, 2017

      @vstinner
      Member

      @matejcik: would you mind to create a pull request for your patch?

    10. vstinner commented on Feb 16, 2017

      @vstinner
      Member

      Even when the fix will be backported to Python 3.6, please keep the issue open until Christian Heimes has time to review the kernel changes. Copy/paste of his message on the PR#133:

      "I still haven't had time to study the changes in the Linux kernel. Let's merge the PR to silence the test error. Please leave the ticket open as reminder for me."

    11. nascheme commented on Jun 9, 2017

      @nascheme
      Member

      This patch works for me as well. Debian testing, kernel:
      Linux version 4.9.0-3-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170425 (Debian 6.3.0-16) ) #1 SMP Debian 4.9.25-1 (2017-05-02)

      In the 3.6.1 Python release, test_socket fails with:

      test test_socket failed -- Traceback (most recent call last):
        File "/home/nas/src/cpython/Lib/test/support/__init__.py", line 556, in wrapper
          return func(*args, **kw)
        File "/home/nas/src/cpython/Lib/test/test_socket.py", line 5497, in test_aead_aes_gcm
          res = op.recv(assoclen + len(plain) + taglen)
      OSError: [Errno 22] Invalid argument
    12. vstinner commented on Jun 9, 2017

      @vstinner
      Member

      The fix was also merged to master. It should be backported to 3.6. Neil, do
      you want to try to backport it?

    13. nascheme commented on Jun 9, 2017

      @nascheme
      Member

      This bug can be closed. The fix is in the master branch (commit 9764c15) and has also been backported to the "3.6" branch (git commit 4ac01f0). The fork for 3.6.1rc1 happened before the backport which is why 3.6.1 doesn't have the fix.

    14. vstinner commented on Jun 10, 2017

      @vstinner
      Member

      Oh ok, fine. Hopefully, 3.6.2 is coming in next days ;-)

    15. vstinner commented on Oct 9, 2017

      @vstinner
      Member

      FYI the merged fix is:

      commit 9764c15
      Author: matejcik <matejcik@gmail.com>
      Date: Thu Feb 16 14:41:31 2017 +0100

      update test_socket AEAD test for kernel 4.9 and up (#133)
      
    16. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.7 (EOL)end of lifeextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions