Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1666281pxf; Fri, 12 Mar 2021 16:05:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/s3InwZ1NeTkES/4oR4Hdc1isPOg004orKsGkYXOBJoWfmZXpJL60xgv3l1Jjw0HHXhXj X-Received: by 2002:a17:906:4bce:: with SMTP id x14mr11165915ejv.383.1615593951931; Fri, 12 Mar 2021 16:05:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615593951; cv=none; d=google.com; s=arc-20160816; b=ZsIO/PdTMYjX4q3+/rPLkbOPMqZclz6nnhEfHPi/gKGlZjnC7rZVFg8OQa2lhNv+RB gNKkx9UUomA55On+PFWR/yX5ZIVevhBQKiC7AcC16/6n0CyJHQmW0O4tqx32v9I5Y8x5 h86D+y0dJxLdN8DxKO76NV7qgTyyZKvtkXgK7ufD6uXZr3A5RDVF2CI0Gmnz6hjNJEdh yU+4ktomEHTyfBXw+WwOaWUo9cIWhhXO+DljCor6ea1d2ZbsbgT/4pMmPch7sLg0ZOOM t33qyfja/pueoQrc73RrekJ0SpvGFhQ12Sd4sva4da2y1i1eSd0Q6sovfI8oRDYMaFo8 upRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=spwItwioBxP+1u6yXKBwsvPAzUEdjy80N3bb4r66aWw=; b=ESbQTdhmh14N9QUnqp24r3HoO26ruRlupQ/b5kmPjcroAWZ0T65ofSGz625Sa9l5IF zv1YQVbLDKimeAfkN4Ta5hKYw2yvwmNmWbj3P3r8Jxd8+FBxRmm5z/yoVOTYAJV3Om6b KIG8D8StrVj2Lb3WLssSGxkuwW3vKlnbl+5BxRyShTywBbArwZNXoR1rL77VcYWdvoMT mPk0wGSiq5aZaUVNj6f3GBS7UkL6AAi17ZxvozdQqyxLduogLa0YsQDxBZN9W8c4rFj2 qWX+j2zljftJ87VzGd8Yz4g9+STCMizb3DA8rFwszCFd0w88H9Pnx3SLw/50gvoflItD Y1rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nHTfpz61; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kf1si5312318ejc.262.2021.03.12.16.05.29; Fri, 12 Mar 2021 16:05:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nHTfpz61; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235926AbhCMABm (ORCPT + 99 others); Fri, 12 Mar 2021 19:01:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235930AbhCMABX (ORCPT ); Fri, 12 Mar 2021 19:01:23 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B931C061574 for ; Fri, 12 Mar 2021 16:01:23 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id z25so9422615lja.3 for ; Fri, 12 Mar 2021 16:01:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=spwItwioBxP+1u6yXKBwsvPAzUEdjy80N3bb4r66aWw=; b=nHTfpz61sUQqiBdZwrE/XiZbx3a/t95ZtNDcwXNL2aKhC3rGdfmDYX+ogeTj6Kr5FZ TtfqTDd8PSGLRKp+vht4rhkoCe8V6q9IP5lb4RupgtIXDtFP7OHIHkLDVMtmAu6AfnNH lGA1DL14esTqgvQLj7nJ10CW+1AMwCMrLLv4zlPxgw2pkMwBzVzSOUxLEWiSmWBkFIr+ R7NmmxbZ9iUFU3BbBnQLdR2i30BITcndJfswiuxFims9JmA+lQPnbtWKrjd9gJBIVizE CgcF99hvgcNiQU/aVybaZjw3bxeJ5xpWiyo3AOnTyGoSyX4kELU6aqcZp2g7l8DH+fiC j+Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=spwItwioBxP+1u6yXKBwsvPAzUEdjy80N3bb4r66aWw=; b=QSDGegHZiSGz0wH6+N07G3l4Vajz4RlvdgrDjbSO+mBf1IKGj/nj3Ho1yYon1N8hvZ 6wHGBlY0xSYbrF3N9E+hW6/R00wKSCJQJGG0LHdD+vZC4dmFDPMT3pa2havICl5Bgpur Bk2KPAPohHt/G+NES5+dWSRqmfP7Xlx6U7UpJp9dzk8VZWN8h0nGQprsFKLEPYyp07qr 71UHV8XUwwP0lobcoLYdsZ4kZqtNSEYA/NWBkFtE1Hs7nqWJJ6r3R+j6QlpTkhGJZGBx b3IZ2NpqUIubzT6SBXDnUGfAjlw/R8hU0YIa9JlBMs3fn/+pf+qqBly25B9vnpChME7X bcNg== X-Gm-Message-State: AOAM530gwQ8zQaSPHjTNhc5lS4o5nh36um6smqZ4IesH/mLRHT4ktxlg 4iWoRGOllFllp27omcf+6lPdVMWWhnBBDY/80sSlrA== X-Received: by 2002:a05:651c:211b:: with SMTP id a27mr3728543ljq.433.1615593681625; Fri, 12 Mar 2021 16:01:21 -0800 (PST) MIME-Version: 1.0 References: <20210311184629.589725-1-dualli@chromium.org> <20210311184629.589725-3-dualli@chromium.org> In-Reply-To: <20210311184629.589725-3-dualli@chromium.org> From: Todd Kjos Date: Fri, 12 Mar 2021 16:01:11 -0800 Message-ID: Subject: Re: [PATCH v2 2/3] binder: use EINTR for interrupted wait for work To: Li Li Cc: Li Li , Greg Kroah-Hartman , Christian Brauner , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , "open list:ANDROID DRIVERS" , LKML , Martijn Coenen , Hridya Valsaraju , Suren Baghdasaryan , "Joel Fernandes (Google)" , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 11, 2021 at 10:46 AM Li Li wrote: > > From: Marco Ballesio > > when interrupted by a signal, binder_wait_for_work currently returns > -ERESTARTSYS. This error code isn't propagated to user space, but a way > to handle interruption due to signals must be provided to code using > this API. > > Replace this instance of -ERESTARTSYS with -EINTR, which is propagated > to user space. > > Test: built, booted, interrupted a worker thread within > binder_wait_for_work > Signed-off-by: Marco Ballesio > Signed-off-by: Li Li Acked-by: Todd Kjos > --- > drivers/android/binder.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index 76ea558df03e..38bbf9a4ce99 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -3712,7 +3712,7 @@ static int binder_wait_for_work(struct binder_thread *thread, > binder_inner_proc_lock(proc); > list_del_init(&thread->waiting_thread_node); > if (signal_pending(current)) { > - ret = -ERESTARTSYS; > + ret = -EINTR; > break; > } > } > @@ -4855,7 +4855,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > if (thread) > thread->looper_need_return = false; > wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); > - if (ret && ret != -ERESTARTSYS) > + if (ret && ret != -EINTR) > pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); > err_unlocked: > trace_binder_ioctl_done(ret); > -- > 2.31.0.rc2.261.g7f71774620-goog >