Skip to content
Tcl Source Code History Of Ticket 37108037b980ea6e
Login

History Of Ticket 37108037b980ea6e

Artifacts Associated With Ticket 37108037b980ea6e

  1. Ticket change [5a618e1fea] (rid 203071) by jrtc27 on 2022-08-12 23:15:26:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      The attached patch series contains a number of code cleanups needed
      (with the exception of patches 1 and 8 which aren't needed but I
      believe are a good idea to have and discovered during this porting) to
      support CHERI, and thus Arm's Morello prototype[1]. With these changes
      there are no regressions when running make check on Morello CheriBSD
      compared with plain AArch64 CheriBSD (for some reason both fail to run
      the chanio tests with "kevent: Operation not supported by device"; I
      don't know if that's a Tcl bug, a FreeBSD bug, a CheriBSD bug or an
      issue with my environment, but the result is the same for both and
      pre-existing on AArch64 so it's not a bug in porting Tcl to CHERI).
      
      [1] https://www.arm.com/architecture/cpu/morello
      
    5. foundin initialized to: "9.0a4"
    6. is_private initialized to: "0"
    7. login: "jrtc27"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "92ff1afec5e8e23058f38873f7708b719c0ed33f"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "jrtc27"
    14. subsystem initialized to: "52. Portability Support"
    15. title initialized to: "Code cleanups to support CHERI"
    16. type initialized to: "Patch"
  2. Add attachment "0001-tclCompile-Be-more-careful-about-alignment-in-TclIni.patch" [3fed471882] (rid 203072) by jrtc27 on 2022-08-12 23:19:46.

  3. Add attachment "0002-tclInt-Fix-U-INT2PTR-PTR2-U-INT-for-CHERI.patch" [807726f0c7] (rid 203073) by jrtc27 on 2022-08-12 23:20:00.

  4. Add attachment "0003-tclInt-Fix-TCL_ALIGN-for-CHERI-by-not-hard-coding-8-.patch" [9364860f07] (rid 203074) by jrtc27 on 2022-08-12 23:20:29.

  5. Add attachment "0004-tclExecute-Fix-for-CHERI-by-not-assuming-ptrdiff_t-i.patch" [d74723a6be] (rid 203075) by jrtc27 on 2022-08-12 23:20:46.

  6. Add attachment "0005-testcmdtoken-Don-t-rely-on-round-tripping-pointers-t.patch" [8dce5b4348] (rid 203076) by jrtc27 on 2022-08-12 23:21:20.

  7. Add attachment "0006-tclExecute-Fix-for-CHERI-by-not-violating-object-all.patch" [4316977d28] (rid 203077) by jrtc27 on 2022-08-12 23:21:33.

  8. Add attachment "0007-tclHash-Fix-strict-aliasing-violations-breaking-CHER.patch" [3c72114510] (rid 203078) by jrtc27 on 2022-08-12 23:21:45.

  9. Add attachment "0008-Silence-harmless-warnings-on-CHERI-by-using-INT2PTR-.patch" [d5dde281fe] (rid 203079) by jrtc27 on 2022-08-12 23:21:56.

  10. Ticket change [d843135d95] (rid 203299) by jan.nijtmans on 2022-08-25 09:46:29:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      Thank you for those patches! The 008_* patch has already been applied to core-8-6-branch and up. I will have a look at the other ones as well.
      
      One remark: the PTR2INT/INT2PTR macro's only guarantee round-trip from size_t -> pointer -> size_t (in Tcl 8.6 it was int -> pointer -> int), not pointer -> size_t -> pointer, since size(size_t) might be smaller than sizeof(void *). So, whenever size_t is insufficient to store what the code wants, use a pointer. I don't think the PTR2INT/INT2PTR should be modified. In stead the code should be modified not to use size_t/ptrdiff_t in the places where it is problematic.
      
      Anyway, Thanks!  I will have a further look.
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  11. Ticket change [7e322d8b1e] (rid 203558) by jan.nijtmans on 2022-08-31 11:08:32:

    1. icomment:
      All provide patches, except 0002, now found their way into core-8-branch and trunk. Assuming CHERI now works, this ticket can be closed. Please confirm.
      
      If any other issues with CHERI arise, feel free to provide a new ticket or re-open this one.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Fixed"
    5. status changed to: "Pending"
  12. Ticket change [46ad076856] (rid 203592) by chrstphrchvz on 2022-09-01 07:27:13:

    1. icomment:
      Bigger picture comment: I wonder if CHERI’s effectiveness is limited by how software such as Tcl internally wrap `malloc()` by default for small allocations (for performance, at least back when this functionality was implemented 20 or so years ago, and possibly debugging). External memory error checking software (e.g. Valgrind, AddressSanitizer) already require that this internal wrapper/allocator be disabled to allow complete error detection and reporting.
      
    2. login: "chrstphrchvz"
    3. mimetype: "text/x-markdown"
  13. Ticket change [094b1c1b3f] (rid 211098) by chrstphrchvz on 2023-03-28 09:35:36:

    1. icomment:
      Usage of <tt>__LP64__</tt> in Tcl/Tk (e.g. for detecting 64-bit <tt>long</tt>) likely also requires auditing, as CHERI does not define this macro. See slide 6 of [https://soft-dev.org/events/cheritech22/slides/Richardson.pdf] which suggests checking <tt>__SIZEOF_LONG__ == 8</tt> instead.
      
    2. login: "chrstphrchvz"
    3. mimetype: "text/x-fossil-wiki"
  14. Ticket change [66bf6e7637] (rid 211099) by jrtc27 on 2023-03-28 10:41:19:

    1. icomment:
      Not sure how I missed these comments from last August and only saw today's follow-up, but here's my response:
      
      It's been long enough that I don't recall whether patch 2 is needed for correctness. However, we do emit a warning on pointer<->integer casts that don't go through (u)intptr_t because there's a high chance the code is wrong (and it's quite hard to tell statically for certain), so even if none of the users need to be able to do pointer->integer->pointer losslessly it's going to warn as-is, which is a warning we often like to make an error so we can catch all such potentially-problematic cases. If what you say is true then the way we'd express it would be `((void *)(intptr_t)(ptrdiff_t)(p))` and `((ptrdiff_t)(intptr_t)(p))`, which are semantically equivalent to the original code, but use a redundant intermediary cast to express to the compiler that your intent is indeed to be using just a plain integer. Would you accept such a patch instead? Either way I'll need to test that there is indeed nothing trying to use these for actual pointers.
      
      Re custom/wrapping allocators, yes, those are a nuisance to deal with and these days are often a bad idea for performance anyway (though maybe still with some allocators). You can either make your allocator use the necessary intrinsics to apply bounds (and be able to cope with the reduced bounds on free) or turn it off; which is the right option depends on the use case. Our porting of most software of late has been focused on just getting it working without extensively auditing it for things like custom memory allocators where adaptation is needed to avoid slight holes in the security story.
      
      Re __LP64__ I don't think I spotted such usage, but it may well be there are cases not exercised by the test suite where stupid things end up happening because it thinks it's 32-bit. There only seem to be 16 results between the tcl and tk repos (at least according to GitHub search, which can be a bit dodgy) though so perhaps not, and it wouldn't take long to audit them.
      
    2. login: "jrtc27"
    3. mimetype: "text/plain"
  15. Ticket change [5296db0b85] (rid 220675) by gahr on 2023-11-30 09:58:18:

    1. icomment:
      For the issue related to the chan-io test failing, see https://sourceforge.net/p/tcl/mailman/message/57263727/
      
    2. login: "gahr"
    3. mimetype: "text/plain"
  16. Ticket change [23ad5c5bf1] (rid 258141) by serhiy.storchaka on 2026-10-15 11:29:07:

    1. icomment: "Closing: fixed, see above."
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
    4. status changed to: "Closed"
  17. Ticket change [062eca0ac8] (rid 259942) by serhiy.storchaka on 2026-10-22 17:19:26:

    1. closedate changed to: "2461328.9785596295"
    2. closer changed to: "serhiy.storchaka"
    3. login: "serhiy.storchaka"