V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
codehz
V2EX  ›  Apple

Java 、Idea、Android Studio 用户请暂缓升级到 macOS 14.4

  •  4
     
  •   codehz · 53 天前 · 9730 次点击
    这是一个创建于 53 天前的主题,其中的信息可能已经有所发展或是发生改变。
    https://blogs.oracle.com/java/post/java-on-macos-14-4
    省流:果子改了受保护页面的默认处理方式,之前是发 sigsegv 现在直接 sigkill ,而 java 从很早的版本(已知 8 )开始就在滥用这个特性来将 null 检测改为捕获 sigsegv 信号,包括用户主动写的 if == null 也会在 jit 的帮助下被转换,这在新版本 mac 里会直接触发错误。
    建议有 java 需求或依赖基于 java 的 ide 的 mac 用户暂缓升级
    第 1 条附言  ·  41 天前

    经过测试,mac 14.4.1 已经正式修复了这个 BUG,通过测试代码可知,不是给java专门打的补丁

    #include <pthread.h>
    
    int main() {
      pthread_jit_write_protect_np(0);
      return *((int *)NULL);
    }
    

    <- 先前14.4是SIGKILL,现在正确SIGSEGV

    109 条回复    2024-03-29 11:04:21 +08:00
    1  2  
    codehz
        101
    codehz  
    OP
       51 天前
    @houshuu 但其实没什么用,这次的问题是随机概率触发的,上面有人就没触发过。。。
    合理的方案是在不破坏互操作性的前提下(例如不能出现旧版本无法打开项目的情况),进行灰度升级
    iseki
        102
    iseki  
       46 天前 via Android
    @lslqtz 这 POSIX 里的,怎么就不承诺了😰,这还叫遵守 POSIX 规范?
    lslqtz
        103
    lslqtz  
       46 天前
    @iseki 引用: https://zhuanlan.zhihu.com/p/346722474
    1. SIGSEGV 并没有严格定义, 在 Linux 中, 有一个要求: 内存访问的目标在程序可以访问的用户态地址空间;
    2. 早在 2020 年, 就有人指出 macOS 并不完全正确的实现了 POSIX 兼容, 如 https://stackoverflow.com/a/56674321. 其原因不难理解, BSD/XNU/Darwin 可能是 POSIX 兼容的, 但我想 macOS 可以并不一定是;
    iseki
        104
    iseki  
       46 天前
    @lslqtz 关于这个,我查阅了下参考,不确定引用的段落是否正确,欢迎指正:
    > Memory Protection
    >
    > When an object is mapped, various application accesses to the mapped region may result in signals. In this context, SIGBUS is used to indicate an error using the mapped object, and SIGSEGV is used to indicate a protection violation or misuse of an address:
    > - A mapping may be restricted to disallow some types of access.
    > - Write attempts to memory that was mapped without write access, or any access to memory mapped PROT_NONE, shall result in a SIGSEGV signal.
    > - References to unmapped addresses shall result in a SIGSEGV signal.
    > - Reference to whole pages within the mapping, but beyond the current length of the object, shall result in a SIGBUS signal.
    > - The size of the object is unaffected by access beyond the end of the object (even if a SIGBUS is not generated).

    ---- The Open Group Base Specifications Issue 7, 2018 Edition
    https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_03_03
    iseki
        105
    iseki  
       46 天前
    @lslqtz 至于 Mac 是否 POSIX 兼容,这我确实不清楚了,我记得好像 Windows 也说自己 POSIX 兼容来着,也确实针对 POSIX 做了一些工作,但我就不太了解了。
    iseki
        106
    iseki  
       46 天前
    这次的情况,无论是 mapped without write access 还是 mapped PROT_NONE 亦或者是 unmapped addresses ,如果按照上文引用的段落来看,都应该是 SIGSEGV

    @lslqtz
    lslqtz
        107
    lslqtz  
       45 天前
    @iseki 无论如何, 让我们看看 Apple 对此的回应和态度.
    做出这种“无缘无故”的更改, 肯定是有其理由在. 我只能推测最大的可能性是基于安全相关的理由.
    StruggleYang
        108
    StruggleYang  
       41 天前
    macOS Sonoma 14.4.1

    本更新提供针对 Mac 的问题修复,包括:

    • 可能无法识别连接至外接显示器的 USB 集线器
    • 为专业音乐 App 设计的防盗拷音频单元插件可能无法打开或通过验证
    • 包含 Java 的 App 可能意外退出
    codehz
        109
    codehz  
    OP
       41 天前
    @StruggleYang 经过测试,14.4.1 已经修复了这个错误,不是给 java 开后门,整个错误都修了
    1  2  
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1538 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 17:15 · PVG 01:15 · LAX 10:15 · JFK 13:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.