Re: [PATCH] staging: Fix missing warning/taint on builtin code
From: Dan Carpenter
Date: Tue Jul 02 2024 - 09:46:07 EST
On Tue, Jul 02, 2024 at 02:44:31AM -0300, Ágatha Isabelle Chris Moreira Guedes wrote:
> diff --git a/init/main.c b/init/main.c
> index 206acdde51f5..fca889f3bcc0 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1602,3 +1602,23 @@ static noinline void __init kernel_init_freeable(void)
>
> integrity_load_keys();
> }
> +
> +#ifdef CONFIG_STAGING
> +/**
> + * staging_init_taint() - We need to taint the kernel whenever staging code
> + * is initialized (from built-in drivers) or loaded (as modules) and issue
> + * a warning the first time it happens.
> + */
> +void staging_taint(const char *code_id, bool module)
> +{
> + char *code_type = module ? "module" : "builtin driver at";
> +
> + pr_warn("%s %s: The kernel contains code from staging directory"
Needs a space after directory before the quote.
> + "the quality is unknown, you have been warned.\n",
> + code_type, code_id);
> +
> + add_taint(TAINT_CRAP, LOCKDEP_STILL_OK);
> +}
> +EXPORT_SYMBOL(staging_taint);
regards,
dan carpenter