[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOw6vbJwbvcVARNmx3O7mTbOr+A_Vo_DaUXFfN8HFFLqdG-VPQ@mail.gmail.com>
Date: Fri, 20 Jun 2025 10:41:03 -0400
From: Sean Paul <seanpaul@...omium.org>
To: Jim Cromie <jim.cromie@...il.com>
Cc: jbaron@...mai.com, gregkh@...uxfoundation.org, ukaszb@...omium.org,
louis.chauvet@...tlin.com, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
intel-gvt-dev@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
daniel.vetter@...ll.ch, tvrtko.ursulin@...ux.intel.com, jani.nikula@...el.com,
ville.syrjala@...ux.intel.com
Subject: Re: [PATCH v3 28/54] dyndbg: restore classmap protection when theres
a controlling_param
On Thu, Apr 3, 2025 at 9:48 AM Jim Cromie <jim.cromie@...il.com> wrote:
>
\snip
>
> -static void ddebug_match_apply_kparam(const struct kernel_param *kp,
> - const struct _ddebug_class_map *map,
> - const char *mod_name)
> +static struct _ddebug_class_param *
> +ddebug_get_classmap_kparam(const struct kernel_param *kp,
> + const struct _ddebug_class_map *map)
> {
> struct _ddebug_class_param *dcp;
>
> if (kp->ops != ¶m_ops_dyndbg_classes)
> - return;
> + return false;
Return type is struct _ddebug_class_param *, should this be NULL?
>
> dcp = (struct _ddebug_class_param *)kp->arg;
>
> - if (map == dcp->map) {
> + return (map == dcp->map)
> + ? dcp : (struct _ddebug_class_param *)NULL;
> +}
> +
> +static void ddebug_match_apply_kparam(const struct kernel_param *kp,
> + struct _ddebug_class_map *map,
> + const char *mod_name)
> +{
> + struct _ddebug_class_param *dcp = ddebug_get_classmap_kparam(kp, map);
> +
> + if (dcp) {
> + map->controlling_param = dcp;
> v2pr_info(" kp:%s.%s =0x%lx", mod_name, kp->name, *dcp->bits);
> vpr_cm_info(map, " %s mapped to: ", mod_name);
> ddebug_sync_classbits(kp, mod_name);
> }
> }
>
> -static void ddebug_apply_params(const struct _ddebug_class_map *cm, const char *mod_name)
> +static void ddebug_apply_params(struct _ddebug_class_map *cm, const char *mod_name)
> {
> const struct kernel_param *kp;
> #if IS_ENABLED(CONFIG_MODULES)
> @@ -1266,6 +1288,13 @@ static void ddebug_apply_params(const struct _ddebug_class_map *cm, const char *
> }
> }
>
> +/*
> + * called from add_module, ie early. it can find controlling kparams,
> + * which can/does? enable protection of this classmap from class-less
> + * queries, on the grounds that the user created the kparam, means to
> + * use it, and expects it to reflect reality. We should oblige him,
> + * and protect those classmaps from classless "-p" changes.
> + */
> static void ddebug_apply_class_maps(const struct _ddebug_info *di)
> {
> struct _ddebug_class_map *cm;
> --
> 2.49.0
>
Powered by blists - more mailing lists