* [PATCH 1/3] fanotify: Ensure consistent variable type for response
@ 2020-09-30 16:12 ` Steve Grubb
0 siblings, 0 replies; 4+ messages in thread
From: Steve Grubb @ 2020-09-30 16:12 UTC (permalink / raw)
To: linux-fsdevel, Jan Kara, linux-audit, Paul Moore
Cc: Amir Goldstein, Eric Paris
The user space API for the response variable is __u32. This patch makes
sure that the whole path through the kernel uses __u32 so that there is
no sign extension or truncation of the user space response.
Signed-off-by: Steve Grubb <sgrubb@redhat.com>
---
fs/notify/fanotify/fanotify.h | 2 +-
fs/notify/fanotify/fanotify_user.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
index 8ce7ccfc4b0d..c397993830ac 100644
--- a/fs/notify/fanotify/fanotify.h
+++ b/fs/notify/fanotify/fanotify.h
@@ -165,7 +165,7 @@ FANOTIFY_PE(struct fanotify_event *event)
struct fanotify_perm_event {
struct fanotify_event fae;
struct path path;
- unsigned short response; /* userspace answer to the event */
+ __u32 response; /* userspace answer to the event */
unsigned short state; /* state of the event */
int fd; /* fd we passed to userspace for this event */
};
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 63b5dffdca9e..c8da9ea1e76e 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -157,7 +157,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,
*/
static void finish_permission_event(struct fsnotify_group *group,
struct fanotify_perm_event *event,
- unsigned int response)
+ __u32 response)
__releases(&group->notification_lock)
{
bool destroy = false;
@@ -178,7 +178,7 @@ static int process_access_response(struct fsnotify_group *group,
{
struct fanotify_perm_event *event;
int fd = response_struct->fd;
- int response = response_struct->response;
+ __u32 response = response_struct->response;
pr_debug("%s: group=%p fd=%d response=%d\n", __func__, group,
fd, response);
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/3] fanotify: Ensure consistent variable type for response
@ 2020-09-30 16:12 ` Steve Grubb
0 siblings, 0 replies; 4+ messages in thread
From: Steve Grubb @ 2020-09-30 16:12 UTC (permalink / raw)
To: linux-fsdevel, Jan Kara, linux-audit, Paul Moore; +Cc: Amir Goldstein
The user space API for the response variable is __u32. This patch makes
sure that the whole path through the kernel uses __u32 so that there is
no sign extension or truncation of the user space response.
Signed-off-by: Steve Grubb <sgrubb@redhat.com>
---
fs/notify/fanotify/fanotify.h | 2 +-
fs/notify/fanotify/fanotify_user.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
index 8ce7ccfc4b0d..c397993830ac 100644
--- a/fs/notify/fanotify/fanotify.h
+++ b/fs/notify/fanotify/fanotify.h
@@ -165,7 +165,7 @@ FANOTIFY_PE(struct fanotify_event *event)
struct fanotify_perm_event {
struct fanotify_event fae;
struct path path;
- unsigned short response; /* userspace answer to the event */
+ __u32 response; /* userspace answer to the event */
unsigned short state; /* state of the event */
int fd; /* fd we passed to userspace for this event */
};
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 63b5dffdca9e..c8da9ea1e76e 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -157,7 +157,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,
*/
static void finish_permission_event(struct fsnotify_group *group,
struct fanotify_perm_event *event,
- unsigned int response)
+ __u32 response)
__releases(&group->notification_lock)
{
bool destroy = false;
@@ -178,7 +178,7 @@ static int process_access_response(struct fsnotify_group *group,
{
struct fanotify_perm_event *event;
int fd = response_struct->fd;
- int response = response_struct->response;
+ __u32 response = response_struct->response;
pr_debug("%s: group=%p fd=%d response=%d\n", __func__, group,
fd, response);
--
2.26.2
--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] fanotify: Ensure consistent variable type for response
2020-09-30 16:12 ` Steve Grubb
@ 2020-10-01 9:49 ` Jan Kara
-1 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2020-10-01 9:49 UTC (permalink / raw)
To: Steve Grubb
Cc: linux-fsdevel, Jan Kara, linux-audit, Paul Moore, Amir Goldstein,
Eric Paris
On Wed 30-09-20 12:12:24, Steve Grubb wrote:
> The user space API for the response variable is __u32. This patch makes
> sure that the whole path through the kernel uses __u32 so that there is
> no sign extension or truncation of the user space response.
>
> Signed-off-by: Steve Grubb <sgrubb@redhat.com>
> ---
> fs/notify/fanotify/fanotify.h | 2 +-
> fs/notify/fanotify/fanotify_user.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
Looks good, just one nit below:
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 63b5dffdca9e..c8da9ea1e76e 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -157,7 +157,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,
> */
> static void finish_permission_event(struct fsnotify_group *group,
> struct fanotify_perm_event *event,
> - unsigned int response)
> + __u32 response)
> __releases(&group->notification_lock)
> {
> bool destroy = false;
> @@ -178,7 +178,7 @@ static int process_access_response(struct fsnotify_group *group,
> {
> struct fanotify_perm_event *event;
> int fd = response_struct->fd;
> - int response = response_struct->response;
> + __u32 response = response_struct->response;
>
> pr_debug("%s: group=%p fd=%d response=%d\n", __func__, group,
> fd, response);
You want to print the response with "%u" here I guess...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] fanotify: Ensure consistent variable type for response
@ 2020-10-01 9:49 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2020-10-01 9:49 UTC (permalink / raw)
To: Steve Grubb; +Cc: Jan Kara, Amir Goldstein, linux-audit, linux-fsdevel
On Wed 30-09-20 12:12:24, Steve Grubb wrote:
> The user space API for the response variable is __u32. This patch makes
> sure that the whole path through the kernel uses __u32 so that there is
> no sign extension or truncation of the user space response.
>
> Signed-off-by: Steve Grubb <sgrubb@redhat.com>
> ---
> fs/notify/fanotify/fanotify.h | 2 +-
> fs/notify/fanotify/fanotify_user.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
Looks good, just one nit below:
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 63b5dffdca9e..c8da9ea1e76e 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -157,7 +157,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,
> */
> static void finish_permission_event(struct fsnotify_group *group,
> struct fanotify_perm_event *event,
> - unsigned int response)
> + __u32 response)
> __releases(&group->notification_lock)
> {
> bool destroy = false;
> @@ -178,7 +178,7 @@ static int process_access_response(struct fsnotify_group *group,
> {
> struct fanotify_perm_event *event;
> int fd = response_struct->fd;
> - int response = response_struct->response;
> + __u32 response = response_struct->response;
>
> pr_debug("%s: group=%p fd=%d response=%d\n", __func__, group,
> fd, response);
You want to print the response with "%u" here I guess...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-01 12:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 16:12 [PATCH 1/3] fanotify: Ensure consistent variable type for response Steve Grubb
2020-09-30 16:12 ` Steve Grubb
2020-10-01 9:49 ` Jan Kara
2020-10-01 9:49 ` Jan Kara
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.