From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 830F578F58; Tue, 28 Jan 2025 21:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738100687; cv=none; b=rDZITPnB88EQFGJI7AZrgjF9lXurHpRYsampqVuLs/3LCliiPTyeI7QgcVUV2kdcr/tpCVRvMbLqpvlTvlACZdhVHxH0rfPj1dbbBLiMf8nP/+I64Kscr99zX/b+BA5lonHoGPiFvwjQo0s+YQv9gNBGT7mQzWuAiHQN/hZ07aA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738100687; c=relaxed/simple; bh=/ZVfTjb6OB6mwOq5oov2dfGCKk9jKalsU95smqbbt3M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sHmt/BIyerDtUkTGM4fGzezct0pZPacMYTYauJzNQmw9h//CPvipm4X39ECeKl3FEWh7cBsCN3ctIgGn12Ky/uDWgSiqtupBr4Mz3sU0pWJXYhvYR56Rru4GKeyJWbWYASjizo9NQfhC6tDmE0WRbsIqIGcKnmDt1Ktz5sIZMno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=e9DpxoKe; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="e9DpxoKe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1738100682; bh=/ZVfTjb6OB6mwOq5oov2dfGCKk9jKalsU95smqbbt3M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e9DpxoKedhbbEEwT6cJk8l+hJKEnzOeN6eIPyv+mEHwWnhhERrdM7T12crNn9FfXZ m4IK1QIwqBd37RjmvZrFW7U8x2uk8y3GejhrhiXglitMco3yIU9suq3SQzK6imzfZy 9/bMPULruTldNrbPcRild5kQvmhlE8fR6BEDF0b4= Date: Tue, 28 Jan 2025 22:44:42 +0100 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Daniel Gomez Cc: Luis Chamberlain , Petr Pavlu , Sami Tolvanen , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, iovisor-dev@lists.iovisor.org, gost.dev@samsung.com Subject: Re: [PATCH 1/2] module: allow for module error injection Message-ID: <559c6c43-e081-454b-9e87-c30600a97ae1@t-8ch.de> References: <20250122-modules-error-injection-v1-0-910590a04fd5@samsung.com> <20250122-modules-error-injection-v1-1-910590a04fd5@samsung.com> Precedence: bulk X-Mailing-List: linux-modules@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250122-modules-error-injection-v1-1-910590a04fd5@samsung.com> On 2025-01-22 14:11:13+0100, Daniel Gomez wrote: > Allow to test kernel module initialization with eBPF error injection > by forcing errors when any of the below annotated functions with > ALLOW_ERROR_INJECTION() return. > > Allow to debug and test module load error behaviour when: > > complete_formation(): when module initialization switches from > MODULE_STATE_UNFORMED to MODULE_STATE_COMING stage. > > do_init_module(): when an error occurs during module initialization and > before we switch from MODULE_STATE_COMING to MODULE_STATE_LIVE stage. > > module_enable_rodata_ro_after_init(): when an error occurs while > setting memory to RO after module initialization. This is when module > initialization reaches MODULE_STATE_LIVE stage. > > Signed-off-by: Daniel Gomez > --- > kernel/module/main.c | 3 +++ > kernel/module/strict_rwx.c | 2 ++ > 2 files changed, 5 insertions(+) > > diff --git a/kernel/module/main.c b/kernel/module/main.c > index 1fb9ad289a6f8f328fc37c6d93730882d0e6e613..54e6c4d0aab23ae5001a52c26417e7e7957ea3fd 100644 > --- a/kernel/module/main.c > +++ b/kernel/module/main.c > @@ -59,6 +59,7 @@ > #include > #include > #include > +#include This should be , no? > #include > #include "internal.h" > > @@ -3089,6 +3090,7 @@ static noinline int do_init_module(struct module *mod) > > return ret; > } > +ALLOW_ERROR_INJECTION(do_init_module, ERRNO); > > static int may_init_module(void) > { > @@ -3225,6 +3227,7 @@ static int complete_formation(struct module *mod, struct load_info *info) > mutex_unlock(&module_mutex); > return err; > } > +ALLOW_ERROR_INJECTION(complete_formation, ERRNO); > > static int prepare_coming_module(struct module *mod) > {