Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3740650img; Mon, 25 Mar 2019 17:15:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1PkxwNLojCIxE4G33vrOqX11BA3eAu51K+58srSsCwf5JuGULZNrV8NpydEiccONjf82u X-Received: by 2002:a63:f74c:: with SMTP id f12mr25747498pgk.124.1553559322016; Mon, 25 Mar 2019 17:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553559322; cv=none; d=google.com; s=arc-20160816; b=BkfEHVaWVBkkEbUQWGqRVYqUzyqCmnAU9hXc2S+yOeyfW1Mtvm3LiUso+wjGGa8nvc SLcaklIcwFSuCeTAGvzO2RnkRJrNhTxUJatSn/Uze9Nzsblajqbzoo2KdVRNhdGmIdOk LHJWhJV9KevSLt8QzzasSGOFCCEH/1FvC5xH2u08Xt0sdycw7SZ0zV9ZV2OKp6mNoGn/ r2HBKxIjoObOcvf5HQQAGebBi6xTZxNPBnJ4XLSFk3CspXhPOJW7/LjknQediJRtIixh dsYpy2KbV9LgDUMkkgzjkWo5z25xmjgOUKugk5L6yIgkZTDDb2o01f7KlkvZyyk1Ig5O OfEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=kdWAfwt/h2Q6nIJfc0k7/8YL2pvUSOUPD+mlmKROtLo=; b=hJePBBQx85erJwxwqHYqhlqgrJxc25X77jhvTpL0E98iK87diE7SRwTvH/AK1eF2AR 0Pk6rtnK5rmNSELwH5/pwXyxz97dVH0fRLCeHrk5Y0DeH9lT0gXWhNLMOffM7jQWtURi x9iXOQUEK6ktEE4pPpJiOZfNDXcy2FbCv4n9knmw3UtVkRFReSp1GzwRsB9eqFa0vsE7 ZrXU+K/zm2iOeUifp5XWNycXE/QZxX666X6/KvJcxEJEf5/c6oX9ajtVDUKbezJaTt1i CPrz2rqeymlBtBptKtj4qg97F1s9Y/V0OLLqCK2QGQ7c+rAbDMOjHKtr2L3PTcLv+4ch DIhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=ikbnUsZ1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19si14469178pgk.115.2019.03.25.17.15.06; Mon, 25 Mar 2019 17:15:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=ikbnUsZ1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730407AbfCZANI (ORCPT + 99 others); Mon, 25 Mar 2019 20:13:08 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:43530 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726553AbfCZANI (ORCPT ); Mon, 25 Mar 2019 20:13:08 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 6217E8EE0E0; Mon, 25 Mar 2019 17:13:07 -0700 (PDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RDz2U9LDNnC6; Mon, 25 Mar 2019 17:13:06 -0700 (PDT) Received: from [153.66.254.194] (unknown [50.35.68.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 648DE8EE0DF; Mon, 25 Mar 2019 17:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1553559186; bh=Lfp/oz/KzPDjG1nta07E58bI9NcSy7H9Dyu6V8CSx70=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ikbnUsZ1B1lkL+vzVvcVEImnvHc4J1lTEqettn2xHOd09KqS8acJuLXXLAEWUXKy4 BxZx1B2lPD7RAvLfwJQNuLoDevkx30J8qfjhBZQSjRzGEn0pZMju2VjQ1+IXaK5aw4 FlJGggUYGcewatXnsrOMViWRCdkb2vQPfI38191o= Message-ID: <1553559185.2929.20.camel@HansenPartnership.com> Subject: Re: [PATCH 1/2] io_uring: fix big-endian compat signal mask handling From: James Bottomley To: Arnd Bergmann Cc: Andrew Morton , Jens Axboe , Alexander Viro , Hannes Reinecke , Matthew Wilcox , David Hildenbrand , Nikolay Borisov , linux-block , Linux FS-devel Mailing List , Linux Kernel Mailing List Date: Mon, 25 Mar 2019 17:13:05 -0700 In-Reply-To: References: <20190325143521.34928-1-arnd@arndb.de> <1553530766.2955.51.camel@HansenPartnership.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-03-25 at 17:24 +0100, Arnd Bergmann wrote: > On Mon, Mar 25, 2019 at 5:19 PM James Bottomley > wrote: > > > > --- a/fs/io_uring.c > > > +++ b/fs/io_uring.c > > > @@ -1968,7 +1968,15 @@ static int io_cqring_wait(struct > > > io_ring_ctx > > > *ctx, int min_events, > > > return 0; > > > > > > if (sig) { > > > - ret = set_user_sigmask(sig, &ksigmask, &sigsaved, > > > sigsz); > > > +#ifdef CONFIG_COMPAT > > > + if (in_compat_syscall()) > > > + ret = set_compat_user_sigmask((const > > > compat_sigset_t __user *)sig, > > > + &ksigmask, > > > &sigsaved, sigsz); > > > + else > > > +#endif > > > > This looks a bit suboptimal: shouldn't in_compat_syscall() be hard > > coded to return 0 if CONFIG_COMPAT isn't defined? That way the > > compiler can do the correct optimization and we don't have to > > litter #ifdefs and worry about undefined variables and other > > things. > > The check can be outside of the #ifdef, but set_compat_user_sigmask > is not declared then. Right, but shouldn't it be declared? I thought BUILD_BUG_ON had nice magic that allowed it to work here (meaning if the compiler doesn't eliminate the branch we get a build bug). > I think for the future we can consider just moving the compat logic > into set_user_sigmask(), which would simplify most of the callers, > but that seemed to invasive as a bugfix for 5.1. Well, that too. I've just been on a recent bender to stop #ifdefs after I saw what some people were doing with them. James