{"id":2232300,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2232300/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/patch/20260504-safe_splice-v3-1-e5acf4c9193b@suse.com/","project":{"id":59,"url":"http://patchwork.ozlabs.org/api/1.1/projects/59/?format=json","name":"Linux Test Project development","link_name":"ltp","list_id":"ltp.lists.linux.it","list_email":"ltp@lists.linux.it","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260504-safe_splice-v3-1-e5acf4c9193b@suse.com>","date":"2026-05-04T09:51:00","name":"[v3,1/2] lib: Add SAFE_SPLICE() macro","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"26eac15818458e274a586d4ba4637f4c084356d0","submitter":{"id":83220,"url":"http://patchwork.ozlabs.org/api/1.1/people/83220/?format=json","name":"Andrea Cervesato","email":"andrea.cervesato@suse.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ltp/patch/20260504-safe_splice-v3-1-e5acf4c9193b@suse.com/mbox/","series":[{"id":502633,"url":"http://patchwork.ozlabs.org/api/1.1/series/502633/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/list/?series=502633","date":"2026-05-04T09:50:59","name":"Introduce SAFE_SPLICE()","version":3,"mbox":"http://patchwork.ozlabs.org/series/502633/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232300/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232300/checks/","tags":{},"headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=ZxuRVc76;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.de\n header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=IJAIaUMP;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa\n header.b=ZxuRVc76;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=IJAIaUMP;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)","smtp-out2.suse.de;\n\tnone"],"Received":["from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\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 4g8H3Q0vWcz1yJ9\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 04 May 2026 19:51:30 +1000 (AEST)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 349E23E4986\n\tfor <incoming@patchwork.ozlabs.org>; Mon,  4 May 2026 11:51:28 +0200 (CEST)","from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 3BFB23E61FD\n for <ltp@lists.linux.it>; Mon,  4 May 2026 11:51:12 +0200 (CEST)","from smtp-out2.suse.de (smtp-out2.suse.de\n [IPv6:2a07:de40:b251:101:10:150:64:2])\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 in-2.smtp.seeweb.it (Postfix) with ESMTPS id 63E4460032D\n for <ltp@lists.linux.it>; Mon,  4 May 2026 11:51:11 +0200 (CEST)","from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 719765C248;\n Mon,  4 May 2026 09:51:05 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 53108593A6;\n Mon,  4 May 2026 09:51:05 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id eB30EQls+GkOOgAAD6G6ig\n (envelope-from <andrea.cervesato@suse.de>); Mon, 04 May 2026 09:51:05 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777888265;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=6FOEHGrgSJD5mEGsNGWFOyYBWGDtLKJZLA9LVt7kleI=;\n b=ZxuRVc76p51gQDmJSZcKIFBk3mdgZ7aAqkACI3h/ncBa8dMkZJVS8TO4wqmeyetRW59u5T\n eMKwj28SfasEof2KxNeODBMHqN4qXdcApMnOQNbFdQdZWZWfD927ob7pT7CU/Eo8VgSqEU\n e/X/HnlVbb2HmwuIvz0+w9WgFzMck8w=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777888265;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=6FOEHGrgSJD5mEGsNGWFOyYBWGDtLKJZLA9LVt7kleI=;\n b=IJAIaUMP89LYXdhp0qs7VyHGscgn4acRbENlVkxIPHrFG5HqtmGlBX/KipPnu9mBCmBEpk\n QmC+zA97ds2UlRCg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777888265;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=6FOEHGrgSJD5mEGsNGWFOyYBWGDtLKJZLA9LVt7kleI=;\n b=ZxuRVc76p51gQDmJSZcKIFBk3mdgZ7aAqkACI3h/ncBa8dMkZJVS8TO4wqmeyetRW59u5T\n eMKwj28SfasEof2KxNeODBMHqN4qXdcApMnOQNbFdQdZWZWfD927ob7pT7CU/Eo8VgSqEU\n e/X/HnlVbb2HmwuIvz0+w9WgFzMck8w=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777888265;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=6FOEHGrgSJD5mEGsNGWFOyYBWGDtLKJZLA9LVt7kleI=;\n b=IJAIaUMP89LYXdhp0qs7VyHGscgn4acRbENlVkxIPHrFG5HqtmGlBX/KipPnu9mBCmBEpk\n QmC+zA97ds2UlRCg=="],"From":"Andrea Cervesato <andrea.cervesato@suse.de>","Date":"Mon, 04 May 2026 11:51:00 +0200","MIME-Version":"1.0","Message-Id":"<20260504-safe_splice-v3-1-e5acf4c9193b@suse.com>","References":"<20260504-safe_splice-v3-0-e5acf4c9193b@suse.com>","In-Reply-To":"<20260504-safe_splice-v3-0-e5acf4c9193b@suse.com>","To":"Linux Test Project <ltp@lists.linux.it>","X-Mailer":"b4 0.14.2","X-Developer-Signature":"v=1; a=ed25519-sha256; t=1777888265; l=1394;\n i=andrea.cervesato@suse.com; s=20251210; h=from:subject:message-id;\n bh=h1d2sUKb7X5RgrWyJRHX+dekD1LOLp/UEnDnjwE8bFQ=;\n b=kD9yBYxARdgwaEbH8wwgR1JoTOCQSQpXH4Q9zsQ7mVo7AEv3TR0hhTfb52xyKGNUDIbvC0xoA\n YP4NF7P4Cp+DE/fPoiyzJtCb9WjMtR/w2Odfq9b0KV+yJZCBHSnO2Fu","X-Developer-Key":"i=andrea.cervesato@suse.com; a=ed25519;\n pk=zKY+6GCauOiuHNZ//d8PQ/UL4jFCTKbXrzXAOQSLevI=","X-Spamd-Result":"default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n FUZZY_RATELIMITED(0.00)[rspamd.com];\n RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[];\n RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+];\n FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n RCVD_COUNT_TWO(0.00)[2];\n DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.com:mid,\n suse.com:email]","X-Spam-Score":"-4.30","X-Spam-Level":"","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE,SPF_PASS\n shortcircuit=no autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-2.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-2.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"[LTP] [PATCH v3 1/2] lib: Add SAFE_SPLICE() macro","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"},"content":"From: Andrea Cervesato <andrea.cervesato@suse.com>\n\nAdd new SAFE_SPLIT() in lapi/splice.h.\n\nSigned-off-by: Andrea Cervesato <andrea.cervesato@suse.com>\n---\n include/lapi/splice.h | 28 ++++++++++++++++++++++++++++\n 1 file changed, 28 insertions(+)","diff":"diff --git a/include/lapi/splice.h b/include/lapi/splice.h\nindex 191b22d2d6397d1efad5e2025be5a2c4370724dc..e346e5cca9f44bd8421c6b99f84cd4646269ac1f 100644\n--- a/include/lapi/splice.h\n+++ b/include/lapi/splice.h\n@@ -7,6 +7,13 @@\n #ifndef LAPI_SPLICE_H__\n #define LAPI_SPLICE_H__\n \n+#ifndef _GNU_SOURCE\n+# define _GNU_SOURCE\n+#endif\n+\n+#include <fcntl.h>\n+#include <sys/types.h>\n+\n #include \"config.h\"\n #include \"lapi/syscalls.h\"\n \n@@ -19,4 +26,25 @@ static inline ssize_t splice(int fd_in, loff_t *off_in, int fd_out,\n }\n #endif\n \n+static inline ssize_t safe_splice(const char *file, const int lineno,\n+\t\t\t\t   int fd_in, loff_t *off_in,\n+\t\t\t\t   int fd_out, loff_t *off_out,\n+\t\t\t\t   size_t len, unsigned int flags)\n+{\n+\tssize_t ret;\n+\n+\tret = splice(fd_in, off_in, fd_out, off_out, len, flags);\n+\n+\tif (ret < 0) {\n+\t\ttst_brk_(file, lineno, TBROK | TERRNO,\n+\t\t\t\"splice(%d, %d, %zu) failed\", fd_in, fd_out, len);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+#define SAFE_SPLICE(fd_in, off_in, fd_out, off_out, len, flags) \\\n+\tsafe_splice(__FILE__, __LINE__, (fd_in), (off_in), (fd_out), \\\n+\t\t    (off_out), (len), (flags))\n+\n #endif /* LAPI_SPLICE_H__ */\n","prefixes":["v3","1/2"]}