Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp8326lqp; Thu, 4 Apr 2024 05:53:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWy1gK5tTRbqHeNeSCZ0kr+fI1A50QKUstUHsqlRY/zVoghCpzyV0svJItrOSplSOz0XGT6BOrORWKn0+oZvnP0R0xi81Troy3K5ep49A== X-Google-Smtp-Source: AGHT+IGgHV3lu/u6FpIZ9ap5BnMZqJ/0Bt1C/t07HE3PabwQq8lyQh5El8eA7iXWU/OS1FXnvLuS X-Received: by 2002:a05:620a:1714:b0:78b:c6c0:f3bd with SMTP id az20-20020a05620a171400b0078bc6c0f3bdmr2665084qkb.27.1712235237421; Thu, 04 Apr 2024 05:53:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712235237; cv=pass; d=google.com; s=arc-20160816; b=AjKvpXjapu0wAJ4nYYdsad33UnwaEmZRqEkrVfcpzhxzms0PrwCXl8dctWB6pidKqk K64VhY6BDGykEknnhn/F7rXJzZ6LIiJfVQIotcZeWEUcIM6gyGCQL3P3VbPeL6IAnySn 0fmmwQhfl8D7vK8Rwsp4bRJlZamwqbHbCfTtzJ18aUKtnK7U6+xEXm5PsoYYmeXcy+5c 2st5WPCgNLYYs5+gMjv1cXcfLsi/zfA4nV/pkvvvEodD+YNX5z+edyHNCQaagCT8eTa5 iyYsDHojU7yT+gK7TF/wTO48q56Tc8E8/afAvLZOuaxsv2woR6obhbSLm/6JBrgnOEFO g4hQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DvDzxdQYYt9cVKDgut1wVA4eoq6mvQm7w4QB8oYVEVY=; fh=i3L2rVgusiElW0JbSBSvC+4PiTaBjJx33heZqnR4a4c=; b=tgv6iqVDEy12EQ8vwNsq30do7dZqeKlDr0smt9nODLMSpeOBp0di13jua4F21vWnOh FocO8rfuQAFwNeGYYk8CsMxmtGWOSoPvPdDWkoA485dxdzmKP5/p/m92qzKdXKSzncya A/OQlRPy/x/zD1icMp31uv5mW5l4iScK4mUVRLTAn3y1Ha8RuUEbjpOJUSXRtXGCQplP 1/jhSqvB21f1AUGG7TABuHxkDC1z/5dWAdI9foCGoFekmpdApcX0gSyoM5wiMjI00iZy tKD10ck36DIy5g1jBPkSueWhNtCQ3JvCSfRUhnFgSGS4n0TWPrbFK/tafCAyhk4ewbZk /UPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=MHLe0R92; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-131472-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131472-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v20-20020ae9e314000000b0078be32e1b0fsi3196396qkf.462.2024.04.04.05.53.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 05:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131472-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=MHLe0R92; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-131472-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131472-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 706241C263D9 for ; Thu, 4 Apr 2024 12:52:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69BD285C70; Thu, 4 Apr 2024 12:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="MHLe0R92" Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A63971E4A2 for ; Thu, 4 Apr 2024 12:52:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712235156; cv=none; b=PIXwbo8l0Whoi6zoAbNptRvTtUxYeXl93zUfNY3V0nbdRA1HV5oepFEsbiwTEUxjR+Bt4DfqUdNFA4qnPvKkVKIfs0ixWLkwdCMI2nDFWNBBpNWZKpSrgekB2LZv5TMf/CzMD57AFB1KGkx/E7WPTsFp7X+n2cF8I0JpqTehnyY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712235156; c=relaxed/simple; bh=jq68TBI1+1Bv8IHYnLKOXjoKNoP1enIkW2sf4MAUOrI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=O8YgaH47kslRKaDYzioRUbX3x5d1JlUxyZsb+YRb7Bl5oMHdI3tKfM1VgEnRsZJfR0cDvyo5MW9YhUcvQDTa/NzuMVARl+s7MqAA4i5OuZuWjUQId9PJZtlHEK32JCkCNeeJB+HLVUPEfA6Cz1uCbjlb4fsRYusjxhvfpbKgvEI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=MHLe0R92; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5a7d9d2c75fso337527eaf.1 for ; Thu, 04 Apr 2024 05:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712235154; x=1712839954; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=DvDzxdQYYt9cVKDgut1wVA4eoq6mvQm7w4QB8oYVEVY=; b=MHLe0R92M79Kr6/Hh76+lghTH+JoJPw+dMpzu3Q59H8uSgv7XBNUztPuUrsF3gQKHn v/8fs689Wl60Z/fBqQ3HDHIavwLh1JPmSnxVSq9c1ealQ9TOeUz8ZZABKmrFWG4CvJvf ZW1W4q7cK0f6ZhOSa4ZmDdD/LN+ys/QUvasr4GBzJ69dKOHCrBgAqW54tc9nLYl8gVFl ruSTxcXkD7YaJVV8yBrASXo6Ck9/41QVkMzVCkBe0d9jT5yejETNv/Kq2oVp/jfxPMcy 1yF8qBTxIh6zgAIW7syDNWM5PONuWIw4bWVpmSlajlH8PJPQN56C0Iq8Vq3GJEwt1FiE VyHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712235154; x=1712839954; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DvDzxdQYYt9cVKDgut1wVA4eoq6mvQm7w4QB8oYVEVY=; b=LH8wMFT+0inCamAuOzXv3w3EIvkrlNxa3dE5kyImgZRgJWm2qyMyGzOH+HDGHP51Tu gXxrsVTx+rbfnj/R5AvYi6xdOpAiYlmv5aFOYbNTCqIUgclxvQ3QudNEtQYWTtj9JVK4 F3f9THhluP8YpydyzoMvurpt7D5bemmce77d9N9YXuC0lnhQDbDzLG1IXmis0rD3Bzmy c6dca0bLvMpIgGJWE+1ITNz4Mm4DzlaHvq7bFwETJ8/n8KjOv6s282wE8hfbkQCkQRPY PGBzfITxUhseLx5h/QqsnPHYR+3keEDQZHZHOxr+1QHpzt1RvFcliOufj3C275KAoKXh 505A== X-Forwarded-Encrypted: i=1; AJvYcCXZAFSJsoxtOINogBI1Cl0SH0XSnelDhiuQGwZAGV5M1GPmcXQFBJHKSW0BeBXxKubW0h8YxZcYYOL5y8qy0Wfy2lnCQcyE0AUz9386 X-Gm-Message-State: AOJu0YwrSdliGdduP/FHRITfdcgY4kHJSti8Yuy0LiK0pbbq37AGQ1Sw rbDidjsUthJVGAQpajjnrImRPwNRgrrE9xH5ZdeaDJRrlduQYI4Gxy9Z0D9BZA8= X-Received: by 2002:a05:6871:2881:b0:22e:514f:cd11 with SMTP id bq1-20020a056871288100b0022e514fcd11mr2493204oac.1.1712235153785; Thu, 04 Apr 2024 05:52:33 -0700 (PDT) Received: from [192.168.1.150] ([198.8.77.194]) by smtp.gmail.com with ESMTPSA id b26-20020a6567da000000b005dc507e8d13sm11739074pgs.91.2024.04.04.05.52.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Apr 2024 05:52:33 -0700 (PDT) Message-ID: <8de27ff2-d53f-4900-b755-6a05bff98f78@kernel.dk> Date: Thu, 4 Apr 2024 06:52:32 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] signalfd: convert to ->read_iter() Content-Language: en-US To: Al Viro Cc: linux-fsdevel@vger.kernel.org, brauner@kernel.org, linux-kernel@vger.kernel.org References: <20240403140446.1623931-1-axboe@kernel.dk> <20240403140446.1623931-4-axboe@kernel.dk> <20240403225747.GO538574@ZenIV> From: Jens Axboe In-Reply-To: <20240403225747.GO538574@ZenIV> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/3/24 4:57 PM, Al Viro wrote: > On Wed, Apr 03, 2024 at 08:02:54AM -0600, Jens Axboe wrote: >> Rather than use the older style ->read() hook, use ->read_iter() so that >> signalfd can support both O_NONBLOCK and IOCB_NOWAIT for non-blocking >> read attempts. >> >> Split the fd setup into two parts, so that signalfd can mark the file >> mode with FMODE_NOWAIT before installing it into the process table. > > Same issue with copy_to_iter() calling conventions; what's more, userland > really does not expect partial copies here, so it might be worth adding > > static inline > bool copy_to_iter_full(void *addr, size_t bytes, struct iov_iter *i) > { > size_t copied = copy_to_iter(addr, bytes, i); > if (likely(copied == bytes)) > return true; > iov_iter_revert(i, copied); > return false; > } > > to include/linux/uio.h for the sake of those suckers. Then > they could go for > return copy_to_iter_full(&new, sizeof(new), to) ? sizeof(new) : -EFAULT; > and similar in other two. That's a good idea, makes the transformations easier too and avoids dealine with the partial case. > NOTE: the userland ABI is somewhat sucky here - if the buffer goes > unmapped (or r/o) at the offset that is *not* a multiple of > sizeof(struct signalfd_siginfo), you get an event quietly lost. > Not sure what can be done with that - it is a user-visible ABI. The ABI could be nicer, but isn't this a case of "well don't do that then"? -- Jens Axboe