lkml.org 
[lkml]   [2023]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] tracing/user_events: Ensure bit is cleared on unregister
On Tue, 11 Apr 2023 14:17:08 -0700
Beau Belgrave <beaub@linux.microsoft.com> wrote:

> +static int user_event_mm_clear_bit(struct user_event_mm *user_mm,
> + unsigned long uaddr, unsigned char bit)
> +{
> + struct user_event_enabler enabler;
> + int result;
> +
> + memset(&enabler, 0, sizeof(enabler));
> + enabler.addr = uaddr;
> + enabler.values = bit;
> +retry:
> + /* Prevents state changes from racing with new enablers */
> + mutex_lock(&event_mutex);
> +
> + /* Force the bit to be cleared, since no event is attached */
> + mmap_read_lock(user_mm->mm);
> + result = user_event_enabler_write(user_mm, &enabler, false);
> + mmap_read_unlock(user_mm->mm);
> +
> + mutex_unlock(&event_mutex);
> +
> + if (result) {
> + /* Attempt to fault-in and retry if it worked */
> + if (!user_event_mm_fault_in(user_mm, uaddr))
> + goto retry;

Without looking into the functions of this call, I wonder if this can
get into an infinite loop?

-- Steve


> + }
> +
> + return result;
> +}
> +

\
 
 \ /
  Last update: 2023-04-25 03:40    [W:0.056 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site