UBUNTU: SAUCE: apparmor4.0.0 [56/90]: prompt - refactor to moving caching to uresponse

BugLink: http://bugs.launchpad.net/bugs/2028253

To be able to be more responsive to prompt return values refactor the
code more to make caching operations distinct from user interaction
and move adding to the cache into the uresps side, so actions don't
have to be passed back to the paused process.

This is a step towards allowing response that will use a named
response instead of permissions and also allow for reuse of knotif
for notifications, heartbeat and canceled.

Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from https://gitlab.com/jjohansen/apparmor-kernel)
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
(cherry picked from commit f3dbf86be0c1d27e61e69abd7c8ed7b42e46e3a8
https://git.launchpad.net/~apparmor-dev/ubuntu-kernel-next)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
This commit is contained in:
John Johansen
2023-05-02 01:46:35 -07:00
committed by Paolo Pisati
parent 443431be30
commit 10c2e3497e
3 changed files with 238 additions and 133 deletions
+5 -2
View File
@@ -50,6 +50,9 @@ struct aa_listener_proxy {
struct list_head nslist;
};
#define KNOTIF_PULSE
#define KNOTIF_PENDING
#define KNOTIF_CANCELLED
/* need to split knofif into audit_proxy
* prompt notifications only go to first taker so no need for completion
* in the proxy, it increases size of proxy in non-prompt case
@@ -60,14 +63,14 @@ struct aa_knotif {
struct completion ready;
u64 id;
u16 ntype;
u16 flags;
};
void aa_free_listener_proxy(struct aa_listener_proxy *proxy);
bool aa_register_listener_proxy(struct aa_listener *listener, struct aa_ns *ns);
struct aa_listener *aa_new_listener(struct aa_ns *ns, gfp_t gfp);
struct aa_knotif *__aa_find_notif(struct aa_listener *listener, u64 id);
int aa_do_notification(u16 ntype, struct aa_audit_node *node,
bool *cache_response);
int aa_do_notification(u16 ntype, struct aa_audit_node *node);
long aa_listener_unotif_recv(struct aa_listener *listener, void __user *buf,
u16 max_size);