All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mete Durlu <meted@linux.ibm.com>
To: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Sumanth Korikkar <sumanthk@linux.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH 3/3] s390/diag: Add diag204 IOCTL to diag misc device
Date: Wed, 21 Oct 2026 16:12:39 +0200	[thread overview]
Message-ID: <64aee74d-a628-436a-8155-48fc3cf41a56@linux.ibm.com> (raw)
In-Reply-To: <atjFxOoK4GbbfZmh@linux.ibm.com>

On 21/10/2026 16:01, Hendrik Brueckner wrote:
> On Wed, Oct 21, 2026 at 12:28:10PM +0200, Mete Durlu wrote:
>> Add IOCTL implementation necessary to fetch diag204 data from the new
>> diag misc device under /dev.
>>
>> Signed-off-by: Mete Durlu <meted@linux.ibm.com>
>> ---
>>   arch/s390/include/uapi/asm/diag.h  |  8 +++++++
>>   arch/s390/kernel/diag/diag204.c    | 43 ++++++++++++++++++++++++++++++++++++++
>>   arch/s390/kernel/diag/diag_ioctl.h |  3 +++
>>   arch/s390/kernel/diag/diag_misc.c  | 10 +++++++++
>>   4 files changed, 64 insertions(+)
> 
> [...]
> 
>> index efffe02ea02e..ac263baf8d08 100644
>> --- a/arch/s390/kernel/diag/diag_misc.c
>> +++ b/arch/s390/kernel/diag/diag_misc.c
>> @@ -35,6 +35,16 @@ static long diag_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>>   	case DIAG310_GET_MEMTOPBUF:
>>   		rc = diag310_memtop_buf(arg);
>>   		break;
>> +	case DIAG204_GET_LEN:
>> +		rc = -EPERM;
>> +		if (capable(CAP_SYS_ADMIN))
>> +			rc = diag204_len(arg);
>> +		break;
>> +	case DIAG204_GET_BUF:
>> +		rc = -EPERM;
>> +		if (capable(CAP_SYS_ADMIN))
> 
> Why do you restrict this to sys_admin cap? I think that access control could
> be better managed through mode and ownership of the /dev/diag device.

I don't know about other diag codes and I wanted to just preserve the
current authorization level for diag204. If you think the /dev/diag
ownership is a better solution, I wouldn't go against it.

> Assuming that I like to run a service collecting information from diag204
> would require to run with sys_admin capability (almost root authority).
> 
> On a /dev/diag, allowing root and group to access the device would allow
> a service to run with regular and respective group privileges to access it
> (w/o cap sys admin).
> 
> We should revisit the device .mode = 0444 setting and prefer using
> 0440 to prohibit other users and restricting access to root/group ownership
> only.
> 
Sounds like a separate one liner patch involving just
arch/s390/kernel/diag/diag_misc.c

  reply	other threads:[~2026-10-21 14:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 10:28 [PATCH 0/3] s390: Diag204 Rework Mete Durlu
2026-10-21 10:28 ` [PATCH 1/3] s390/diag204: Introduce diag204 rework Mete Durlu
2026-10-21 10:52   ` sashiko-bot
2026-10-21 10:28 ` [PATCH 2/3] s390/diag204: Replace diag204 users with new implementation Mete Durlu
2026-10-21 11:09   ` sashiko-bot
2026-10-21 10:28 ` [PATCH 3/3] s390/diag: Add diag204 IOCTL to diag misc device Mete Durlu
2026-10-21 11:13   ` sashiko-bot
2026-10-21 14:01   ` Hendrik Brueckner
2026-10-21 14:12     ` Mete Durlu [this message]
2026-10-22  7:04 ` [PATCH 0/3] s390: Diag204 Rework Mete Durlu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64aee74d-a628-436a-8155-48fc3cf41a56@linux.ibm.com \
    --to=meted@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=brueckner@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.