google / syzkaller

syzkaller is an unsupervised coverage-guided kernel fuzzer
Apache License 2.0
5.4k stars 1.23k forks source link

pkg/vcs: add more cherry-picks for Linux #4481

Open a-nogikh opened 10 months ago

a-nogikh commented 10 months ago

We cherry-pick some known fixes to make sure that older kernel revisions remain buildable and bootable by our infrastructure during bug bisections.

Thanks to @kaloronahuang for sharing the bigger list of such commits.

[
    {
        "fix_hash": "1d489151e9f9d1647110277ff77282fe4d96d09b",
        "fix_title": "objtool: Don't fail on missing symbol table"
    },
    {
        "fix_hash": "52a9dab6d892763b2a8334a568bd4e2c1a6fde66",
        "fix_title": "libsubcmd: Fix use-after-free for realloc(..., 0)"
    },
    {
        "fix_hash": "0711f0d7050b9e07c44bc159bbc64ac0a1022c7f",
        "fix_title": "pid: take a reference when initializing `cad_pid"
    },
    {
        "guilty_hash": "db2b0c5d7b6f19b3c2cab08c531b65342eb5252b",
        "fix_hash": "82880283d7fcd0a1d20964a56d6d1a5cc0df0713",
        "fix_title": "objtool: Fix truncated string warning"
    },
    {
        "fix_hash": "644106cdb89844be2496b21175b7c0c2e0fab381",
        "fix_title": "power: reset: ltc2952: Fix use of floating point literals"
    },
    {
        "fix_hash": "310780e825f3ffd211b479b8f828885a6faedd63",
        "fix_title": "usb: dwc2: hcd_queue: Fix use of floating point literal",
        "force_merge": true
    },
    {
        "fix_hash": "760f8522ce08a24abac3208290f93fe3fffc0d6c",
        "fix_title": "selinux: use kernel linux/socket.h for genheaders and mdp"
    },
    {
        "fix_hash": "1e1b6d63d6340764e00356873e5794225a2a03ea",
        "fix_title": "lib/string.c: implement stpcpy"
    }
]

We need to fill in some of the guilty_hash values and incorporate the list in pkg/vcs.

a-nogikh commented 4 weeks ago

One more cherry-pick to consider is

commit d772781964415c63759572b917e21c4f7ec08d9f
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Thu Jan 5 22:33:54 2023 -0800

    devlink: bump the instance index directly when iterating

that presumably fixes

commit c2368b19807affd7621f7c4638cd2e17fec13021
Author: Jiri Pirko <jiri@resnulli.us>
Date:   Fri Jul 29 09:10:35 2022 +0200

    net: devlink: introduce "unregistering" mark and use it during devlinks iteration

But I have a concern that the patch will likely not apply to all intermediate revisions: see this linux-stable discussion.

Our code, at the moment, does not seem to be in position to properly handle cherry-pick conflicts: https://github.com/google/syzkaller/blob/96eb609f6eb9558e2fab491a2c63a11bb0556471/pkg/vcs/linux_patches.go#L52-L55

git cherry-pick is not atomic, so it can apply some chunks and fail on others. We should either do cherry-pick --abort on a failure or checkpoint the repository before doing the cherry-pick with some other means, e.g. git stash.