Skip to content

/proc/sys/kernel/spl/hostid broken on recent (5.7+) kernels #11878

Closed
@nabijaczleweli

Description

@nabijaczleweli

System information

Type Version/Name
Distribution Name Debian
Distribution Version sid, mostly up-to-date as of Sun 11 Apr 00:35:52 CEST 2021
Linux Kernel Linux szarotka 5.10.0-5-amd64 #1 SMP Debian 5.10.24-1 (2021-03-19) x86_64 GNU/Linux
Architecture x32
ZFS Version 2.0.3-6

Describe the problem you're observing

All reads on /proc/sys/kernel/spl/hostid return -EFAULT, tracked this back to this mainline commit with a v5.7-rc1-4-g32927393dc1c describe:

commit 32927393dc1ccd60fb2bdc05b9e8e88753761469
Author: Christoph Hellwig <[email protected]>
Date:   Fri Apr 24 08:43:38 2020 +0200

    sysctl: pass kernel pointers to ->proc_handler

    Instead of having all the sysctl handlers deal with user pointers, which
    is rather hairy in terms of the BPF interaction, copy the input to and
    from  userspace in common code.  This also means that the strings are
    always NUL-terminated by the common code, making the API a little bit
    safer.

    As most handler just pass through the data to one of the common handlers
    a lot of the changes are mechnical.

    Signed-off-by: Christoph Hellwig <[email protected]>
    Acked-by: Andrey Ignatov <[email protected]>
    Signed-off-by: Al Viro <[email protected]>

This makes the access_ok() in copy_to_user() in proc_copyout_string() in proc_dohostid() fail, since ubuffer is kernel memory now – proc_dostring() just does a memcpy.

This is the only affected path, since all others delegate to kernel's proc_do*() functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Triage NeededNew issue which needs to be triagedType: DefectIncorrect behavior (e.g. crash, hang)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions