From: Jan Beulich <jbeulich@suse.com>
To: "Daniel P. Smith" <dpsmith@apertussolutions.com>
Cc: jandryuk@gmail.com, xen-devel@lists.xenproject.org
Subject: Re: [PATCH] xsm/flask: adjust print messages to use %pd
Date: Fri, 9 Sep 2022 14:10:44 +0200 [thread overview]
Message-ID: <f037e0c2-625f-dcad-a67a-6468392c14bd@suse.com> (raw)
In-Reply-To: <e6568867-3296-58b2-8744-d1644e401528@apertussolutions.com>
On 09.09.2022 13:34, Daniel P. Smith wrote:
> On 9/9/22 06:04, Jan Beulich wrote:
>> On 09.09.2022 11:50, Daniel P. Smith wrote:
>>> --- a/xen/xsm/flask/avc.c
>>> +++ b/xen/xsm/flask/avc.c
>>> @@ -566,14 +566,14 @@ void avc_audit(u32 ssid, u32 tsid, u16 tclass, u32 requested,
>>> if ( a && (a->sdom || a->tdom) )
>>> {
>>> if ( a->sdom && a->tdom && a->sdom != a->tdom )
>>> - avc_printk(&buf, "domid=%d target=%d ", a->sdom->domain_id, a->tdom->domain_id);
>>> + avc_printk(&buf, "source=%pd target=%dp ", a->sdom, a->tdom);
>>> else if ( a->sdom )
>>> - avc_printk(&buf, "domid=%d ", a->sdom->domain_id);
>>> + avc_printk(&buf, "source=%pd ", a->sdom);
>>> else
>>> - avc_printk(&buf, "target=%d ", a->tdom->domain_id);
>>> + avc_printk(&buf, "target=%pd ", a->tdom);
>>
>> Apart from switching to %pd to also replace "domid" by "source". That's
>> fine in the first case (where both domain IDs are logged), but in the
>> second case it's a little questionable. Wouldn't it be better to be
>> able to distinguish the tdom == NULL case from the tdom == sdom one,
>> perhaps by using "source" in the former case but "domid" in the latter
>> one?
>
> Apologies as I am not quite following your question. Let me provide my
> reasoning and if it doesn't address your question, then please help me
> understand your concern.
>
> The function avc_printk() allows for the incremental build up of an AVC
> message. In this section, it is attempting to include the applicable
> source and target that was used to render the AVC. With the switch to
> %pd, the first and second lines would become "domid=d{id}". I personally
> find that a bit redundant. Adding to that, in the context of this
> function there is "sdom" which is source domain, "cdom" which is current
> domain, and tdom which is target domain. The print statements using cdom
> or tdom already denoted them with "current=" and "target=" respectively.
> Whereas, sdom was prefixed with "domid=" in the print statements. To me,
> it makes more sense to change the prefixes of sdom with "source=" to
> accurately reflect the context of that domid.
Well, yes, perhaps "domain" would be better than "domid" with the change
to %pd. But I still think the middle of the three printk()s would better
distinguish tdom == NULL from tdom == sdom:
else if ( a->sdom )
avc_printk(&buf, "%s=%pd ", a->tdom ? "domain" : "source", a->sdom);
Jan
next prev parent reply other threads:[~2022-09-09 12:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-09 9:50 [PATCH] xsm/flask: adjust print messages to use %pd Daniel P. Smith
2022-09-09 9:56 ` Henry Wang
2022-09-09 11:52 ` Daniel P. Smith
2022-09-09 12:45 ` Henry Wang
2022-09-09 10:04 ` Jan Beulich
2022-09-09 11:34 ` Daniel P. Smith
2022-09-09 12:10 ` Jan Beulich [this message]
2022-09-09 15:41 ` Daniel P. Smith
2022-09-12 6:35 ` Jan Beulich
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=f037e0c2-625f-dcad-a67a-6468392c14bd@suse.com \
--to=jbeulich@suse.com \
--cc=dpsmith@apertussolutions.com \
--cc=jandryuk@gmail.com \
--cc=xen-devel@lists.xenproject.org \
/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.