Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unaligned memory access in the _sha3 extension #80696

Closed
doko42 opened this issue Apr 3, 2019 · 4 comments
Closed

unaligned memory access in the _sha3 extension #80696

doko42 opened this issue Apr 3, 2019 · 4 comments
Assignees
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@doko42
Copy link
Member

doko42 commented Apr 3, 2019

BPO 36515
Nosy @doko42, @gpshead, @tiran, @miss-islington
PRs
  • bpo-36515: Disable unaligned memory access in _sha3 on ARM #25927
  • [3.9] bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927) (GH-25928) #25928
  • [3.10] bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927) #25930
  • Files
  • arm-alignment.diff: patch
  • 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/gpshead'
    closed_at = <Date 2021-05-06.06:57:39.924>
    created_at = <Date 2019-04-03.05:41:18.990>
    labels = ['extension-modules', '3.10', '3.9', 'type-crash', '3.11']
    title = 'unaligned memory access in the _sha3 extension'
    updated_at = <Date 2021-05-06.06:57:39.923>
    user = 'https://github.com/doko42'

    bugs.python.org fields:

    activity = <Date 2021-05-06.06:57:39.923>
    actor = 'christian.heimes'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2021-05-06.06:57:39.924>
    closer = 'christian.heimes'
    components = ['Extension Modules']
    creation = <Date 2019-04-03.05:41:18.990>
    creator = 'doko'
    dependencies = []
    files = ['48243']
    hgrepos = []
    issue_num = 36515
    keywords = ['patch']
    message_count = 4.0
    messages = ['339379', '393032', '393047', '393063']
    nosy_count = 4.0
    nosy_names = ['doko', 'gregory.p.smith', 'christian.heimes', 'miss-islington']
    pr_nums = ['25927', '25928', '25930']
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue36515'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @doko42
    Copy link
    Member Author

    doko42 commented Apr 3, 2019

    This was seen when running an armhf binary on a 64bit kernel. The problem is that the implementation uses unaligned memory accesses, and even is well aware of that. The module allows misaligned memory accesses by default. The NO_MISALIGNED_ACCESSES macro is never defined. Now you can define it only on architectures where unaligned memory accesses are not allowed (ARM32 on 64bit kernels), or where there are performance penalties (AArch64), or just don't try to outsmart modern compilers and always define this macro.

    The attached patch only fixes the issue on ARM32 and AArch64, however the safe fix should be to always define the macro.

    @doko42 doko42 added 3.7 (EOL) end of life 3.8 only security fixes extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump labels Apr 3, 2019
    @gpshead gpshead added 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels May 5, 2021
    @gpshead
    Copy link
    Member

    gpshead commented May 5, 2021

    that patch looks fine, i'll turn it into a PR.

    @gpshead gpshead assigned gpshead and unassigned tiran May 5, 2021
    @miss-islington
    Copy link
    Contributor

    New changeset 3b2a45f by Miss Islington (bot) in branch '3.10':
    bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927)
    3b2a45f

    @tiran
    Copy link
    Member

    tiran commented May 6, 2021

    New changeset ce47add by Miss Islington (bot) in branch '3.9':
    [3.9] bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927) (GH-25928)
    ce47add

    @tiran tiran removed 3.7 (EOL) end of life 3.8 only security fixes labels May 6, 2021
    @tiran tiran closed this as completed May 6, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants