linux-audit.redhat.com archive mirror
 help / color / mirror / Atom feed
* How to define audit rule for one bit *not* set for a syscall argument?
@ 2023-03-08 13:46 Richard Du
  2023-03-08 22:22 ` Steve Grubb
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Du @ 2023-03-08 13:46 UTC (permalink / raw)
  To: linux-audit


[-- Attachment #1.1: Type: text/plain, Size: 849 bytes --]

Hello all,

I'm trying to define an audit rule with auditctl for clone() syscall, and I
would expect that the a0 of clone() syscall (i.e. the clone_flags argument)
without the CLONE_THREAD flag bit being set.

int clone(int (*fn)(void *), void *stack, int flags, void *arg, ...
                 /* pid_t *parent_tid, void *tls, pid_t *child_tid */ );

From man page of auditctl, -F option build a rule file: name, operation,
value.
-F [n=v | n!=v | n<v | n>v | n<=v | n>=v | n&v | n&=v]

I can understand that, the n&v (Audit_bitmask) means any bit of a bitmast
is set, and the n&=v (Audit_bittest) means all bits of a bitmask are set.

While my question is, how to build a rule which means "none of bit of a
bitmask is set", i.e. ( ! n&=v ). If the current audit comparator dosen't
support this, can we add the support in furture?

Thanks,
Richard

[-- Attachment #1.2: Type: text/html, Size: 1045 bytes --]

[-- Attachment #2: Type: text/plain, Size: 107 bytes --]

--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to define audit rule for one bit *not* set for a syscall argument?
  2023-03-08 13:46 How to define audit rule for one bit *not* set for a syscall argument? Richard Du
@ 2023-03-08 22:22 ` Steve Grubb
  2023-03-09  2:07   ` Richard Du
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Grubb @ 2023-03-08 22:22 UTC (permalink / raw)
  To: linux-audit; +Cc: Richard Du

Hello,

On Wednesday, March 8, 2023 8:46:57 AM EST Richard Du wrote:
> I'm trying to define an audit rule with auditctl for clone() syscall, and I
> would expect that the a0 of clone() syscall (i.e. the clone_flags
> argument) without the CLONE_THREAD flag bit being set.
> 
> int clone(int (*fn)(void *), void *stack, int flags, void *arg, ...
>                  /* pid_t *parent_tid, void *tls, pid_t *child_tid */ );
> 
> From man page of auditctl, -F option build a rule file: name, operation,
> value.
> -F [n=v | n!=v | n<v | n>v | n<=v | n>=v | n&v | n&=v]
> 
> I can understand that, the n&v (Audit_bitmask) means any bit of a bitmast
> is set, and the n&=v (Audit_bittest) means all bits of a bitmask are set.
> 
> While my question is, how to build a rule which means "none of bit of a
> bitmask is set", i.e. ( ! n&=v ). If the current audit comparator dosen't
> support this, can we add the support in furture?

The comparator does not support this. This is a corner case in which this is 
the first time someone ever needed it.

-Steve


--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to define audit rule for one bit *not* set for a syscall argument?
  2023-03-08 22:22 ` Steve Grubb
@ 2023-03-09  2:07   ` Richard Du
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Du @ 2023-03-09  2:07 UTC (permalink / raw)
  To: Steve Grubb; +Cc: linux-audit


[-- Attachment #1.1: Type: text/plain, Size: 1559 bytes --]

Yes, the case is that we would like to filter out the "thread creation" and
only keep the "process creation", by excluding the CLONE_THREAD flag bit of
a0 of clone() syscall.
Without the audit comparator support for this case, we have to filter out
the "thread creation" in user space which introduces a performance penalty.

Regards,
Richard

On Thu, Mar 9, 2023 at 6:22 AM Steve Grubb <sgrubb@redhat.com> wrote:

> Hello,
>
> On Wednesday, March 8, 2023 8:46:57 AM EST Richard Du wrote:
> > I'm trying to define an audit rule with auditctl for clone() syscall,
> and I
> > would expect that the a0 of clone() syscall (i.e. the clone_flags
> > argument) without the CLONE_THREAD flag bit being set.
> >
> > int clone(int (*fn)(void *), void *stack, int flags, void *arg, ...
> >                  /* pid_t *parent_tid, void *tls, pid_t *child_tid */ );
> >
> > From man page of auditctl, -F option build a rule file: name, operation,
> > value.
> > -F [n=v | n!=v | n<v | n>v | n<=v | n>=v | n&v | n&=v]
> >
> > I can understand that, the n&v (Audit_bitmask) means any bit of a bitmast
> > is set, and the n&=v (Audit_bittest) means all bits of a bitmask are set.
> >
> > While my question is, how to build a rule which means "none of bit of a
> > bitmask is set", i.e. ( ! n&=v ). If the current audit comparator dosen't
> > support this, can we add the support in furture?
>
> The comparator does not support this. This is a corner case in which this
> is
> the first time someone ever needed it.
>
> -Steve
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 2075 bytes --]

[-- Attachment #2: Type: text/plain, Size: 107 bytes --]

--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-09 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 13:46 How to define audit rule for one bit *not* set for a syscall argument? Richard Du
2023-03-08 22:22 ` Steve Grubb
2023-03-09  2:07   ` Richard Du

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).