Giter VIP home page Giter VIP logo

Comments (15)

achernya avatar achernya commented on August 17, 2024

Please provide details about your system. This works in our CI and in all distribution packages.

from mosh.

barracuda156 avatar barracuda156 commented on August 17, 2024

@achernya Thank you for responding!
macOS 10.6, gcc-13.2 (in fact gcc-4.2 is not picked at all due to C++ standard requirement, I just did not notice that initially).

It could be that either code is correct but uses VSX and not Altivec, in which case fixing a macro will work (i.e., use __VSX__). Or if the code is supposed to by ISA 2.03-compliant, then something is wrong in it (maybe includes).

If it is supposed to be ISA 2.03-compliant, then a macro for ppc64 has to be fixed as well, since the current one will lead to Darwin on ppc64 trying to use 32-bit chunk (it should also check for __ppc64__ to have an intended effect).

from mosh.

barracuda156 avatar barracuda156 commented on August 17, 2024

With includes by the way configure does not check for machine/endian.h, which is the path on Darwin, but it is likely unrelated to the issue here and possibly inconsequential, since libkern macros are checked for.

from mosh.

barracuda156 avatar barracuda156 commented on August 17, 2024

A lazy fix will be

--- src/crypto/ocb_internal.cc
+++ src/crypto/ocb_internal.cc
@@ -220,7 +220,7 @@
 		bl = _mm_slli_epi32(bl, 1);
 		return _mm_xor_si128(bl,tmp);
 	}
-#elif __ALTIVEC__ && _CALL_ELF != 2
+#elif __VSX__ && _CALL_ELF != 2
     #include <altivec.h>
     typedef vector unsigned block;
     #define xor_block(x,y)         vec_xor(x,y)

or if it is known that it works on G4/G5 but not on MacOS, then

--- src/crypto/ocb_internal.cc
+++ src/crypto/ocb_internal.cc
@@ -220,7 +220,7 @@
 		bl = _mm_slli_epi32(bl, 1);
 		return _mm_xor_si128(bl,tmp);
 	}
-#elif __ALTIVEC__ && _CALL_ELF != 2
+#elif (__ALTIVEC__ && _CALL_ELF != 2) && !defined(__APPLE__)
     #include <altivec.h>
     typedef vector unsigned block;
     #define xor_block(x,y)         vec_xor(x,y)

However it may be just some error, and the code could work. In which case we would not want to simply disable vectorization.

from mosh.

achernya avatar achernya commented on August 17, 2024

macOS 10.6 is no longer in support and ocb_internal is vendered code from https://www.cs.ucdavis.edu/~rogaway/ocb/news/code/ocb.c so I'm hesitant to touch it in a meaningful way other than deletions. I suggest you try enabling the openssl-based ocb implementation instead. (That would have been our default for mosh-1.4.0 if it hasn't been for CVE-2022-2097)

from mosh.

barracuda156 avatar barracuda156 commented on August 17, 2024

@achernya Well, if no one knows how to fix it to work on macOS (I do not know Altivec syntax), then just disabling is fine. It will not affect anything else, obviously, since __APPLE__ is defined only for macOS.
That will at least unbreak the build and allow it to function.

from mosh.

achernya avatar achernya commented on August 17, 2024

@barracuda156 please demonstrate that the build is broken on a modern, supported macOS -- otherwise we are not interested in this patchset.

from mosh.

barracuda156 avatar barracuda156 commented on August 17, 2024

@achernya The patch specifically disables it where it is broken. It does not affect other systems where the code is presumed to work. I also fix the failing case here.

from mosh.

achernya avatar achernya commented on August 17, 2024

@barracuda156 as I mentioned in my comment above: I am not willing to take any changes to this file other than deletions. If you would like to get mosh to work, please enable the openssl-based ocb build instead. If you would like to submit a PR to delete all the altivec code instead, I would be willing to merge that.

from mosh.

nethershaw avatar nethershaw commented on August 17, 2024

ocb_internal is vendered code

This is why you don't bundle vendored libraries.

from mosh.

barracuda156 avatar barracuda156 commented on August 17, 2024

@achernya I guess I did not understand correctly your reasoning. If you do not want to modify the code because it is vendored, I am not a legal expert, but I can accept that.

I am not sure if it is a right thing to remove the code, since while it will fix the bug for one platform, it may result in suboptimal performance on another platform, and I have no way to verify if the code builds on BSD and Linux or not.

from mosh.

achernya avatar achernya commented on August 17, 2024

@barracuda156 there's nothing about legality or not of modifying it. It's our inability to have CI for this configuration, therefore a desire to not support it.

from mosh.

barracuda156 avatar barracuda156 commented on August 17, 2024

@achernya What you do with your project is up to you, of course, but to be honest I cannot see how my fix could have any conceivable adverse effect on any platform whatsoever. The only effect of it was to disable usage of that Altivec code on macOS. It was as non-invasive as possible. I am not asking you to support PowerPC proactively nor expect anyone to do it. But no one is better off if the broken code is left unfixed, when the cost of the fix is a single line change with no effect on other systems.

from mosh.

achernya avatar achernya commented on August 17, 2024

Your fix creates an ongoing expectation of support by the maintainers of this project. I've already expressed my desires here that we reduce that support burden since we cannot easily test for altivec on ppc. As a result, I can't take your contribution as is.

Continuing to discuss won't cause us to accept the single-line fix since it doesn't change our ability to test it in an ongoing basis.

from mosh.

barracuda156 avatar barracuda156 commented on August 17, 2024

Just for the record if anyone ever bumps into the issue: the correct fix is to change vector to __vector (and obviously fix a macro for ppc64). Like this: macports/macports-ports@a910a13

My initial suggestion to disable it was suboptimal. The code is fine, but type used is inaccurate.

Related chunk in altivec.h is here: https://github.com/gcc-mirror/gcc/blob/58ecd2eb507ab216861408cf10ec05efc4e8344e/gcc/config/rs6000/altivec.h#L37-L49

from mosh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.