From patchwork Fri Dec 16 18:25:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= X-Patchwork-Id: 13075274 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0184DC46467 for ; Fri, 16 Dec 2022 18:26:00 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.464884.723428 (Exim 4.92) (envelope-from ) id 1p6FP2-00079Q-Su; Fri, 16 Dec 2022 18:25:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 464884.723428; Fri, 16 Dec 2022 18:25:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6FP2-00079J-PH; Fri, 16 Dec 2022 18:25:48 +0000 Received: by outflank-mailman (input) for mailman id 464884; Fri, 16 Dec 2022 18:25:47 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6FP1-0006tv-7I for xen-devel@lists.xenproject.org; Fri, 16 Dec 2022 18:25:47 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0d08c929-7d6f-11ed-8fd4-01056ac49cbb; Fri, 16 Dec 2022 19:25:44 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0d08c929-7d6f-11ed-8fd4-01056ac49cbb DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1671215144; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=g4p5R9xtV45SffUqomxDtezBVesWLTVPg0ts1Qe1yj4=; b=SBBM9u6RTX/jVga/MIPCsEsa/21uOsQSxPCX8TJ1YTXc4EmlPrKf7rhQ LVzRe13rgtNhEYAdb5S8OqKMlo9PdAWSw77T0h5bO9//3zBDMt/Nok8KY l7rMFcssRZDOe0py3KobZgWKVuvWfkuWDHVN+/dSlT2pPzZkXwUAfdpdC E=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 88806404 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:zPj6MKqN9QV137olXYOHQu6/bCFeBmLbZRIvgKrLsJaIsI4StFCzt garIBnTPv/fYGWhfI8ibonnpkhSv8SAz9BgQVBury42RnwS9puZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpAFc+E0/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKm06W1wUmAWP6gR5gaEzidNVvrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXAClQY0yErcKr+qi2YcxLl+s9I8/uBapK7xmMzRmBZRonaZXKQqGM7t5ExjYgwMtJGJ4yZ eJAN2ApNk6ZJUQSZBFHU/rSn8/x7pX7WzBUtlOT47Yw+W/Q5AdwzKLsIJz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mHPm5df0XTQgFqN69PBkmzbimjodVetHod F29nPcs4ASAQLLnSz76dSNXxZ2llCsqX5nleIIlXRQXYYXdbcU9OUkjTdoOYZFGDi/5JEsEe FoAs2Z7PFKcUmCZ3ScumV02tSjUnk6Ax/DSEkfvc6e1SRQgRlCvj4l7d1amm1F+IM2SpFC6e iBOqN0lKtWRstTdq55DPdpe7rHNoUMe2OzDIu/GyWZKEhcAQOxl3fe2sRI2N2X X-IronPort-AV: E=Sophos;i="5.96,249,1665460800"; d="scan'208";a="88806404" From: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= To: CC: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= , "Christian Lindig" , David Scott , Wei Liu , Anthony PERARD , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" Subject: [PATCH v4 00/11] OCaml fixes Date: Fri, 16 Dec 2022 18:25:09 +0000 Message-ID: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 From: Edwin Török Various OCaml fixes, some of which got Acked already. Note: the Data_abstract_val got Acked but not yet commited because we thought there might be a better way with finalizers/etc. It is not possible to use finalizers here but there is a new followup patch in this series that detects use-after-free and raises an exception without trigerring undefined behaviour or crashes (see 'xb: check for unmapped ring'). The formatting patch was controversial during the 4.17 freeze, but master is open now, and both the maintainer and myself agree with it, so I think we should be able to do it now. I've split it up into 2: add the formatting rules, and the actual formatting, so that it is easier to redo the formatting patch when this gets backported. I think we should just commit it rather than worry that there might be more bugfixes to come after and attempt to rebase the bugfixes without the formatting patch (introducing bugs in the process), especially that one of the patches not yet posted to fix use of enter/leave changes quite a significant part of all C stubs, and I don't have a way of developing those patches without the formatting patch. The rest are various bugfixes to the C bindings, and I have more to send after I've tested them (almost all uses of enter/leave blocking section are wrong because they access OCaml values in non-safe ways with _H, but the GC may have already moved them which would cause a crash, that changes a lot of bindings and needs more testing before sending out, and I've got a few more OCaml 5 fixes too). Edwin Török (11): tools/ocaml/libs/{xb, mmap}: use Data_abstract_val wrapper tools/ocaml/xenstored/Makefile: use ocamldep -sort for linking order CODING_STYLE(tools/ocaml): add 'make format' and remove tabs tools/ocaml: run "make format" CODING-STYLE(tools/ocaml): add .editorconfig to clarify indentation uses spaces tools/ocaml: add .clang-format fixup! tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free tools/ocaml/libs/mmap: mark mmap/munmap as blocking and raise Unix_error on failure tools/ocaml/libs/xb: check for unmapped ring before accessing it tools/ocaml/xenstored: validate config file before live update tools/ocaml/libs/xb: drop Xs_ring.write .editorconfig | 20 + tools/ocaml/.clang-format | 9 + tools/ocaml/Makefile | 5 + tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 194 +- tools/ocaml/libs/mmap/mmap_stubs.h | 8 +- tools/ocaml/libs/mmap/xenmmap.ml | 2 +- tools/ocaml/libs/mmap/xenmmap.mli | 4 +- tools/ocaml/libs/mmap/xenmmap_stubs.c | 123 +- tools/ocaml/libs/xb/op.ml | 76 +- tools/ocaml/libs/xb/packet.ml | 30 +- tools/ocaml/libs/xb/partial.ml | 48 +- tools/ocaml/libs/xb/xb.ml | 416 ++-- tools/ocaml/libs/xb/xb.mli | 106 +- tools/ocaml/libs/xb/xenbus_stubs.c | 50 +- tools/ocaml/libs/xb/xs_ring.ml | 31 +- tools/ocaml/libs/xb/xs_ring_stubs.c | 221 +- tools/ocaml/libs/xc/xenctrl.ml | 326 +-- tools/ocaml/libs/xc/xenctrl.mli | 12 +- tools/ocaml/libs/xc/xenctrl_stubs.c | 1556 ++++++------- tools/ocaml/libs/xentoollog/caml_xentoollog.h | 6 +- .../ocaml/libs/xentoollog/xentoollog_stubs.c | 196 +- tools/ocaml/libs/xl/xenlight_stubs.c | 2022 ++++++++--------- tools/ocaml/libs/xs/queueop.ml | 48 +- tools/ocaml/libs/xs/xs.ml | 220 +- tools/ocaml/libs/xs/xs.mli | 46 +- tools/ocaml/libs/xs/xsraw.ml | 300 +-- tools/ocaml/libs/xs/xst.ml | 76 +- tools/ocaml/libs/xs/xst.mli | 20 +- tools/ocaml/test/dmesg.ml | 26 +- tools/ocaml/test/list_domains.ml | 4 +- tools/ocaml/test/raise_exception.ml | 4 +- tools/ocaml/test/xtl.ml | 28 +- tools/ocaml/xenstored/Makefile | 6 +- tools/ocaml/xenstored/config.ml | 156 +- tools/ocaml/xenstored/connection.ml | 578 ++--- tools/ocaml/xenstored/connections.ml | 294 +-- tools/ocaml/xenstored/disk.ml | 218 +- tools/ocaml/xenstored/domain.ml | 116 +- tools/ocaml/xenstored/domains.ml | 298 +-- tools/ocaml/xenstored/event.ml | 28 +- tools/ocaml/xenstored/history.ml | 62 +- tools/ocaml/xenstored/logging.ml | 478 ++-- tools/ocaml/xenstored/packet.ml | 20 +- tools/ocaml/xenstored/parse_arg.ml | 132 +- tools/ocaml/xenstored/perms.ml | 216 +- tools/ocaml/xenstored/poll.ml | 68 +- tools/ocaml/xenstored/poll.mli | 4 +- tools/ocaml/xenstored/process.ml | 1210 +++++----- tools/ocaml/xenstored/quota.ml | 74 +- tools/ocaml/xenstored/select_stubs.c | 62 +- tools/ocaml/xenstored/stdext.ml | 190 +- tools/ocaml/xenstored/store.ml | 752 +++--- tools/ocaml/xenstored/symbol.ml | 2 +- tools/ocaml/xenstored/syslog.ml | 48 +- tools/ocaml/xenstored/syslog_stubs.c | 68 +- tools/ocaml/xenstored/systemd_stubs.c | 10 +- tools/ocaml/xenstored/transaction.ml | 352 +-- tools/ocaml/xenstored/trie.ml | 222 +- tools/ocaml/xenstored/trie.mli | 22 +- tools/ocaml/xenstored/utils.ml | 146 +- tools/ocaml/xenstored/xenstored.ml | 987 ++++---- 61 files changed, 6569 insertions(+), 6483 deletions(-) create mode 100644 .editorconfig create mode 100644 tools/ocaml/.clang-format Acked-by: Christian Lindig --- 2.34.1