Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6694977ybl; Wed, 15 Jan 2020 08:44:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyn3qrVMM1Zj0MQpraSUrnzjvLr4Dz7DHaPUlNwHOHWNTtFez+uxZvQKWaHwn84rsrV9biu X-Received: by 2002:aca:5490:: with SMTP id i138mr596513oib.34.1579106652491; Wed, 15 Jan 2020 08:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579106652; cv=none; d=google.com; s=arc-20160816; b=cfqUrlkIQD47xkQWddmOTJdi/l760LHBd6Iw6JT/2O8SYZQZaPo4uzOq/KFoN1MjdB /DycQXIWtYbPvxvtIU0T3Fnk/ykDwnqHGfIoxEDLciit//qmmrC42afzBjwxJUmZBp10 +9+S/oOUOf5UnRiEoLkkYvJrHY4sx15uQ7/M9EISAU+Z7AvPFfEMlCuseLzcih2VlXQv ibComsPrwKi9ew+IXQuQOmpFjkJIBtAC38J+O4CVSVayli6kqb3GhrLzzBqUin9Ug54f rKn4R712brbJu57xKbcWVf6BorkYgBglCSNWoH6cMuCBntkeCTG0GvSQIRKz1nFKODaa dHWw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=V2uWqO7PQFpi/zdSVofh092jxm4FAhmJjQJPAhbVzhM=; b=fe2C6OxDo4EtJp9kd9m7FZPlsmPulJ5B/tUY4O42f6y8O2OJjLaPB7NijEbIp+FEcf Yvq40432q7GJvQBg4lwatsRPVi8j6wL7qHWn2O8GLRhiPBVWkR6ojoKBBrzcbUz4HB+4 JJQ/YA1vtXEiR+t4mcPrGwWw15nP4hsq/S3wMFlPPONIutmcV/eOH1V+87ygBisj/Npv PR9ZX9wAkgYNmksup55MOwIVlOg3Tf/57iaOmgjrruuzHeEeiETyGLMV0ZnKBsHifcCa +Cfn3NZrZ5kVrTKhkh6Smb413SCe3CYU2i0lOyWqUAueZr0pvH5oBHxraxP1MZAvSSV6 Kx2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=dxK79Nck; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f203si9595535oib.56.2020.01.15.08.44.01; Wed, 15 Jan 2020 08:44:12 -0800 (PST) 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=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=dxK79Nck; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729074AbgAOQmB (ORCPT + 99 others); Wed, 15 Jan 2020 11:42:01 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:36307 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbgAOQmB (ORCPT ); Wed, 15 Jan 2020 11:42:01 -0500 Received: by mail-pj1-f68.google.com with SMTP id n59so183402pjb.1 for ; Wed, 15 Jan 2020 08:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=V2uWqO7PQFpi/zdSVofh092jxm4FAhmJjQJPAhbVzhM=; b=dxK79Nck5Z1AUWDmVeAZ6wPqOrbTaXF13wjUbMrN3MEZeuMjXwYyUsJXQ2Um+Abf+T iHtKJeAW9g/zI4qGYpzqyvsZkyJ7Uke6dmg07EDswHlkioYwbfYAHXBHwinjW4WJZq7O 9NzrGG5JwSk6acoypINPTR/I09dvd5g2CyDKZDwUsMKdz1uD12RcM3VrtrhBu+Md+oW+ UFsYdcCxvg+Cd5f98epqIw+uCYd1ok7c3J3Xg3c5ezsTwqxmBYR/r+a06oS1dALdIo7x WGcybwGGUUYxCOEs/sAPa4yixmXeTJJdpOj0OwrevZ1B2HiqjaZoYo3vAGU740TI18vb dJww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=V2uWqO7PQFpi/zdSVofh092jxm4FAhmJjQJPAhbVzhM=; b=JdNJav1I1A8CII7EByv9v538sc99eRwjggKVKC8m5JF63EgJRSPCd/wtx9I4R+Ue1g 7eOOeda1Pa0wipkCZ7x4wY2IIoC0Wg9SSBxd2++7UKI+6swTFhta+XRIpnGKvpR7nZvR IutBWX64+Bf9BZ+rqA0smZhbE+Cxpj1vbE0B+OoKCs80uP8UkVRUhbnZ6jteJYItQzA9 wxBuh5xAhEfVqj6lpWjbQLMuNXWGuW8IeG2wOGVeqjhSH50hhsVKFzgxq4ZlhwB+ONBA dNXY/jmnwp1j5XzxWqzoDXhN3+p9H/3qYsGvufxl2qG9bbCOG1MhInpwbqjknDjjMv25 cgHQ== X-Gm-Message-State: APjAAAUjxt0WM17neUqH1xcHaFfKAGQRZbugqi82iMwSXb0rvYJqQ3VM +dTseF45X9/C5EHkaZmiRntcgg== X-Received: by 2002:a17:90b:3cc:: with SMTP id go12mr752934pjb.89.1579106520273; Wed, 15 Jan 2020 08:42:00 -0800 (PST) Received: from ?IPv6:2620:10d:c081:1132::1049? ([2620:10d:c090:180::4bca]) by smtp.gmail.com with ESMTPSA id d3sm21833134pfn.113.2020.01.15.08.41.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Jan 2020 08:41:59 -0800 (PST) Subject: Re: [PATCH] io_uring: fix compat for IORING_REGISTER_FILES_UPDATE To: Eugene Syromiatnikov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Alexander Viro Cc: linux-kernel@vger.kernel.org, Jeff Moyer , "Dmitry V. Levin" References: <20200115163538.GA13732@asgard.redhat.com> From: Jens Axboe Message-ID: Date: Wed, 15 Jan 2020 09:41:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200115163538.GA13732@asgard.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/15/20 9:35 AM, Eugene Syromiatnikov wrote: > fds field of struct io_uring_files_update is problematic with regards > to compat user space, as pointer size is different in 32-bit, 32-on-64-bit, > and 64-bit user space. In order to avoid custom handling of compat in > the syscall implementation, make fds __u64 and use u64_to_user_ptr in > order to retrieve it. Also, align the field naturally and check that > no garbage is passed there. Good point, it's an s32 pointer so won't align nicely. But how about just having it be: struct io_uring_files_update { __u32 offset; __u32 resv; __s32 *fds; }; which should align nicely on both 32 and 64-bit? -- Jens Axboe