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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C134C433FE for ; Tue, 1 Mar 2022 06:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232694AbiCAGns (ORCPT ); Tue, 1 Mar 2022 01:43:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbiCAGnq (ORCPT ); Tue, 1 Mar 2022 01:43:46 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C2348E7E for ; Mon, 28 Feb 2022 22:43:04 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id x5so20612539edd.11 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=oUjx4f9L07eijD7DsJ0Qo1VZ2AixIV0gRCZWMHVSIvHMkycOpatFlocZsztDZ7i0pU ePNZ3Q2Yp3ZHoPTbH6O4OvyUFGfkuL1d2ySE6i0xBhNb8WUgEKRdRjNCSImkgkwRha0Q TYLkM0HxnxFM/A6A3BVC78BftnZyClKgc1dBeZKnkJsOGwBPjDRy0raJIN3Y06KB+WRO l7a+6HAK0pwneksc0HxDILXZ10Rltjn2JH6WlD9tOABI2WmPqJQTt2Fjq1teT/CIjPZM RHctql4wq8u0wVu4UKZT9Rj1wgP70Ow6Qg8Jwrus7pXP5gMm2SBdetDwGRkrCsWdJgiy igWw== X-Gm-Message-State: AOAM531+56XWuSLUxCCLR8q0v017EU1k5zHnmUCUGwzlwvZs7tD+523R 8Skmkmd0Ehc6uwGXLE47tNAPP7Vdbveb+HElQ/rcLw== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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