Re: [PATCH v2] genirq: procfs: Make smp_affinity read-only for interrupts that userspace can't set

jeff.xie
2024-08-26T11:27:05Z

August 26, 2024 at 6:55 PM, "Thomas Gleixner" <tglx@linutronix.de> wrote:

>
> On Sun, Aug 25 2024 at 21:19, Jeff Xie wrote:
>
> >
> > The kernel already knows at the time of interrupt allocation that the
> >
> > affinity cannot be controlled by userspace and therefore creating the
> >
> > file with write permissions is wrong.
> >
> > Therefore set the file permissions to read-only for such interrupts.
> >
> > Signed-off-by: Jeff Xie <jeff.xie@linux.dev>
> >
> > ---
> >
> > v2:
> >
> > - Updated the description suggested by tglx
> >
> > - Corrected the return value from -EIO to -EPERM when the userspace can't set the affinity
> >
> > kernel/irq/proc.c | 10 +++++++---
> >
> > 1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
> >
> > index 8cccdf40725a..7b3a4c92d148 100644
> >
> > --- a/kernel/irq/proc.c
> >
> > +++ b/kernel/irq/proc.c
> >
> > @@ -142,7 +142,7 @@ static ssize_t write_irq_affinity(int type, struct file *file,
> >
> > int err;
> >
> >
> >
> > if (!irq_can_set_affinity_usr(irq) || no_irq_affinity)
> >
> > - return -EIO;
> >
> > + return -EPERM;
> >
>
> I drop this hunk as it is unrelated to $subject. That want's to be a
>
> separate patch. Documentation/process clearly states:
>
> Solve only one problem per patch.

Thank you for the reminder. I overlooked that single line change, which is indeed unrelated to the subject. I'll send it as a separate patch.

> Thanks,
>
> tglx
>