Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2231533/?format=api
{ "id": 2231533, "url": "http://patchwork.ozlabs.org/api/patches/2231533/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/64d1ec09dd1fe00d229fcd6146e59c32683cf3f0.1777577013.git.massimiliano.pellizzer@canonical.com/", "project": { "id": 15, "url": "http://patchwork.ozlabs.org/api/projects/15/?format=api", "name": "Ubuntu Kernel", "link_name": "ubuntu-kernel", "list_id": "kernel-team.lists.ubuntu.com", "list_email": "kernel-team@lists.ubuntu.com", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<64d1ec09dd1fe00d229fcd6146e59c32683cf3f0.1777577013.git.massimiliano.pellizzer@canonical.com>", "list_archive_url": null, "date": "2026-04-30T19:28:22", "name": "[SRU,J,v2,1/9] crypto: scatterwalk - Backport memcpy_sglist()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3e4d1875cdf7437bf8572155e379d6ab6becadd1", "submitter": { "id": 89057, "url": "http://patchwork.ozlabs.org/api/people/89057/?format=api", "name": "Massimiliano Pellizzer", "email": "massimiliano.pellizzer@canonical.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/64d1ec09dd1fe00d229fcd6146e59c32683cf3f0.1777577013.git.massimiliano.pellizzer@canonical.com/mbox/", "series": [ { "id": 502368, "url": "http://patchwork.ozlabs.org/api/series/502368/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ubuntu-kernel/list/?series=502368", "date": "2026-04-30T19:28:21", "name": "CVE-2026-31431", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/502368/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2231533/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2231533/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<kernel-team-bounces@lists.ubuntu.com>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (4096-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.a=rsa-sha256 header.s=20251003 header.b=Gtl1y6CR;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com\n (client-ip=185.125.189.65; helo=lists.ubuntu.com;\n envelope-from=kernel-team-bounces@lists.ubuntu.com;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g644j2FtRz1yJr\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 05:29:57 +1000 (AEST)", "from localhost ([127.0.0.1] helo=lists.ubuntu.com)\n\tby lists.ubuntu.com with esmtp (Exim 4.86_2)\n\t(envelope-from <kernel-team-bounces@lists.ubuntu.com>)\n\tid 1wIX53-0003oI-GY; Thu, 30 Apr 2026 19:29:49 +0000", "from smtp-relay-internal-1.internal ([10.131.114.114]\n helo=smtp-relay-internal-1.canonical.com)\n by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.86_2) (envelope-from <massimiliano.pellizzer@canonical.com>)\n id 1wIX4k-0002MC-G2\n for kernel-team@lists.ubuntu.com; Thu, 30 Apr 2026 19:29:30 +0000", "from mail-wr1-f72.google.com (mail-wr1-f72.google.com\n [209.85.221.72])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 4BE3B3F637\n for <kernel-team@lists.ubuntu.com>; Thu, 30 Apr 2026 19:29:30 +0000 (UTC)", "by mail-wr1-f72.google.com with SMTP id\n ffacd0b85a97d-44a56cf1466so124969f8f.1\n for <kernel-team@lists.ubuntu.com>; Thu, 30 Apr 2026 12:29:30 -0700 (PDT)", "from tuxedo-infinitybook (net-93-71-66-38.cust.vodafonedsl.it.\n [93.71.66.38]) by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-448e74324a5sm8133217f8f.12.2026.04.30.12.29.28\n for <kernel-team@lists.ubuntu.com>\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 30 Apr 2026 12:29:28 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;\n s=20251003; t=1777577370;\n bh=Xx2lTU8w4P8RwdZPm3wkbSDvEkDa5eFsn+AdabNSknM=;\n h=From:To:Subject:Date:Message-ID:In-Reply-To:References:\n MIME-Version;\n b=Gtl1y6CRg7WXj61CmjeIiwOAIdtyYdqAI9kB6ifHexiRtnZ7UcAN/eiGHqOSHiAmj\n fcsK/jSdrezaQWJqEHghHMiaOANTwJbxPiN5ln1xZTPL9YPJEMTarQ8fci2tLjLnsR\n vcsA1zuGdUw/On0x7hreFD3QDXGdhifkXKmBkHobwy08i0310jX1ID2Tf92ihXaR+T\n LrWzTxDbeZ+aaeSfC0TP/4fIuhImMF+8ENq+Yq+C+oncREnpYSGL63S0fmdO/VdwSk\n x+lCmoKKeFyoZsZIXoVNnfU8RrHoc+ikSqv/uCIbl6jJbeQlXiQ+6t/TFgMZLjR0k3\n mpotkoYUSrqVL66GKCObP86nnsmollifkOuc2v70T0ZxxS9g7iUy9XJ+yKEHWNqqY6\n ZEAg5/hazEMmyzfGmJQMa7G2kPEnOq+tKKl6ecUHJjY6jW6yLqviCiRV3VWPLuHols\n afB5kmpjoiyK95v03KaO6ajKqboSHYeFBrkuoQv5AlS7S6n8isBAY76pPXTRbUmcrl\n YLwe5CLLItAnk9Gcj6VHxzb7XHuy0vkFO254D8FUPBGy79B/P47UvXjsJ50MqZvWv8\n FcyOa29HOFRGAlF8G9M2+7jnTVVbBK9oXckri01bRmz8OMGEqmIDK0Uy1WhLd3YP6k\n 1EyysiuyPq/2X+NNSNp3wKK8=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777577369; x=1778182169;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=Xx2lTU8w4P8RwdZPm3wkbSDvEkDa5eFsn+AdabNSknM=;\n b=ocWzxUEBtHGU/YOcBUjFA3p2S88TBdUVMNpjvgy+Cvd+xYjO43Pr0VlanRg1ADyxQb\n zroL49pAWj/p3cAvXXn+Y+dqpCta9cU5OExwZ+yXFnCKWJKzXuwr60F7QNLYeWbLPDxr\n cJ9CvR6dImk61Rv/T734FWhCHNhECONXmNLFL45ImRHoYZv67LhkNRl6Ypl8ormoh8zM\n d55E5PGnGtZlK6gjSc01XdTGQghpb0H/c1p0hD8HCbkirkWsIbLQP3cAnoyf9vuVk6RZ\n IvjnABAZ6putFf1SNFAVEcedaEaGe1GeOStkSCvuB7/0dbiPumuN5IDEgde8nFF7K+/y\n icAQ==", "X-Gm-Message-State": "AOJu0YwiKuiZs2ZGRTyXQsePF27cCkpJ7q7JstBKmacP8UgFpuYpxG8Y\n LyD2caNVgpueOhaM59euEX8Nc6foLsKV/6ZPnC+UoG5r3g6p+fQUSAVr2120gFpZ4yTRCW9MbhC\n 4JKKJ6KT/zSkVHp6oNQzXJPobYSFrd56mkITEPozeE3J+OVhqx+ziFKNkrrXD0DMStHu/pbtQYO\n 1vQTwEP3gA5ouIWA==", "X-Gm-Gg": "AeBDiesXJm0VNKMgkjQiEJ/aE8sUwMRX5shsgXZGNhHxZ8tp6AS7BuxwMAjMmGw3LL+\n IcYENPhszwezWZJrmnrphPUe7umXtgkEcVLjiPoA2s0SD5MTBff5Olg3BMVB274YVUKVzdZWlBJ\n vzDLcMjkV2u0ALqcf4xN5z+16OIzWzL9V0nifwGuTwYnGWNXvLfVv2i+dllkfyrgqd0/QW8RiNN\n M3wmll7/qUbEtRK9q7CdVRT11SRs/vlWkOYAZT3TrJDAXg7J/B78cR69LE7ehCYnQfis9a7wtUi\n yV2UJ23GSoAWjeTUg493b8xY77pqBZm2/whMwiQoae6QmeS2c6Sv9WNn7GqgYJgdX1Sj4B609AN\n mP6MJa9QTDiFo/Xp9vBG5ZofWVYtT8j8AAs11AT4VMVXvxTUshN0mHvz0mO+GZYR4ksBYhICTWh\n sKzXtPkroSKMmpKJsUvxRQIFLB9Dy3zF9hXURf6ZRCsrocdBQmsJfA8WGXAYkaDLcDYK1q2VqaT\n g8PO7nCkEZHyQ==", "X-Received": [ "by 2002:a5d:5c89:0:b0:43e:a70d:7622 with SMTP id\n ffacd0b85a97d-4493f42c6d8mr7294584f8f.22.1777577369660;\n Thu, 30 Apr 2026 12:29:29 -0700 (PDT)", "by 2002:a5d:5c89:0:b0:43e:a70d:7622 with SMTP id\n ffacd0b85a97d-4493f42c6d8mr7294525f8f.22.1777577368956;\n Thu, 30 Apr 2026 12:29:28 -0700 (PDT)" ], "From": "Massimiliano Pellizzer <massimiliano.pellizzer@canonical.com>", "To": "kernel-team@lists.ubuntu.com", "Subject": "[SRU][J][PATCH v2 1/9] crypto: scatterwalk - Backport memcpy_sglist()", "Date": "Thu, 30 Apr 2026 21:28:22 +0200", "Message-ID": "\n <64d1ec09dd1fe00d229fcd6146e59c32683cf3f0.1777577013.git.massimiliano.pellizzer@canonical.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<cover.1777577013.git.massimiliano.pellizzer@canonical.com>", "References": "\n <177757626672.818044.11792928639290212185@tuxedo-infinitybook.public>\n <cover.1777577013.git.massimiliano.pellizzer@canonical.com>", "MIME-Version": "1.0", "X-BeenThere": "kernel-team@lists.ubuntu.com", "X-Mailman-Version": "2.1.20", "Precedence": "list", "List-Id": "Kernel team discussions <kernel-team.lists.ubuntu.com>", "List-Unsubscribe": "<https://lists.ubuntu.com/mailman/options/kernel-team>,\n <mailto:kernel-team-request@lists.ubuntu.com?subject=unsubscribe>", "List-Archive": "<https://lists.ubuntu.com/archives/kernel-team>", "List-Post": "<mailto:kernel-team@lists.ubuntu.com>", "List-Help": "<mailto:kernel-team-request@lists.ubuntu.com?subject=help>", "List-Subscribe": "<https://lists.ubuntu.com/mailman/listinfo/kernel-team>,\n <mailto:kernel-team-request@lists.ubuntu.com?subject=subscribe>", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "kernel-team-bounces@lists.ubuntu.com", "Sender": "\"kernel-team\" <kernel-team-bounces@lists.ubuntu.com>" }, "content": "From: Eric Biggers <ebiggers@kernel.org>\n\nThis backports the current implementation of memcpy_sglist() from\nupstream commit 4dffc9bbffb9ccfcda730d899c97c553599e7ca8.\n\nThis function was rewritten twice. The earlier implementations had many\nprerequisite commits, while the latest implementation is standalone.\nIt's much easier to just backport the latest code directly.\n\nSigned-off-by: Eric Biggers <ebiggers@kernel.org>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\n(cherry picked from commit 36435a56cd6bab7609c3e0fd7a70224795375748 linux-5.15.y)\nCVE-2026-31431\nSigned-off-by: Massimiliano Pellizzer <massimiliano.pellizzer@canonical.com>\n---\n crypto/scatterwalk.c | 94 ++++++++++++++++++++++++++++++++++++\n include/crypto/scatterwalk.h | 32 ++++++++++++\n 2 files changed, 126 insertions(+)", "diff": "diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c\nindex 16f6ba896fb63..9f0b27005166c 100644\n--- a/crypto/scatterwalk.c\n+++ b/crypto/scatterwalk.c\n@@ -69,6 +69,100 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,\n }\n EXPORT_SYMBOL_GPL(scatterwalk_map_and_copy);\n \n+/**\n+ * memcpy_sglist() - Copy data from one scatterlist to another\n+ * @dst: The destination scatterlist. Can be NULL if @nbytes == 0.\n+ * @src: The source scatterlist. Can be NULL if @nbytes == 0.\n+ * @nbytes: Number of bytes to copy\n+ *\n+ * The scatterlists can describe exactly the same memory, in which case this\n+ * function is a no-op. No other overlaps are supported.\n+ *\n+ * Context: Any context\n+ */\n+void memcpy_sglist(struct scatterlist *dst, struct scatterlist *src,\n+\t\t unsigned int nbytes)\n+{\n+\tunsigned int src_offset, dst_offset;\n+\n+\tif (unlikely(nbytes == 0)) /* in case src and/or dst is NULL */\n+\t\treturn;\n+\n+\tsrc_offset = src->offset;\n+\tdst_offset = dst->offset;\n+\tfor (;;) {\n+\t\t/* Compute the length to copy this step. */\n+\t\tunsigned int len = min3(src->offset + src->length - src_offset,\n+\t\t\t\t\tdst->offset + dst->length - dst_offset,\n+\t\t\t\t\tnbytes);\n+\t\tstruct page *src_page = sg_page(src);\n+\t\tstruct page *dst_page = sg_page(dst);\n+\t\tconst void *src_virt;\n+\t\tvoid *dst_virt;\n+\n+\t\tif (IS_ENABLED(CONFIG_HIGHMEM)) {\n+\t\t\t/* HIGHMEM: we may have to actually map the pages. */\n+\t\t\tconst unsigned int src_oip = offset_in_page(src_offset);\n+\t\t\tconst unsigned int dst_oip = offset_in_page(dst_offset);\n+\t\t\tconst unsigned int limit = PAGE_SIZE;\n+\n+\t\t\t/* Further limit len to not cross a page boundary. */\n+\t\t\tlen = min3(len, limit - src_oip, limit - dst_oip);\n+\n+\t\t\t/* Compute the source and destination pages. */\n+\t\t\tsrc_page += src_offset / PAGE_SIZE;\n+\t\t\tdst_page += dst_offset / PAGE_SIZE;\n+\n+\t\t\tif (src_page != dst_page) {\n+\t\t\t\t/* Copy between different pages. */\n+\t\t\t\tmemcpy_page(dst_page, dst_oip,\n+\t\t\t\t\t src_page, src_oip, len);\n+\t\t\t\tflush_dcache_page(dst_page);\n+\t\t\t} else if (src_oip != dst_oip) {\n+\t\t\t\t/* Copy between different parts of same page. */\n+\t\t\t\tdst_virt = kmap_local_page(dst_page);\n+\t\t\t\tmemcpy(dst_virt + dst_oip, dst_virt + src_oip,\n+\t\t\t\t len);\n+\t\t\t\tkunmap_local(dst_virt);\n+\t\t\t\tflush_dcache_page(dst_page);\n+\t\t\t} /* Else, it's the same memory. No action needed. */\n+\t\t} else {\n+\t\t\t/*\n+\t\t\t * !HIGHMEM: no mapping needed. Just work in the linear\n+\t\t\t * buffer of each sg entry. Note that we can cross page\n+\t\t\t * boundaries, as they are not significant in this case.\n+\t\t\t */\n+\t\t\tsrc_virt = page_address(src_page) + src_offset;\n+\t\t\tdst_virt = page_address(dst_page) + dst_offset;\n+\t\t\tif (src_virt != dst_virt) {\n+\t\t\t\tmemcpy(dst_virt, src_virt, len);\n+\t\t\t\tif (ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE)\n+\t\t\t\t\t__scatterwalk_flush_dcache_pages(\n+\t\t\t\t\t\tdst_page, dst_offset, len);\n+\t\t\t} /* Else, it's the same memory. No action needed. */\n+\t\t}\n+\t\tnbytes -= len;\n+\t\tif (nbytes == 0) /* No more to copy? */\n+\t\t\tbreak;\n+\n+\t\t/*\n+\t\t * There's more to copy. Advance the offsets by the length\n+\t\t * copied this step, and advance the sg entries as needed.\n+\t\t */\n+\t\tsrc_offset += len;\n+\t\tif (src_offset >= src->offset + src->length) {\n+\t\t\tsrc = sg_next(src);\n+\t\t\tsrc_offset = src->offset;\n+\t\t}\n+\t\tdst_offset += len;\n+\t\tif (dst_offset >= dst->offset + dst->length) {\n+\t\t\tdst = sg_next(dst);\n+\t\t\tdst_offset = dst->offset;\n+\t\t}\n+\t}\n+}\n+EXPORT_SYMBOL_GPL(memcpy_sglist);\n+\n struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],\n \t\t\t\t struct scatterlist *src,\n \t\t\t\t unsigned int len)\ndiff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h\nindex 7af08174a7212..df9c1ba3bd5cb 100644\n--- a/include/crypto/scatterwalk.h\n+++ b/include/crypto/scatterwalk.h\n@@ -88,6 +88,35 @@ static inline void scatterwalk_pagedone(struct scatter_walk *walk, int out,\n \t\tscatterwalk_start(walk, sg_next(walk->sg));\n }\n \n+/*\n+ * Flush the dcache of any pages that overlap the region\n+ * [offset, offset + nbytes) relative to base_page.\n+ *\n+ * This should be called only when ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE, to ensure\n+ * that all relevant code (including the call to sg_page() in the caller, if\n+ * applicable) gets fully optimized out when !ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE.\n+ */\n+static inline void __scatterwalk_flush_dcache_pages(struct page *base_page,\n+\t\t\t\t\t\t unsigned int offset,\n+\t\t\t\t\t\t unsigned int nbytes)\n+{\n+\tunsigned int num_pages;\n+\tunsigned int i;\n+\n+\tbase_page += offset / PAGE_SIZE;\n+\toffset %= PAGE_SIZE;\n+\n+\t/*\n+\t * This is an overflow-safe version of\n+\t * num_pages = DIV_ROUND_UP(offset + nbytes, PAGE_SIZE).\n+\t */\n+\tnum_pages = nbytes / PAGE_SIZE;\n+\tnum_pages += DIV_ROUND_UP(offset + (nbytes % PAGE_SIZE), PAGE_SIZE);\n+\n+\tfor (i = 0; i < num_pages; i++)\n+\t\tflush_dcache_page(base_page + i);\n+}\n+\n static inline void scatterwalk_done(struct scatter_walk *walk, int out,\n \t\t\t\t int more)\n {\n@@ -100,6 +129,9 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,\n \t\t\t size_t nbytes, int out);\n void *scatterwalk_map(struct scatter_walk *walk);\n \n+void memcpy_sglist(struct scatterlist *dst, struct scatterlist *src,\n+\t\t unsigned int nbytes);\n+\n void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,\n \t\t\t unsigned int start, unsigned int nbytes, int out);\n \n", "prefixes": [ "SRU", "J", "v2", "1/9" ] }