[{"id":3682863,"web_url":"http://patchwork.ozlabs.org/comment/3682863/","msgid":"<ae-l4FGDPLwBuDXM@google.com>","list_archive_url":null,"date":"2026-04-27T18:07:28","subject":"Re: [RFC PATCH v1 5/9] uaccess: Switch to\n copy_{to/from}_user_partial()\n when relevant","submitter":{"id":89273,"url":"http://patchwork.ozlabs.org/api/people/89273/","name":"Alice Ryhl","email":"aliceryhl@google.com"},"content":"On Mon, Apr 27, 2026 at 07:13:46PM +0200, Christophe Leroy (CS GROUP) wrote:\n> diff --git a/rust/helpers/uaccess.c b/rust/helpers/uaccess.c\n> index 01de4fbbcc84..710e07cd60ae 100644\n> --- a/rust/helpers/uaccess.c\n> +++ b/rust/helpers/uaccess.c\n> @@ -5,13 +5,13 @@\n>  __rust_helper unsigned long\n>  rust_helper_copy_from_user(void *to, const void __user *from, unsigned long n)\n>  {\n> -\treturn copy_from_user(to, from, n);\n> +\treturn copy_from_user_partial(to, from, n);\n>  }\n>  \n>  __rust_helper unsigned long\n>  rust_helper_copy_to_user(void __user *to, const void *from, unsigned long n)\n>  {\n> -\treturn copy_to_user(to, from, n);\n> +\treturn copy_to_user_partial(to, from, n);\n>  }\n\nNo Rust code uses the return value for anything other than comparing it\nwith zero, so you can keep these as copy_[from|to]_user() without\nissues.\n\nThanks, Alice","headers":{"Return-Path":"\n <SRS0=JRFb=C2=vger.kernel.org=sparclinux+bounces-6736-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","sparclinux@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256\n header.s=20251104 header.b=cPn+SATK;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=jrfb=c2=vger.kernel.org=sparclinux+bounces-6736-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.234.253.10 arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=pass (p=reject dis=none) header.from=google.com","gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256\n header.s=20251104 header.b=cPn+SATK;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6736-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=google.com header.i=@google.com\n header.b=\"cPn+SATK\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.221.74","smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=google.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4BY55Pb0z1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 04:14:33 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g4BY546Xqz4wG7\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 04:14:33 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4g4BY540yxz4wG9; Tue, 28 Apr 2026 04:14:33 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g4BY21mq2z4wG7\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 04:14:30 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 07873311407D\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 27 Apr 2026 18:08:24 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 026C63EBF3D;\n\tMon, 27 Apr 2026 18:07:33 +0000 (UTC)","from mail-wr1-f74.google.com (mail-wr1-f74.google.com\n [209.85.221.74])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 6949C3E7165\n\tfor <sparclinux@vger.kernel.org>; Mon, 27 Apr 2026 18:07:31 +0000 (UTC)","by mail-wr1-f74.google.com with SMTP id\n ffacd0b85a97d-43d780757eeso6990912f8f.1\n        for <sparclinux@vger.kernel.org>;\n Mon, 27 Apr 2026 11:07:31 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777313673; cv=pass;\n\tb=x8o8zt/dFZX3+I7FOmICSgrE/JLX3sHjLzme7s+C8pTZEHsaS00M3ggCXCI7/I4Do5AtdbMGSDvBlqL9F223z1v6yqb1A+SJkjoewI4xgGL5X6rbbhNhXmif9X54nwL7fubXHf7naTvGob/hTQUK4RMyuf+8lgMV4vxqWG2hvO7mSt9WLoRiakAUrw8L8S+1XWIS8xSYQqDl0z/JFIJH+clcjpvM0QW68CBoqF5zNv3CTZw2PpFxgYFEisUTAC8Vc9YTgSZ1MrNgoZL6zqLIjVuSY3iifjnAcJ2RnQpVrSGVfv5KrG5cM2UtsetQC1kZP3Id4aRiwfeFDNLXXUBPmw==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777313253; cv=none;\n b=mRl9wx4IQRqcYAACwzNn2mW7FZkU0bwF5ZlKsBGuMGGyOGFUalW6B5OPZ1bpTogUXpdhWHDwOp0arEjyGoxiDntZHyP8CxLgonN7E6YDfFkCuW6wg/7UpgW+eEesYFyFclM1GG9gCuneuYB2ZpnKAjyF06SVIXxbdNM6VNf0RdU="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777313673; c=relaxed/relaxed;\n\tbh=HxkgeF4LNZGOlYkWj+Rbzgew6yzkspsu2lszfChr6II=;\n\th=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:\n\t To:Cc:Content-Type;\n b=uAVYp6uTCB2wOkDalgZCI99X92u3Pss/QS5FLazTDiq5FwbdubsNL/X3RSVfaxTh3c8L5prs+xg/2dnpDVazoOjcsrlrU8qty9suMsEQFX8Bhz+PXobmZmyPaYW8T+3SZTysyA1szpilNWHLiT83R4pWDwyRpD2aCset/Nu/j9C7YcPWLWktdxa7i0yvYk1X7uDdTbDARtNa79HOFKbAR1CQSJr+NqlctKDAbEohXBqDjYsnqwLpQHWsFX/fkh2ITCnRrwPk3DxFL4/+SKN9bsKYxeglCrDUY/v/dPU208emjoRCpFywr8xQ0ppMoIwxjT72nnnwaIi9OI+MsQkaQw==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777313253; c=relaxed/simple;\n\tbh=LJB/6F8gRS18jiwpo8qTgtmT08hQ2iYqeOWrm4IbRjM=;\n\th=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:\n\t To:Cc:Content-Type;\n b=BldjQnYYXYgpyDvP8HUGLI2wONd7sJMQ3WQ65Kf5Z7klp//PhhKyweD/TiHIGVIV/LqQaq6DCWoYE+TrooUPcYtYOvxJRgxodyXwNUMdGciWfYbwNkAkRxIXpz70nMgbXIXtYuyeTkAT8eoUDYvhg658GywZlaSV4yqY9iXuYWU="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=pass (p=reject dis=none) header.from=google.com;\n dkim=pass (2048-bit key;\n unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256\n header.s=20251104 header.b=cPn+SATK; dkim-atps=neutral;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6736-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=google.com;\n spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com;\n dkim=pass (2048-bit key) header.d=google.com header.i=@google.com\n header.b=cPn+SATK; arc=none smtp.client-ip=209.85.221.74"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=google.com; s=20251104; t=1777313250; x=1777918050;\n darn=vger.kernel.org;\n        h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n         :date:from:to:cc:subject:date:message-id:reply-to;\n        bh=HxkgeF4LNZGOlYkWj+Rbzgew6yzkspsu2lszfChr6II=;\n        b=cPn+SATKuQe+JOM/S0y9YehIYvugeCOq5rAxKMXfxKK+HYTUjsNnOR0yVrIzvX4r2g\n         DkCwv8WMJM0bFqL6Q1MTpaeN8Kzf/djGm/Z9E9tyzqUTSlefq/B1oqqWYHPq92z8599d\n         jSJ34C9mcPaflWs9Lkrsod+7aOZ7q7kzlW2NaRw9K+M4/LVBB5Paus9kqhXbvh5xbusq\n         6Zsgh/pkGT7LT1at8rk474twLKrJqcCWyaPawXIFA4F34mV6UVbAPFxd8BFU4K4U1vwG\n         VusBi9r03Y/j7QAjoasRoSju4+uGyRT8cdp1YRZxubLO2i+2GANpj53djrwGbhJHU2Yb\n         vaFg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777313250; x=1777918050;\n        h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n         :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n        bh=HxkgeF4LNZGOlYkWj+Rbzgew6yzkspsu2lszfChr6II=;\n        b=RowhFmskcQEc8+eMDip8h33CRLgb+56llN6YpzfYEszTpVB3/716GYcnKqb+2rfk9d\n         MKE96r5trfOD9mAGQHcNQdKqqNLV99223r2obXivZjq7MyfkjCNbsHWQ6g0AfP6dlMYf\n         UUqOA1WsZJO52+PROQLfanHPPG91nGzmF2IY6azEAFVc5ADChE49F64KHWQMu2mgH/lG\n         Pq3YIOwAvgZhVJ5wa3S/brzteYZmAablERYY+rXUHTd+jQ22DfGGGRH6B+J16cw3h6iE\n         ljil2iZXDjQlp9yXAfrjbumZZPh8FU+FI7ImGFJBo2IZFhObiDDBJvokouS36HBiDJYx\n         OHhQ==","X-Forwarded-Encrypted":"i=1;\n AFNElJ9LD2bxbZujnws5Gm4joKi+Frq1z74qxMGWaBgBfK6USi0soiC18vN3i6YgY40pF10tLEpqMEK73zqi@vger.kernel.org","X-Gm-Message-State":"AOJu0Yz0eRd+DRCYhJCNluKl3Lfe7agmo4c0CmzJkio70nbmnn5wZZ/F\n\tfrY2UAVB1GXimtQmaDs8nIBRU5QSIJ27+vNE2tMZZAjAEyEf+kRqwD94yu59WjMFgFB0PGiOCXS\n\tJ7+CXf3UC+hNdlEED5w==","X-Received":"from wrmd3.prod.google.com ([2002:adf:e883:0:b0:43d:7940:a11b])\n (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by\n 2002:a05:6000:41c7:b0:43d:799c:b2cb with SMTP id\n ffacd0b85a97d-44636a393e7mr256856f8f.24.1777313249648;\n Mon, 27 Apr 2026 11:07:29 -0700 (PDT)","Date":"Mon, 27 Apr 2026 18:07:28 +0000","In-Reply-To":"\n <289b424e243ba2c4139ea04009cf8b9c448a87ff.1777306795.git.chleroy@kernel.org>","Precedence":"bulk","X-Mailing-List":"sparclinux@vger.kernel.org","List-Id":"<sparclinux.vger.kernel.org>","List-Subscribe":"<mailto:sparclinux+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:sparclinux+unsubscribe@vger.kernel.org>","Mime-Version":"1.0","References":"<cover.1777306795.git.chleroy@kernel.org>\n <289b424e243ba2c4139ea04009cf8b9c448a87ff.1777306795.git.chleroy@kernel.org>","Message-ID":"<ae-l4FGDPLwBuDXM@google.com>","Subject":"Re: [RFC PATCH v1 5/9] uaccess: Switch to\n copy_{to/from}_user_partial()\n when relevant","From":"Alice Ryhl <aliceryhl@google.com>","To":"\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>","Cc":"Yury Norov <ynorov@nvidia.com>, Andrew Morton <akpm@linux-foundation.org>,\n\tLinus Torvalds <torvalds@linux-foundation.org>,\n David Laight <david.laight.linux@gmail.com>,\n\tThomas Gleixner <tglx@linutronix.de>, linux-alpha@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org,\n\tlinux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,\n\tlinuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,\n\tlinux-riscv@lists.infradead.org, linux-s390@vger.kernel.org,\n\tsparclinux@vger.kernel.org, linux-um@lists.infradead.org,\n\tdmaengine@vger.kernel.org, linux-efi@vger.kernel.org,\n\tlinux-fsi@lists.ozlabs.org, amd-gfx@lists.freedesktop.org,\n\tdri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,\n\tlinux-wpan@vger.kernel.org, netdev@vger.kernel.org,\n\tlinux-wireless@vger.kernel.org, linux-spi@vger.kernel.org,\n\tlinux-media@vger.kernel.org, linux-staging@lists.linux.dev,\n\tlinux-serial@vger.kernel.org, linux-usb@vger.kernel.org,\n\txen-devel@lists.xenproject.org, linux-fsdevel@vger.kernel.org,\n\tocfs2-devel@lists.linux.dev, bpf@vger.kernel.org, kasan-dev@googlegroups.com,\n\tlinux-mm@kvack.org, linux-x25@vger.kernel.org,\n rust-for-linux@vger.kernel.org,\n\tlinux-sound@vger.kernel.org, sound-open-firmware@alsa-project.org,\n\tlinux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org,\n\tloongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org,\n\tlinux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org,\n\tlinux-sh@vger.kernel.org, linux-arch@vger.kernel.org","Content-Type":"text/plain; charset=\"utf-8\"","X-Spam-Status":"No, score=-8.7 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tHEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,\n\tSPF_PASS,USER_IN_DEF_DKIM_WL autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"}},{"id":3682901,"web_url":"http://patchwork.ozlabs.org/comment/3682901/","msgid":"<CAHk-=whC1DZojwdMB1=sJWG2=dsCdfyU8N6tDE1qx50HRZ-WJQ@mail.gmail.com>","list_archive_url":null,"date":"2026-04-27T19:01:23","subject":"Re: [RFC PATCH v1 5/9] uaccess: Switch to\n copy_{to/from}_user_partial()\n when relevant","submitter":{"id":97,"url":"http://patchwork.ozlabs.org/api/people/97/","name":"Linus Torvalds","email":"torvalds@linux-foundation.org"},"content":"On Mon, 27 Apr 2026 at 10:18, Christophe Leroy (CS GROUP)\n<chleroy@kernel.org> wrote:\n>\n> In a subsequent patch, copy_{to/from}_user() will be modified to\n> return -EFAULT when copy fails.\n\nPlease don't do this.\n\nThis is a maintenance nightmare, and changes pretty much three decades\nof semantics, and will cause *very* subtle backporting issues if\nsomebody happens to rely on the old / new behavior.\n\nI understand the reasoning for the change, but I really don't think\nthe pain of creating yet another user copy interface is worth it.\n\nWe already have a lot of different versions of user copies for\ndifferent reasons, and while they all tend to have a good reason (and\nsome not-so-good, but historical reasons) for existing, this one\ndoesn't seem worth it.\n\nThe main - perhaps only - reason for this \"partial\" version is that\nyou want to do that \"automatically inlined and optimized fixed-sized\ncase\".\n\nBut here's the thing: I think you can already do that. Yes, it\nrequires some improvements to unsafe_copy_from_user(), but *that*\ninterface doesn't have three decades of history associated with it,\n_and_ you're extending on that one anyway in this series.\n\n\"unsafe_copy_from_user()\" is very odd, is meant only for small simple\ncopies that can be inlined and it's special-cased for 'objtool' anyway\n(because objtool would have complained about an out-of-line call,\nalthough it could have been special-cased other ways).\n\nIn other words: unsafe_copy_from_user() is *very* close to what you\nwant for that \"Oh, I noticed that it's a small fixed-size copy, so I\nwant to special-case copy-from-user for that\".\n\nThe _only_ issue with unsafe_copy_from_user() is that you can't see\nthat there were partial successes. But if *that* was fixed, then this\nwhole \"create a new copy_from_user interface\" issue would just go\naway.\n\nSo please - let's just change unsafe_copy_from_user() to be usable for\nthe partial case.\n\nAnd the thing is, all the existing unsafe_copy_from_user()\nimplementations already effectively *have* the \"how much did I not\ncopy\" internally, and they actually do extra work to hide it, ie they\nhave things like that\n\n        int _i;\n\nthat is \"how many bytes have I copied\" in the powerpc implementation,\nor the x86 code does\n\n        size_t __ucu_len = (_len);\n\nwhere that \"ucu_len\" is updated as you go along and is literally the\n\"how many bytes are left to copy\" return value that is missing from\nthis interface.\n\nSo what I would suggest is\n\n - introduce a new user accessor helper that is used for *both*\nunsafe_copy_to/from_user() *and* the \"inline small constant-sized\nnormal copy_to/from_user()\" calls\n\n - it's the same thing as the existing  unsafe_copy_to/from_user()\nimplementation, except it exposes how many bytes are left to be copied\nto the exception label.\n\nIOW, it would look something like\n\n     #define unsafe_copy_to_user_outlen(_dst,_src,_len,label)...\n\nwhich is exactly the same as the current unsafe_copy_to_user(),\n*except* it changes \"_len\" as it does along.\n\nAnd then you use that for both the \"real\" unsafe_copy_user and for the\n\"small constant values\" case.\n\nJust as an example, attached is a completely stupid rough draft of a\npatch that does this for x86 and only for unsafe_copy_to_user().\n\nAnd I made a very very hacky change to kernel/sys.c to see what the\ncode generation looks like.\n\nThis is what it results in on x86 with clang (with all the magic\n.section data edited out):\n\n        ... edited out the code to generate the times\n        ... this is the actual user copy:\n        # HERE!\n        movabsq $81985529216486895, %rcx        # imm = 0x123456789ABCDEF\n        cmpq    %rcx, %rbx\n        cmovaq  %rcx, %rbx\n        stac\n        movq    %r13, (%rbx)                    # exception to .LBB45_8\n        movq    %r14, 8(%rbx)                   # exception to .LBB45_8\n        movq    %r15, 16(%rbx)                  # exception to .LBB45_8\n        movq    %rax, 24(%rbx)                  # exception to .LBB45_8\n        clac\n.LBB45_6:\n        movq    jiffies(%rip), %rdi\n        callq   jiffies_64_to_clock_t\n.LBB45_7:\n        addq    $16, %rsp\n        popq    %rbx\n        popq    %r12\n        popq    %r13\n        popq    %r14\n        popq    %r15\n        retq\n.LBB45_8:\n        clac\n        movq    $-14, %rax\n        jmp     .LBB45_7\n\nand notice how the compiler noticed that the 'outlen' isn't actually\nused, and turned the exception label into just a \"return -EFAULT\" and\nnever actually generated any code for updating remaining lengths?\n\nThat actually looks pretty much optimal for a 32-byte user copy.\n\nAnd it didn't involve changing the semantics at all.\n\nJust to check, I changed that \"times()\" system call to return the\nnumber of bytes uncopied instead (to emulate the \"I actually want to\nknow what's left\" case), and it generated this:\n\n        # HERE!\n        movabsq $81985529216486895, %rcx        # imm = 0x123456789ABCDEF\n        cmpq    %rcx, %rbx\n        cmovaq  %rcx, %rbx\n        stac\n        movl    $32, %ecx\n        movq    %r13, (%rbx)                    # exception to .LBB45_7\n        movl    $24, %ecx\n        movq    %r15, 8(%rbx)                   # exception to .LBB45_7\n        movl    $16, %ecx\n        movq    %r14, 16(%rbx)                  # exception to .LBB45_7\n        movl    $8, %ecx\n        movq    %rax, 24(%rbx)                  # exception to .LBB45_7\n        clac\n        xorl    %ecx, %ecx\n.LBB45_8:\n        movq    %rcx, %rax\n        addq    $16, %rsp\n        popq    %rbx\n        popq    %r12\n        popq    %r13\n        popq    %r14\n        popq    %r15\n        retq\n.LBB45_6:\n        movq    jiffies(%rip), %rdi\n        jmp     jiffies_64_to_clock_t           # TAILCALL\n.LBB45_7:\n        clac\n        jmp     .LBB45_8\n\nso it all seems to work - although obviously the above is *not* the normal case.\n\nNOTE NOTE NOTE! The attached patch is entirely untested. I obviously\ndid some \"test code generation\" with it, but I only *looked* at the\nresult, and maybe it has some fundamental problem that I just didn't\nnotice. So treat this as a \"how about this approach\" patch, not as\nanything more serious than that.\n\nAnd the kerrnel/sys.c hack is very obviously just that: a complate\nhack for testing.\n\nA real patch would do that \"for small constant-sized copies, turn\ncopy_to_user() automatically into \"_small_copy_to_user()\".\n\nThe attached is *not* a real patch. Treat it with the contempt it deserves.\n\n             Linus","headers":{"Return-Path":"\n <SRS0=uaTu=C2=vger.kernel.org=sparclinux+bounces-6740-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","sparclinux@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org\n header.a=rsa-sha256 header.s=google header.b=YJfFXTp7;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=uatu=c2=vger.kernel.org=sparclinux+bounces-6740-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c0a:e001:db::12fc:5321\"\n arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=linux-foundation.org","gandalf.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org\n header.a=rsa-sha256 header.s=google header.b=YJfFXTp7;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6740-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux-foundation.org\n header.i=@linux-foundation.org header.b=\"YJfFXTp7\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.208.174","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=linux-foundation.org","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linuxfoundation.org"],"Received":["from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4Csf5M3fz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 05:13:58 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g4Csf58y3z4wB9\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 05:13:58 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4g4Csf4wJNz4wJR; Tue, 28 Apr 2026 05:13:58 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g4Csb2y4xz4wB9\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 05:13:55 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id C03DF305E117\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 27 Apr 2026 19:07:40 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E2E6C3EE1FA;\n\tMon, 27 Apr 2026 19:07:39 +0000 (UTC)","from mail-lj1-f174.google.com (mail-lj1-f174.google.com\n [209.85.208.174])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 4516B3EDADB\n\tfor <sparclinux@vger.kernel.org>; Mon, 27 Apr 2026 19:07:38 +0000 (UTC)","by mail-lj1-f174.google.com with SMTP id\n 38308e7fff4ca-38e96a071c3so107817301fa.0\n        for <sparclinux@vger.kernel.org>;\n Mon, 27 Apr 2026 12:07:38 -0700 (PDT)","from mail-lf1-f41.google.com (mail-lf1-f41.google.com.\n [209.85.167.41])\n        by smtp.gmail.com with ESMTPSA id\n 38308e7fff4ca-3923f55edafsm664941fa.29.2026.04.27.12.07.35\n        for <sparclinux@vger.kernel.org>\n        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n        Mon, 27 Apr 2026 12:07:35 -0700 (PDT)","by mail-lf1-f41.google.com with SMTP id\n 2adb3069b0e04-59dea72099eso11736973e87.0\n        for <sparclinux@vger.kernel.org>;\n Mon, 27 Apr 2026 12:07:35 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777317238; cv=pass;\n\tb=RXHOpwGx7Z7XguwTgEH9b9Znlw7XLr/7pHIZ5ql5f4+0ixVucLfQ8c2J3/UcnVqHHpwc1TgjnGmzCf8WYYud8pXopmJQg2xIcpc+weIst7EsI1hsLIXoDgfHlHQ65h49dNeoxsMsEAkyz+BBGLNh7zasG8yioJDFHdSBjaUkFAX6VpxAyDx5WIg9wc1xhZLTzD+hkkV1GTBeuCg2wmUPfVMcZyJN3mwVlhg8l4gdoX+lZra5asQbuExnU3r/1EoGZbT1SJPVb718kLMkiHGB8juXLmwVpp3+9tJq4MB9IaXdwkFfwS1dSkazyB2J58svSVfDIckafe4EEZecN1/Lug==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777316859; cv=none;\n b=IpWmUIcdP3VR2ZdOCuDoYlVWOCGyC+mIFwmOGXx3XHSjoMg/ycZrAtHgBtzKOuiWnq4GJsa7H8uSk95jRG7HPwfiADgO1gRhsmLGofz7OU16Ryrby00WpzXn8x+QeS+AJ5nAdKGp/qm+0zTupiIXNKHTRMqJYynBqvFHD3ghSIA="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777317238; c=relaxed/relaxed;\n\tbh=eo95+vxRQveZjyTXx2nQjz3zXl5qvV2nK5Gunw4PJlE=;\n\th=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:\n\t To:Cc:Content-Type;\n b=MbPEqdg+5IFdXXl2muEnahtDs05R9diZns0tBqps0xjMDz2z5nD4oe5h0xLsrUn+Xr+Q6LVpDtfwvDZh3kRuili4dZ7IUoVohqUFPmYSqhVlrZammj9fV3ah74NTfjPFBdyddM3N1ObRFrJylbfH2J1XDE4s8QfMoZNOojFkYCHZj+b0XT0jpRUb50TdctCoH+VRRp8FPYFpKKJCJmqExXWxTCamvuyJ9V3QAEYnpPz+ba3oW+Zx5v3zbIIFjSB8bpQfAw8rkm5+NDHW/uOFzw8dk+sWrf1nv3L1PomV5VSSxdY1hsgf4U4XSGwEpeoZJmB2ys/2c6XFiWjZ0MTHUA==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777316859; c=relaxed/simple;\n\tbh=uZcs19/Xz2Ob/TZtlFxfTZJJVxYMOQeT/up2L3GOvIQ=;\n\th=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:\n\t To:Cc:Content-Type;\n b=uziCHmvpaSfaSeQGv2qUOXkiYTt8/i79UDyPzD2CA2obvGWkMIya3LfTHoLjMaxVq8NhtuXjvPv976/eb9/YlLtokiFpL/VuSxXNsTsWntLBT3op/UNyHzXuSgZKhWVTPxfXTB3U/HlTLd8wmfWg5aJ0wiPBTa7wczvjKXtoNNo="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=linux-foundation.org;\n dkim=pass (1024-bit key;\n unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org\n header.a=rsa-sha256 header.s=google header.b=YJfFXTp7; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6740-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=linux-foundation.org;\n spf=pass smtp.mailfrom=linuxfoundation.org;\n dkim=pass (1024-bit key) header.d=linux-foundation.org\n header.i=@linux-foundation.org header.b=YJfFXTp7;\n arc=none smtp.client-ip=209.85.208.174"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=linux-foundation.org; s=google; t=1777316856; x=1777921656;\n darn=vger.kernel.org;\n        h=cc:to:subject:message-id:date:from:in-reply-to:references\n         :mime-version:from:to:cc:subject:date:message-id:reply-to;\n        bh=eo95+vxRQveZjyTXx2nQjz3zXl5qvV2nK5Gunw4PJlE=;\n        b=YJfFXTp7WbJ3sv6ch7YW2jUMmVh8xaF5VjzGmWordtOmIYt6okTOPYt5IdCw0zSaSR\n         4/TbVmg95zrc4V5QO1SD0mrtEeHJBd+grwniGzQqi8/EM+GEw0FDztzLzSjQ65roqkc7\n         uE47AdCELs+17kV6Bqosl1MdY0Inm4PF3FHIk=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777316856; x=1777921656;\n        h=cc:to:subject:message-id:date:from:in-reply-to:references\n         :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=eo95+vxRQveZjyTXx2nQjz3zXl5qvV2nK5Gunw4PJlE=;\n        b=DsOFARcXnBsycNNb/wANbqgabUZYlAWU5yAMl8DAIsjnRRsfDgeAxFPWIQohSIIP1z\n         qEVxrsh4bMfx1RMRnplsfRtE6uKjM0/gKz/ZCz+VcG+897gSIVBUwKRcJIFYKbCzv3wd\n         9UDp/Mp0j0L5oGWO9zy0fR9lVSkWHFmEEuCNZIOWLwpTkcGGPasr0BWd+rDE3CIz9g4+\n         KCnz77jvQJ12UqLu7omPmVzEmakSYTyPjh4rImuv2T2AYl4lbSkRE2ADWT3ZO2qb1wty\n         d7yqOHaazlp7r3s2v5ry7TGWdm9CzNt5/rRom4u29rbDJKMrykmv3nLRAYDAMC4rGsJg\n         bTfw==","X-Forwarded-Encrypted":["i=1;\n AFNElJ886QyhGNEAOSAITnPBKR35c/XDaBiXsaoXe6Bn1Y+GP9YrTRtnBaXtGOa8ccvMxnomHMMHLXX4AS5Q@vger.kernel.org","i=1;\n AFNElJ+VzqIR+r0YTW/wCAodRGUojUS1nXRO2lfJjUxjmweZGRK+CYK/PN4yqJVm8O16wkj3Fpyjp4t1+D6A@vger.kernel.org"],"X-Gm-Message-State":"AOJu0Ywe/hJ53ljEVcZxjv9nOBuSPuW2ZMNxJe9Mr2YESzLfmfeELO+s\n\tkxhZR5GM2BKfIWv8sNbWgYgBEcOoxEqHN2QGgTHh2bhorrQt7yK19HcyLCPcEcKBJjxbNiFa/+t\n\tKbTJ6v6vZ8Q==","X-Gm-Gg":"AeBDiesXGYDS9bVRIkjCX3+SACWbeKt/a1E8OdPc8chX/9OyZK7WYgKrZDqTU6l8XWs\n\tP6lzasBNXR5FDzapX3ak9unRNFbQu/PIOmoZrIG6xz+hVPIfPcdq1nB9ygGe/FdmVp/ce8j7lbp\n\tuMc3GpG8n1taCTZLt1phoxHv1VioOsQZgD5eSVmYtqW1Nl+hiZW+p3vjh0F+hcMnzflIH3abr4e\n\t6v1dlMH0KoAjFxWfUz7b1pD4RbWxSUCDoigEQkg87oYiqdyKUGE9FXPkRSSL2RuItDZ/x+MmAuh\n\tij7Jxv+FyXtjAPbaHObyEMdg1l5tIQVe2GyEF/GcijJkXTMBg72H1ISrEoN2N8Z1/44kq8bdV6/\n\tC6/UGzmNk3uVO6pOUiR+WOqSvgCVmfZ3wjTyP00u4zeDFj46Wj8ftQWdL7MIvo8fnW8xZRm/eVO\n\tqrKigZ8IIbjguBgrFSWPRp5jOe0ybDo8qWXEUGLfB3ckG+L7RYzyzmRSEghp2C0Fehol9N/6oO8\n\tr6+ta6wBeE=","X-Received":["by 2002:a2e:b1d4:0:b0:389:fa42:b266 with SMTP id\n 38308e7fff4ca-3923ecebf43mr1801421fa.11.1777316856188;\n        Mon, 27 Apr 2026 12:07:36 -0700 (PDT)","by 2002:a17:907:9495:b0:ba3:a8ef:3597 with SMTP id\n a640c23a62f3a-bb80443c92emr2812866b.25.1777316502372; Mon, 27 Apr 2026\n 12:01:42 -0700 (PDT)"],"Precedence":"bulk","X-Mailing-List":"sparclinux@vger.kernel.org","List-Id":"<sparclinux.vger.kernel.org>","List-Subscribe":"<mailto:sparclinux+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:sparclinux+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","References":"<cover.1777306795.git.chleroy@kernel.org>\n <289b424e243ba2c4139ea04009cf8b9c448a87ff.1777306795.git.chleroy@kernel.org>","In-Reply-To":"\n <289b424e243ba2c4139ea04009cf8b9c448a87ff.1777306795.git.chleroy@kernel.org>","From":"Linus Torvalds <torvalds@linux-foundation.org>","Date":"Mon, 27 Apr 2026 12:01:23 -0700","X-Gmail-Original-Message-ID":"\n <CAHk-=whC1DZojwdMB1=sJWG2=dsCdfyU8N6tDE1qx50HRZ-WJQ@mail.gmail.com>","X-Gm-Features":"AVHnY4JOOuu1ghb35GF5M7sO3SAfkj4A7WtLiFNY579kWyh92WWRKfW5QE_KjRI","Message-ID":"\n <CAHk-=whC1DZojwdMB1=sJWG2=dsCdfyU8N6tDE1qx50HRZ-WJQ@mail.gmail.com>","Subject":"Re: [RFC PATCH v1 5/9] uaccess: Switch to\n copy_{to/from}_user_partial()\n when relevant","To":"\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>","Cc":"Yury Norov <ynorov@nvidia.com>, Andrew Morton <akpm@linux-foundation.org>,\n\tDavid Laight <david.laight.linux@gmail.com>,\n Thomas Gleixner <tglx@linutronix.de>,\n\tlinux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tlinux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org,\n\tlinux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,\n\tkvm@vger.kernel.org, linux-riscv@lists.infradead.org,\n\tlinux-s390@vger.kernel.org, sparclinux@vger.kernel.org,\n\tlinux-um@lists.infradead.org, dmaengine@vger.kernel.org,\n\tlinux-efi@vger.kernel.org, linux-fsi@lists.ozlabs.org,\n\tamd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,\n\tintel-gfx@lists.freedesktop.org, linux-wpan@vger.kernel.org,\n\tnetdev@vger.kernel.org, linux-wireless@vger.kernel.org,\n\tlinux-spi@vger.kernel.org, linux-media@vger.kernel.org,\n\tlinux-staging@lists.linux.dev, linux-serial@vger.kernel.org,\n\tlinux-usb@vger.kernel.org, xen-devel@lists.xenproject.org,\n\tlinux-fsdevel@vger.kernel.org, ocfs2-devel@lists.linux.dev,\n\tbpf@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org,\n\tlinux-x25@vger.kernel.org, rust-for-linux@vger.kernel.org,\n\tlinux-sound@vger.kernel.org, sound-open-firmware@alsa-project.org,\n\tlinux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org,\n\tloongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org,\n\tlinux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org,\n\tlinux-sh@vger.kernel.org, linux-arch@vger.kernel.org","Content-Type":"multipart/mixed; boundary=\"000000000000c765e2065075bee2\"","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_MISSING,\n\tHEADER_FROM_DIFFERENT_DOMAINS,LOTS_OF_MONEY,MAILING_LIST_MULTI,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"}},{"id":3683011,"web_url":"http://patchwork.ozlabs.org/comment/3683011/","msgid":"<20260427222914.1cb2dd3b@pumpkin>","list_archive_url":null,"date":"2026-04-27T21:29:14","subject":"Re: [RFC PATCH v1 5/9] uaccess: Switch to\n copy_{to/from}_user_partial() when relevant","submitter":{"id":89989,"url":"http://patchwork.ozlabs.org/api/people/89989/","name":"David Laight","email":"david.laight.linux@gmail.com"},"content":"On Mon, 27 Apr 2026 12:01:23 -0700\nLinus Torvalds <torvalds@linux-foundation.org> wrote:\n\n> On Mon, 27 Apr 2026 at 10:18, Christophe Leroy (CS GROUP)\n> <chleroy@kernel.org> wrote:\n> >\n> > In a subsequent patch, copy_{to/from}_user() will be modified to\n> > return -EFAULT when copy fails.  \n> \n> Please don't do this.\n> \n> This is a maintenance nightmare, and changes pretty much three decades\n> of semantics, and will cause *very* subtle backporting issues if\n> somebody happens to rely on the old / new behavior.\n> \n> I understand the reasoning for the change, but I really don't think\n> the pain of creating yet another user copy interface is worth it.\n> \n> We already have a lot of different versions of user copies for\n> different reasons, and while they all tend to have a good reason (and\n> some not-so-good, but historical reasons) for existing, this one\n> doesn't seem worth it.\n> \n> The main - perhaps only - reason for this \"partial\" version is that\n> you want to do that \"automatically inlined and optimized fixed-sized\n> case\".\n> \n> But here's the thing: I think you can already do that. Yes, it\n> requires some improvements to unsafe_copy_from_user(), but *that*\n> interface doesn't have three decades of history associated with it,\n> _and_ you're extending on that one anyway in this series.\n> \n> \"unsafe_copy_from_user()\" is very odd, is meant only for small simple\n> copies that can be inlined and it's special-cased for 'objtool' anyway\n> (because objtool would have complained about an out-of-line call,\n> although it could have been special-cased other ways).\n> \n> In other words: unsafe_copy_from_user() is *very* close to what you\n> want for that \"Oh, I noticed that it's a small fixed-size copy, so I\n> want to special-case copy-from-user for that\".\n> \n> The _only_ issue with unsafe_copy_from_user() is that you can't see\n> that there were partial successes. But if *that* was fixed, then this\n> whole \"create a new copy_from_user interface\" issue would just go\n> away.\n> \n> So please - let's just change unsafe_copy_from_user() to be usable for\n> the partial case.\n> \n> And the thing is, all the existing unsafe_copy_from_user()\n> implementations already effectively *have* the \"how much did I not\n> copy\" internally, and they actually do extra work to hide it, ie they\n> have things like that\n> \n>         int _i;\n> \n> that is \"how many bytes have I copied\" in the powerpc implementation,\n> or the x86 code does\n> \n>         size_t __ucu_len = (_len);\n> \n> where that \"ucu_len\" is updated as you go along and is literally the\n> \"how many bytes are left to copy\" return value that is missing from\n> this interface.\n> \n> So what I would suggest is\n> \n>  - introduce a new user accessor helper that is used for *both*\n> unsafe_copy_to/from_user() *and* the \"inline small constant-sized\n> normal copy_to/from_user()\" calls\n> \n>  - it's the same thing as the existing  unsafe_copy_to/from_user()\n> implementation, except it exposes how many bytes are left to be copied\n> to the exception label.\n\nI think there is a slight difference in that the normal copy_to_user()\nwill determine the exact offset of the error by retrying with byte copies.\n\nThere is also the issue of misaligned copies.\n\nThen there is the 'bugbear' of hardened user copies.\nChasing down the stack to find whether the kernel buffer crosses\na stack frame is probably more expensive than the copy for the typically\nsmall copies that will use on-stack buffers.\n\n\tDavid\n\n> \n> IOW, it would look something like\n> \n>      #define unsafe_copy_to_user_outlen(_dst,_src,_len,label)...\n> \n> which is exactly the same as the current unsafe_copy_to_user(),\n> *except* it changes \"_len\" as it does along.\n> \n> And then you use that for both the \"real\" unsafe_copy_user and for the\n> \"small constant values\" case.\n> \n> Just as an example, attached is a completely stupid rough draft of a\n> patch that does this for x86 and only for unsafe_copy_to_user().\n> \n> And I made a very very hacky change to kernel/sys.c to see what the\n> code generation looks like.\n> \n> This is what it results in on x86 with clang (with all the magic\n> .section data edited out):\n> \n>         ... edited out the code to generate the times\n>         ... this is the actual user copy:\n>         # HERE!\n>         movabsq $81985529216486895, %rcx        # imm = 0x123456789ABCDEF\n>         cmpq    %rcx, %rbx\n>         cmovaq  %rcx, %rbx\n>         stac\n>         movq    %r13, (%rbx)                    # exception to .LBB45_8\n>         movq    %r14, 8(%rbx)                   # exception to .LBB45_8\n>         movq    %r15, 16(%rbx)                  # exception to .LBB45_8\n>         movq    %rax, 24(%rbx)                  # exception to .LBB45_8\n>         clac\n> .LBB45_6:\n>         movq    jiffies(%rip), %rdi\n>         callq   jiffies_64_to_clock_t\n> .LBB45_7:\n>         addq    $16, %rsp\n>         popq    %rbx\n>         popq    %r12\n>         popq    %r13\n>         popq    %r14\n>         popq    %r15\n>         retq\n> .LBB45_8:\n>         clac\n>         movq    $-14, %rax\n>         jmp     .LBB45_7\n> \n> and notice how the compiler noticed that the 'outlen' isn't actually\n> used, and turned the exception label into just a \"return -EFAULT\" and\n> never actually generated any code for updating remaining lengths?\n> \n> That actually looks pretty much optimal for a 32-byte user copy.\n> \n> And it didn't involve changing the semantics at all.\n> \n> Just to check, I changed that \"times()\" system call to return the\n> number of bytes uncopied instead (to emulate the \"I actually want to\n> know what's left\" case), and it generated this:\n> \n>         # HERE!\n>         movabsq $81985529216486895, %rcx        # imm = 0x123456789ABCDEF\n>         cmpq    %rcx, %rbx\n>         cmovaq  %rcx, %rbx\n>         stac\n>         movl    $32, %ecx\n>         movq    %r13, (%rbx)                    # exception to .LBB45_7\n>         movl    $24, %ecx\n>         movq    %r15, 8(%rbx)                   # exception to .LBB45_7\n>         movl    $16, %ecx\n>         movq    %r14, 16(%rbx)                  # exception to .LBB45_7\n>         movl    $8, %ecx\n>         movq    %rax, 24(%rbx)                  # exception to .LBB45_7\n>         clac\n>         xorl    %ecx, %ecx\n> .LBB45_8:\n>         movq    %rcx, %rax\n>         addq    $16, %rsp\n>         popq    %rbx\n>         popq    %r12\n>         popq    %r13\n>         popq    %r14\n>         popq    %r15\n>         retq\n> .LBB45_6:\n>         movq    jiffies(%rip), %rdi\n>         jmp     jiffies_64_to_clock_t           # TAILCALL\n> .LBB45_7:\n>         clac\n>         jmp     .LBB45_8\n> \n> so it all seems to work - although obviously the above is *not* the normal case.\n> \n> NOTE NOTE NOTE! The attached patch is entirely untested. I obviously\n> did some \"test code generation\" with it, but I only *looked* at the\n> result, and maybe it has some fundamental problem that I just didn't\n> notice. So treat this as a \"how about this approach\" patch, not as\n> anything more serious than that.\n> \n> And the kerrnel/sys.c hack is very obviously just that: a complate\n> hack for testing.\n> \n> A real patch would do that \"for small constant-sized copies, turn\n> copy_to_user() automatically into \"_small_copy_to_user()\".\n> \n> The attached is *not* a real patch. Treat it with the contempt it deserves.\n> \n>              Linus","headers":{"Return-Path":"\n <SRS0=xMr9=C2=vger.kernel.org=sparclinux+bounces-6745-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","sparclinux@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=pM4bEk+K;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=xmr9=c2=vger.kernel.org=sparclinux+bounces-6745-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.234.253.10 arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=pM4bEk+K;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6745-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"pM4bEk+K\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.128.50","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4GvV4pcJz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 07:30:46 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g4GvP2PFNz4wJk\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 07:30:41 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4g4GvP2JsJz4wL8; Tue, 28 Apr 2026 07:30:41 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g4GvK6gY6z4wJk\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 07:30:37 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id D6CBC307FFEA\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 27 Apr 2026 21:29:28 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 33B38385511;\n\tMon, 27 Apr 2026 21:29:25 +0000 (UTC)","from mail-wm1-f50.google.com (mail-wm1-f50.google.com\n [209.85.128.50])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id E665537CD50\n\tfor <sparclinux@vger.kernel.org>; Mon, 27 Apr 2026 21:29:19 +0000 (UTC)","by mail-wm1-f50.google.com with SMTP id\n 5b1f17b1804b1-488b0e1b870so182017295e9.2\n        for <sparclinux@vger.kernel.org>;\n Mon, 27 Apr 2026 14:29:19 -0700 (PDT)","from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36])\n        by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-4463d02f270sm1120515f8f.9.2026.04.27.14.29.16\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Mon, 27 Apr 2026 14:29:17 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777325441; cv=pass;\n\tb=rAnS60mBoRYQQC8GY4KEeGSQ7+AJ8MBEHn2XsNuR9HcnHt0a/IqsDvz2/fXna3gtgPwzw+JcbsEgfNX99W2UNJNPlyDvzZL3snmx1eShy6kF9tQGhX8O/hqcXOwy/T7AR3S8hNLuZYU2kFO1N5eeKoggv11Sn1ZcT6Pkm5MSI1dfdDoYlcBrd3kI+Ts95BLdSMoKEAgMX6ABtNKYaokXaQJCgiEjoQaWRsfdy+gkEMQlCQhJDY8ZAlEvGMIG9mbCo/9oprEPKzkNuIEZdatjixEXuxxPbAj0Dg8+ugL5TcoNpAwzH1dGhE0o3wewe++4M1qjV5/9ZDSM3yNMXYJOiA==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777325365; cv=none;\n b=m08T0AjLAr8E/01x/HhJ+YMjYpNwHlYMxE2gWB2rJ8AQqwVV4CrLXiG55MFPsWpFqcjfgzAy6foHFvB3KAyEo/BDDyhHSnKXLuoXGykBGPidBkmF19Vlu1oMlf2HV1HU7iYKJweIS0IsDWpRVdI5VHlz7qMcLw3dt+uCveHWMeQ="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777325441; c=relaxed/relaxed;\n\tbh=Ebg5+i/pOUuQx7xxuERTUppaj1qL6vIxTxgv86V/NC0=;\n\th=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=SnoVhYogmVrTJxRx7tdWN2MQ8QwQbQWdPeBX8hrjejJxUIV6VaHgzSOXWvY5/XT8K6tPPh48vKs1sJH5Jkvhu/dACZD9JlJ4GzKUAYD76u2/yMUMaROIXikJpbCDxV5A9FXt4Ndu+lDrm5Ca9kpdsS0dub8GSxYWTYkDshlgmKVaw4jQJ/It5Cidz38F4ESm3pSy0kyo3MT9qTTmmGF5T6NjRl6Ho1DsDfKQO8AUBFwaR8Z3+1u1YRWGzXddjUW7CtCjtp70VwVuQPkpqsuB2EZ+AK3EDNX9O/14xctuoh/Rk6ncn7imlMtexC5WCpP6X8AfbnMk9We+l/BKHBhfew==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777325365; c=relaxed/simple;\n\tbh=c8Xs8XIDe+SZyyGBpFGQP0PqyLAvYREVB87ThsvQG6c=;\n\th=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=r79QF4tg8OrJu5D7Dw7nKqdqQG0Oy6Uq9Aij0aefjijKBnPkWmLgjXef3ocZlMqj8uHvsRCY6KRg9k18H3fZ+cyCaKnn3R3fx7Z6hhCmwUA6Oi+bPJZ+oAD8pft2NRGkldz6t6BK/uHrsVnY+0asDxReMv2vzWju2zdNgUCiMuI="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com; dkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=pM4bEk+K; dkim-atps=neutral;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6745-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=pM4bEk+K; arc=none smtp.client-ip=209.85.128.50"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1777325358; x=1777930158;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:subject:cc:to:from:date:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=Ebg5+i/pOUuQx7xxuERTUppaj1qL6vIxTxgv86V/NC0=;\n        b=pM4bEk+KWuVJs1U70UMTYiYKMTMTofFbWReYwBWyqhmru6Y2DXeQu1JWql0TDyt+VP\n         KU6iTZ27w00J1ijxYV/Il69CxIz0aEodyojX5hvux8QzDCUptjfpO0GxqEopdd5J7LQe\n         xWtNPQshDR5+AecefO+G7XCDnANkqrKF5HDpjRP71LYSISipG8uBZw3Llvrz/plVREw8\n         7hx+6bhgCNzpupXctGieSqZ7959V9vurIkn5LhYgBA0CLbIQE+NEBCLE9iwlyuxnjMVK\n         9ppisP58FPLXgdtkUISOXdh0pbxdbVuAXmsLhiX5O1W4051+CXyd/ZZNlvvioVVvo0G7\n         77DA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777325358; x=1777930158;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=Ebg5+i/pOUuQx7xxuERTUppaj1qL6vIxTxgv86V/NC0=;\n        b=euFMbwEWrGKuO6rVvaqZPhylQfzPzJsgzskeCUhBfrHGqiGXpVe9bAmPFLK4arhHbW\n         v0CVji3DeCE6tX6go8ZsGc8C7BjAWjc6eI9uktPRrzIbbWbaqVWtGfan9v0ze/U0OP6F\n         9AaimMeyTKWIlltIFaHKqjZyYdYZJUDrCwpe/xZLlf45TpTQgIcDG9zsXRFnyhS43ybN\n         TLkeCBOGqXJ4z297A77PBD1P5wL6E16HoaVT/WpwsskrCdATAlpdbJs8X7PEsN2l6PlR\n         chFZIBg4l58dvkHbimqv7ppcqynrPQRmwaF4o0AsmyXwPJncATRUuKRRrWe2+nPEH/y4\n         h+6w==","X-Forwarded-Encrypted":"i=1;\n AFNElJ9roF7wsh3qCAM7rI0yRZfp4WCcbYjzXwtF58FPtuRqO2E7v7A4qT79pYJqBemV4hpY305UaSQ4WCUY@vger.kernel.org","X-Gm-Message-State":"AOJu0YxK7lVqzniPztrJwj8xaNTthd//VjxuYFHRFwgCg+KdDqhRU38Z\n\t9xQIFu/DWX5kp7cHHINZQOz8THUfyZBylzULPNDKiqgGQ0L8NqE6KtW8","X-Gm-Gg":"AeBDieuyL5sSN+mzMRxT2CwnmLD3fJB4ZVXazyS2KxIm9sMLoa5+tqsxAjvAe3PC870\n\tfj8h2YRWLOETdZQLIgKvrq9R8IyEi/wal0N70XZMqA3kPHMiHv+e1RLGERmqTJYNdGqGdy+BcMA\n\tNcXNDuxQK6zV3jNvn1/1WOgQilrsLf3lgZGOX000PmmntZuAZx4ibe7/Zl+ytA55MS/VH8Gd+92\n\tnozJAfZHNKGlRviasOURw611pBLrtoX+fkKp8zUIypxs2Ueot5uFrriLex80aumThzDWv8GSdYN\n\tU/m6uWN3/Zm6cfBsByL2ffc0y8w4EEZyX5H+UU1k6KziirhEfdHb04GB3EjR9tPvyiPYEi4NXUG\n\tfY+3LPDj0B1DRMELlUnIwxWco0rpkngAMyhMUflc0OhbHeC9oCmDMePDWm7S2/e+28HNHBncyfm\n\t4gJ2AN5ZF89mAljYm0+vmylvHgeYETT3YkgF06/B95SIO+E2/0NfswPsrGkbFq96w/uTjbxEMmH\n\tkUWVmQ95jHUSg==","X-Received":"by 2002:a05:6000:3109:b0:43d:7d6f:f531 with SMTP id\n ffacd0b85a97d-44649ba1f4amr816127f8f.30.1777325358072;\n        Mon, 27 Apr 2026 14:29:18 -0700 (PDT)","Date":"Mon, 27 Apr 2026 22:29:14 +0100","From":"David Laight <david.laight.linux@gmail.com>","To":"Linus Torvalds <torvalds@linux-foundation.org>","Cc":"\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>, Yury Norov\n <ynorov@nvidia.com>, Andrew Morton <akpm@linux-foundation.org>, Thomas\n Gleixner <tglx@linutronix.de>, linux-alpha@vger.kernel.org,\n linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org,\n linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,\n linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,\n linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org,\n sparclinux@vger.kernel.org, linux-um@lists.infradead.org,\n dmaengine@vger.kernel.org, linux-efi@vger.kernel.org,\n linux-fsi@lists.ozlabs.org, amd-gfx@lists.freedesktop.org,\n dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,\n linux-wpan@vger.kernel.org, netdev@vger.kernel.org,\n linux-wireless@vger.kernel.org, linux-spi@vger.kernel.org,\n linux-media@vger.kernel.org, linux-staging@lists.linux.dev,\n linux-serial@vger.kernel.org, linux-usb@vger.kernel.org,\n xen-devel@lists.xenproject.org, linux-fsdevel@vger.kernel.org,\n ocfs2-devel@lists.linux.dev, bpf@vger.kernel.org,\n kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-x25@vger.kernel.org,\n rust-for-linux@vger.kernel.org, linux-sound@vger.kernel.org,\n sound-open-firmware@alsa-project.org, linux-csky@vger.kernel.org,\n linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev,\n linux-m68k@lists.linux-m68k.org, linux-openrisc@vger.kernel.org,\n linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org,\n linux-arch@vger.kernel.org","Subject":"Re: [RFC PATCH v1 5/9] uaccess: Switch to\n copy_{to/from}_user_partial() when relevant","Message-ID":"<20260427222914.1cb2dd3b@pumpkin>","In-Reply-To":"\n <CAHk-=whC1DZojwdMB1=sJWG2=dsCdfyU8N6tDE1qx50HRZ-WJQ@mail.gmail.com>","References":"<cover.1777306795.git.chleroy@kernel.org>\n\t<289b424e243ba2c4139ea04009cf8b9c448a87ff.1777306795.git.chleroy@kernel.org>\n\t<CAHk-=whC1DZojwdMB1=sJWG2=dsCdfyU8N6tDE1qx50HRZ-WJQ@mail.gmail.com>","X-Mailer":"Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf)","Precedence":"bulk","X-Mailing-List":"sparclinux@vger.kernel.org","List-Id":"<sparclinux.vger.kernel.org>","List-Subscribe":"<mailto:sparclinux+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:sparclinux+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-Spam-Status":"No, score=0.9 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tFREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,\n\tLOTS_OF_MONEY,MAILING_LIST_MULTI,MONEY_NOHTML,SPF_HELO_NONE,SPF_PASS\n\tautolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"}},{"id":3683016,"web_url":"http://patchwork.ozlabs.org/comment/3683016/","msgid":"<CAHk-=wg0SGbRYhdZ1kvJUTv1HEvmRJyQauFtBGV_fMcZVF8UpQ@mail.gmail.com>","list_archive_url":null,"date":"2026-04-27T21:39:20","subject":"Re: [RFC PATCH v1 5/9] uaccess: Switch to\n copy_{to/from}_user_partial()\n when relevant","submitter":{"id":97,"url":"http://patchwork.ozlabs.org/api/people/97/","name":"Linus Torvalds","email":"torvalds@linux-foundation.org"},"content":"On Mon, 27 Apr 2026 at 14:29, David Laight <david.laight.linux@gmail.com> wrote:\n>\n> I think there is a slight difference in that the normal copy_to_user()\n> will determine the exact offset of the error by retrying with byte copies.\n\nI have this dim memory that we decided that you can't reply on byte\nexactness anyway, because not all architectures gave that guarantee\nfor the user copies.\n\nBut that thing came up many years ago, I might mis-remember.\n\n            Linus","headers":{"Return-Path":"\n <SRS0=k3vY=C2=vger.kernel.org=sparclinux+bounces-6746-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","sparclinux@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org\n header.a=rsa-sha256 header.s=google header.b=aap/nStR;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=k3vy=c2=vger.kernel.org=sparclinux+bounces-6746-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c09:e001:a7::12fc:5321\"\n arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=linux-foundation.org","gandalf.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org\n header.a=rsa-sha256 header.s=google header.b=aap/nStR;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=sparclinux+bounces-6746-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux-foundation.org\n header.i=@linux-foundation.org header.b=\"aap/nStR\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.208.42","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=linux-foundation.org","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linuxfoundation.org"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4HH24Ngxz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 07:47:41 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g4HH14Sp7z4wLV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 07:47:41 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4g4HH14P1nz4wLh; Tue, 28 Apr 2026 07:47:41 +1000 (AEST)","from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g4HGy0GB0z4wLV\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 07:47:38 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 98DED300D4DC\n\tfor <patchwork-incoming@ozlabs.org>; Mon, 27 Apr 2026 21:47:35 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 94C7536D9E7;\n\tMon, 27 Apr 2026 21:47:34 +0000 (UTC)","from mail-ed1-f42.google.com (mail-ed1-f42.google.com\n [209.85.208.42])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 2315F37F009\n\tfor <sparclinux@vger.kernel.org>; Mon, 27 Apr 2026 21:47:32 +0000 (UTC)","by mail-ed1-f42.google.com with SMTP id\n 4fb4d7f45d1cf-678adefbd26so5634576a12.3\n        for <sparclinux@vger.kernel.org>;\n Mon, 27 Apr 2026 14:47:32 -0700 (PDT)","from mail-ed1-f42.google.com (mail-ed1-f42.google.com.\n [209.85.208.42])\n        by smtp.gmail.com with ESMTPSA id\n 4fb4d7f45d1cf-679b67638ccsm165619a12.0.2026.04.27.14.47.31\n        for <sparclinux@vger.kernel.org>\n        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n        Mon, 27 Apr 2026 14:47:31 -0700 (PDT)","by mail-ed1-f42.google.com with SMTP id\n 4fb4d7f45d1cf-678a526f374so6521489a12.0\n        for <sparclinux@vger.kernel.org>;\n Mon, 27 Apr 2026 14:47:31 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777326461; cv=pass;\n\tb=NyoearJLUhFKfy6IQ8kqzI2AtBtEzZMHG8lqKxZ6DwxF3bTe3cnLQLYaXSMm4I6dyT3CvZwuim78Fx6w5Kou0U/km/jfMVWLC8Yx0EYOec4q+DrLUvOIIQ4ONw7gn9j66tpmX+9n8Kk5D3AcLrjIsx09AQ/mAT9QowFzskw+Grr+6DKcABWXg+C373spHISPfhicvJqlMvcylYK61eghp3QX3mAA9FIjvePxyz53E5t4GlaKpHxzC7cOfUfSejLS9wK/QeJc4Z6jqQcZK8OCWzwNwlVMt/kY5CVS0NUHmqbSm6H0mcp+c5xeuo2zillBBV32T6tQItv2h7QUzNaCVQ==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777326454; cv=none;\n b=gz4zRt8TVPUVobS6Gzae8DyLem4C9FnicPp9fcyvjYDmx5eRQI4uWUC5Smrfnr1llKJCCX96OKPrDha3eLiVGLZT+hIA/01l7wwH8vhOPicWsbG7jiyzxUeoK5ZoWRSqloUuHRjGM/BMd5S+rWxVfcmtr2shHX9Ag/vJQOektlo="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777326461; c=relaxed/relaxed;\n\tbh=DjF1Jdn4Kp6xFyaBmAP2391GfFF2q7kuOVlruTChM90=;\n\th=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:\n\t To:Cc:Content-Type;\n b=Fdysie9ePG6XIBHd2IDw5s/RLAF2JtuA4CoZn0vKXfB+G8xp/iynqCPTDXTPn0FmCU2aswuKsKsbZnCHKD4W0WtJxP5kgiLdHw5+T64z6aH0C1rY7WmR+RbB7t/JgGFMPPiMrr/05FxpDE5MgLxO5hdu6JmoMkrHds9yO/VS87tmDQKed+bBTUmSVFmFRDjaNfI/iFa6jG7QSHDLvBM7bxn205JEOspcnrE4PEBoHY/c5xcSMKXHn4Yez2LpnHir45r6MxzVL/WbL0XYynQBunGK9lKxcsZgKd2Wf1WzCJawMJUXX6vK0wQb+13mv4jHV+NTE9qPklTBfHZrIiJObw==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777326454; c=relaxed/simple;\n\tbh=i/k46YQbNxc6jmDhpSrBTZQploRe2hY24KQV/uGHVj8=;\n\th=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:\n\t To:Cc:Content-Type;\n b=Kq1btYLHAomhahWi6Cv2LbYGAhqmrREgN9bUE7SPPWU/BOQqUxl2xNX1O1Xl+mmJIFa4LJOqR+8HAD5D1oRkcMaBJ2CN81l8ByAdIoIG4JQdurS0rRHBc9irHfTwnUZGEJ1N3PN4bsOCPEOzLHamLovRwxVhnrW/QXE2c/IW77k="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=linux-foundation.org;\n dkim=pass (1024-bit key;\n unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org\n header.a=rsa-sha256 header.s=google header.b=aap/nStR; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=sparclinux+bounces-6746-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=linux-foundation.org;\n spf=pass smtp.mailfrom=linuxfoundation.org;\n dkim=pass (1024-bit key) header.d=linux-foundation.org\n header.i=@linux-foundation.org header.b=aap/nStR;\n arc=none smtp.client-ip=209.85.208.42"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=linux-foundation.org; s=google; t=1777326451; x=1777931251;\n darn=vger.kernel.org;\n        h=cc:to:subject:message-id:date:from:in-reply-to:references\n         :mime-version:from:to:cc:subject:date:message-id:reply-to;\n        bh=DjF1Jdn4Kp6xFyaBmAP2391GfFF2q7kuOVlruTChM90=;\n        b=aap/nStRZA7tMCfWTViRBLcrZwSFuSnL2hh5QepQpYNOJ+0KXqWzGSuzLNKHq64KeT\n         Sy6ADTWYNjmAIr/EI2zJcY5gyOHbaPdp/Pi2wPGJzdeY6fIvwfA5mNkyW6b2l7n66wJI\n         QsLEe4t4DzE3LVE5Of5/tF7RXiAYhEeIw3+BI=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777326451; x=1777931251;\n        h=cc:to:subject:message-id:date:from:in-reply-to:references\n         :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=DjF1Jdn4Kp6xFyaBmAP2391GfFF2q7kuOVlruTChM90=;\n        b=M5TkFR6JWXOurzpVyKaPd5coNx+h901YBrJB7UKKGs24c29qZyfHcfzZFWxA8mQhby\n         Ll5OM2Z2e6Bx6ZfS53FCT0rz+UF17vtCLUcwgn7sBwv5aRajmYnIyjEopM9d0rG99yP/\n         ZV8LT7jclrFjWdYm6K10NVvcc5L6I5h5LfOxX7spbb3YSJar+86HOlxu2Bd4rqs91NJz\n         c9R1+BjDxlGOPpk/DFX33T5aIzc1lLjYg7JWMUu4Z0MZwXj/kdjPt92pZlAJ+MopOe2H\n         Zh2rSEqGYAx+byVeQ86CKGXcGnWEacri94wN3NXQJEw52BVoEjRisFgnrfWk2TVF+3MX\n         gLRA==","X-Forwarded-Encrypted":["i=1;\n AFNElJ9+miugPLbAC/dnwqHDDIYIgXM1iY70YJh0EJmf0WO07Vyh8UPAs6BeAarupeZqwT+W8tqpS6U4GiWD@vger.kernel.org","i=1;\n AFNElJ+ZjjleboMQF42M47cF9LGeNSkeUsCSVFRjoz6lgFi8rb3BRSRtT8iDGoShdCwH4IdirX1UeCLbVzob@vger.kernel.org"],"X-Gm-Message-State":"AOJu0Yxm5pGhK4bkZM8JshnEVq9cKGzwkN+s2CTJ8q+aY9X25W/kEAzM\n\tTw8qLpNk2h0bBV9Va1bdNDz9+DqNnDtsFxxxx9fzkEvU7NbH8F+xSqGeqOamEMLHF9chhiGxkva\n\tmQMetCE0Hdw==","X-Gm-Gg":"AeBDievkyvVe3Unq4O/9Ec5j2GlrKSurmYrMKBaTLIHnD/Tak6g02yYAEN3B6+mc7GT\n\t5io1aSp60Nk4C/ZyZXjxmhIKyLCETNnJmdapbEJ+1C2qEBQ3/CHAOIZmukeIa+BCtbejWzJew3M\n\tPCR+WUWfPetuATALVXdbsZqkKciaSCnoG0CQ05BAt6TCOaUNJzFX+nrZvtQs31BjePtxzatVrYe\n\t+XJqiZl1B/aLFxb/2VJVj2NgAQYCM/4z9JQ5h8b+MeSvII5g6dwtjylOTrTQzCTMMFvyNcp2tNc\n\tl5350TZHz+ptxtU7tu7rpDhMOnaumgixDnQ2675VflNG4p/MQCp1BUZk4ExJ5cPIzMW9KAF/dmS\n\t4d3OTH//K3+czGDAhM5+4iM3D5xUho86bVduQjY4xx36rGuZ8CbsQ7ws92r6Nq7S+4zQU2PPJcm\n\tp6ckbVvePN2B0QC4D4cS0+4t8VJaRJzs6skYpqwtjt/0j4x0q8NymAgKO3bI/t1J4eyzZJQt2VL\n\ttgwMFRJgms=","X-Received":["by 2002:a05:6402:1f4a:b0:66e:b9ad:9669 with SMTP id\n 4fb4d7f45d1cf-679bb09a369mr148908a12.21.1777326451390;\n        Mon, 27 Apr 2026 14:47:31 -0700 (PDT)","by 2002:a05:6402:5216:b0:679:1f4f:9d30 with SMTP id\n 4fb4d7f45d1cf-679bb04c1a2mr179970a12.4.1777325976937; Mon, 27 Apr 2026\n 14:39:36 -0700 (PDT)"],"Precedence":"bulk","X-Mailing-List":"sparclinux@vger.kernel.org","List-Id":"<sparclinux.vger.kernel.org>","List-Subscribe":"<mailto:sparclinux+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:sparclinux+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","References":"<cover.1777306795.git.chleroy@kernel.org>\n <289b424e243ba2c4139ea04009cf8b9c448a87ff.1777306795.git.chleroy@kernel.org>\n <CAHk-=whC1DZojwdMB1=sJWG2=dsCdfyU8N6tDE1qx50HRZ-WJQ@mail.gmail.com>\n <20260427222914.1cb2dd3b@pumpkin>","In-Reply-To":"<20260427222914.1cb2dd3b@pumpkin>","From":"Linus Torvalds <torvalds@linux-foundation.org>","Date":"Mon, 27 Apr 2026 14:39:20 -0700","X-Gmail-Original-Message-ID":"\n <CAHk-=wg0SGbRYhdZ1kvJUTv1HEvmRJyQauFtBGV_fMcZVF8UpQ@mail.gmail.com>","X-Gm-Features":"AVHnY4I-AxqvQRk42MegvhKMp_z4sSEpEzhzpgw2GyV2bV8dezSPoI0JTlwB18Y","Message-ID":"\n <CAHk-=wg0SGbRYhdZ1kvJUTv1HEvmRJyQauFtBGV_fMcZVF8UpQ@mail.gmail.com>","Subject":"Re: [RFC PATCH v1 5/9] uaccess: Switch to\n copy_{to/from}_user_partial()\n when relevant","To":"David Laight <david.laight.linux@gmail.com>","Cc":"\"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n Yury Norov <ynorov@nvidia.com>,\n\tAndrew Morton <akpm@linux-foundation.org>,\n Thomas Gleixner <tglx@linutronix.de>,\n\tlinux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tlinux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org,\n\tlinux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,\n\tkvm@vger.kernel.org, linux-riscv@lists.infradead.org,\n\tlinux-s390@vger.kernel.org, sparclinux@vger.kernel.org,\n\tlinux-um@lists.infradead.org, dmaengine@vger.kernel.org,\n\tlinux-efi@vger.kernel.org, linux-fsi@lists.ozlabs.org,\n\tamd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,\n\tintel-gfx@lists.freedesktop.org, linux-wpan@vger.kernel.org,\n\tnetdev@vger.kernel.org, linux-wireless@vger.kernel.org,\n\tlinux-spi@vger.kernel.org, linux-media@vger.kernel.org,\n\tlinux-staging@lists.linux.dev, linux-serial@vger.kernel.org,\n\tlinux-usb@vger.kernel.org, xen-devel@lists.xenproject.org,\n\tlinux-fsdevel@vger.kernel.org, ocfs2-devel@lists.linux.dev,\n\tbpf@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org,\n\tlinux-x25@vger.kernel.org, rust-for-linux@vger.kernel.org,\n\tlinux-sound@vger.kernel.org, sound-open-firmware@alsa-project.org,\n\tlinux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org,\n\tloongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org,\n\tlinux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org,\n\tlinux-sh@vger.kernel.org, linux-arch@vger.kernel.org","Content-Type":"text/plain; charset=\"UTF-8\"","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_MISSING,\n\tHEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,\n\tSPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"}}]