From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBCF4C433F5 for ; Tue, 1 Mar 2022 06:43:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 754D38D0002; Tue, 1 Mar 2022 01:43:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7040F8D0001; Tue, 1 Mar 2022 01:43:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F31E8D0002; Tue, 1 Mar 2022 01:43:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 4F64C8D0001 for ; Tue, 1 Mar 2022 01:43:05 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 17E0B1351 for ; Tue, 1 Mar 2022 06:43:05 +0000 (UTC) X-FDA: 79194875130.13.58B0B65 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf31.hostedemail.com (Postfix) with ESMTP id 9DF9820002 for ; Tue, 1 Mar 2022 06:43:04 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id q17so20636072edd.4 for ; Mon, 28 Feb 2022 22:43:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8IqwMuZ8fxt+QmrdqHOlImG77CSzeOXAfU3F7s/g1es=; b=Zt7ADjjg4rQdQMZupIjoQnW8OZzkrW1QqynxdshmIEkct/PUWuc8mHmtaLMl7SRf4j O/SsyFxp+cXtdodgFZY1yMgZ2bgTQgu4U8POD6AExh1V8MJIq3bb7qef796sT4BUC6Vq 2dGy0L5SzrT/5p9DN1SjVbc8UkJUnWYEDpsOv6Fszv3rzZ728aXUFTHimB0CAxkBX4DX xrufVPSLR9vwBy1h/CSAOqSR+pgCZyQ+7DUcXmZjFeG9I0KcBRC82y7KxWo00HF556jR M4UWSK1tWyrR/CgjgF6TF8QOCgtuVLdDxoUX7rPxIEp1+gTuWTERDx1fKUxHvoWeI9qA 5XoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8IqwMuZ8fxt+QmrdqHOlImG77CSzeOXAfU3F7s/g1es=; b=UTgp9vBlaNuPzQP+zEn2sjJgBKD9lW9l18k/jlobNjo/jfjs4C/bGHpnzLHm+cJ2bH t89PwtBFgGAa7ZljYcefVZmfam2UDjZ5+yqhmmexKPdrXnXzTqUCX/XTkXQkJ3/lKlAx jiWVnyowcn8d76YYDNHBBuTC4EEdm6h+6Ym+YKTS3bA84q4JGOLje6c1XiNwiDr12qAs E/Z0nB0huGtzk1FLzsroJZ2lT1UJo2wjhJT/1weZxF3agOARYGDi3XL4m/hVKW6p1Z9S FxY0EDohvBNe7Eo0UxTefTHEj++aoSJeRotr6lrnT3qMJQjY4DRHhq13QcjU/zZZ/lKI 4A7w== X-Gm-Message-State: AOAM5333aRyQn6WT5yLgw0F+B+Z5ZfR0Uw7y7qmA8Gqim8n9+zX4OY6i 0O5qDHF6U3ac4qDwY4wnZ+ZdwPdxQLUwq9WFN8KwoA== X-Google-Smtp-Source: ABdhPJzgEhCVEPSEh42pl5bgolf24c2VjNrVdrJH7yCpF+rJiuGUvKUvHAmfssDpqzWoeXIVZ0eqJZpsefLLCWPpQLc= X-Received: by 2002:a05:6402:375:b0:404:c2be:3b8c with SMTP id s21-20020a056402037500b00404c2be3b8cmr22490537edw.247.1646116983110; Mon, 28 Feb 2022 22:43:03 -0800 (PST) MIME-Version: 1.0 References: <20220224054332.1852813-1-keescook@chromium.org> <202202232208.B416701@keescook> <20220224091550.2b7e8784@gandalf.local.home> <20220228232131.4b9cee32@rorschach.local.home> In-Reply-To: <20220228232131.4b9cee32@rorschach.local.home> From: Daniel Latypov Date: Mon, 28 Feb 2022 22:42:51 -0800 Message-ID: Subject: Re: [PATCH] binfmt_elf: Introduce KUnit test To: Steven Rostedt Cc: Kees Cook , Eric Biederman , David Gow , Alexey Dobriyan , =?UTF-8?B?TWFnbnVzIEdyb8Of?= , kunit-dev@googlegroups.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 9DF9820002 X-Stat-Signature: mpo3z4k548rm5ruua1xfwzsdwdxiqj9e Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Zt7ADjjg; spf=pass (imf31.hostedemail.com: domain of dlatypov@google.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=dlatypov@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1646116984-98403 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 28, 2022 at 8:21 PM Steven Rostedt wrote: > > On Mon, 28 Feb 2022 17:48:27 -0800 > Daniel Latypov wrote: > > > He also prototyped a more intrusive alternative to using ftrace and > > kernel livepatch since they don't work on all arches, like UML. > > Perhaps instead of working on a intrusive alternative on archs that do > not support live kernel patching, implement live kernel patching on > those archs! ;-) > > It's probably the same amount of work. Well, really, you only need to > implement the klp_arch_set_pc(fregs, new_function); part. Yeah, that's the only bit we'd need to get working. I called this out in "Open questions:" bit on https://kunit-review.googlesource.com/c/linux/+/5109 As for the amount of work, I know how to do KUnit-y things, I have no idea how to do livepatch things :) Also, we're not aiming for something as "magic" as the ftrace one. David's patch is here: https://kunit-review.googlesource.com/c/linux/+/5129 Here's a snippet from the example in that one: static int add_one(int i) { /* This will trigger the stub if active. */ KUNIT_TRIGGER_STATIC_STUB(add_one, i); return i + 1; } i.e. users just add this one macro in with and . It internally expands to roughly if () So it's all quite simple. But it'd definitely be interesting to try and get klp_arch_set_pc() working on UML if that's a possibility! Speaking from ignorance, I can see this either being somewhat simple or very painful. > > -- Steve