mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rinat Gadelshin <rgadelsh@gmail.com>
To: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
Cc: Paul Moore <paul@paul-moore.com>,
	"eparis@redhat.com" <eparis@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"audit@vger.kernel.org" <audit@vger.kernel.org>
Subject: Re: [PATCH 1/4] audit: refactor queue full checks
Date: Wed, 10 May 2023 10:28:15 +0300	[thread overview]
Message-ID: <af4eb7c9-52ad-4173-ec91-0d74b1ad265c@gmail.com> (raw)
In-Reply-To: <53C78149-AE5B-4554-B08C-AEBBEBA1EA95@nutanix.com>


On 10.05.2023 10:17, Eiichi Tsukata wrote:
>
>> On May 10, 2023, at 15:54, Rinat Gadelshin <rgadelsh@gmail.com> wrote:
>>
>> Hi Eiichi!
>>
>> Just one one for your patch.
>>
>> On 08.05.2023 10:58, Eiichi Tsukata wrote:
>>> Currently audit queue full checks are done in multiple places.
>>> Consolidate them into one audit_queue_full().
>>>
>>> Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
>>> ---
>>>   kernel/audit.c | 21 +++++++++++----------
>>>   1 file changed, 11 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/kernel/audit.c b/kernel/audit.c
>>> index 9bc0b0301198..c15694e1a76b 100644
>>> --- a/kernel/audit.c
>>> +++ b/kernel/audit.c
>>> @@ -341,6 +341,12 @@ static inline int audit_rate_check(void)
>>>    return retval;
>>>   }
>>>   +static inline int audit_queue_full(const struct sk_buff_head *queue)
>>> +{
>>> + return audit_backlog_limit &&
>>> +        (skb_queue_len(queue) > audit_backlog_limit);
>> It seems that we should use `>=` here.
> Hi Rinat
>
> Could you provide the detailed reason?
>
> Currently queue full checks are done with ‘>’,
> on the other hand queue NOT full checks are done with ‘<‘.
>
> Looking into other similar checks in the kernel, unix_recvq_full() is using ‘>’.
Was (OR statement): `if (!audit_backlog_limit || 
skb_queue_len(&audit_retry_queue) < audit_backlog_limit)
For AND-statement it should be `if (audit_backlog_limit && 
(skb_queue_len(&audit_retry_queue) >= audit_backlog_limit))
Otherwise we get false for case `(skb_queue_len(&audit_retry_queue) == 
audit_backlog_limit)` which was true for the old implementation.
>
> Paul, how do you think about it?
>
> Eiichi
>
>

  reply	other threads:[~2023-05-10  7:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08  7:58 [PATCH 0/4] audit: refactor and fix for potential deadlock Eiichi Tsukata
2023-05-08  7:58 ` [PATCH 1/4] audit: refactor queue full checks Eiichi Tsukata
2023-05-10  6:54   ` Rinat Gadelshin
2023-05-10  7:17     ` Eiichi Tsukata
2023-05-10  7:28       ` Rinat Gadelshin [this message]
2023-05-08  7:58 ` [PATCH 2/4] audit: account backlog waiting time in audit_receive() Eiichi Tsukata
2023-05-08  7:58 ` [PATCH 3/4] audit: convert DECLARE_WAITQUEUE to DEFINE_WAIT Eiichi Tsukata
2023-05-08  7:58 ` [PATCH 4/4] audit: check if queue is full after prepare_to_wait_exclusive() Eiichi Tsukata
2023-05-08 17:13   ` kernel test robot
2023-05-09  1:44     ` Eiichi Tsukata
2023-05-08 14:07 ` [PATCH 0/4] audit: refactor and fix for potential deadlock Paul Moore
2023-05-09  1:34   ` Eiichi Tsukata
2023-05-10  8:09     ` Eiichi Tsukata
2023-05-17 16:15       ` Paul Moore
2023-05-17 16:03     ` Paul Moore

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=af4eb7c9-52ad-4173-ec91-0d74b1ad265c@gmail.com \
    --to=rgadelsh@gmail.com \
    --cc=audit@vger.kernel.org \
    --cc=eiichi.tsukata@nutanix.com \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@paul-moore.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®