executable is killed after codesign (2024)

Code Signing General Code Signing

You’re now watching this thread. If you’ve opted in to email or web notifications, you’ll be notified when there’s activity. Click again to stop watching or visit your profile to manage watched threads and notifications.

You’ve stopped watching this thread and will no longer receive emails or web notifications when there’s activity. Click again to start watching.

commvault_dev OP

Created Mar ’20

Replies 8

Boosts 0

Views 5.7k

Participants 6

Hi,

After we made changes for apple notarization, I cannot seem to re-place a binary for debugging.

[This are all terminal binaries, not apps]

executable A is linked with library B, both are codesingned with

codesign -f -o runtime -s "identity" <binary>

and, are runnign fine.

Now, for debugging if I make a change in B and replace it, now A is killed right away with error

Exception Type: EXC_BAD_ACCESS (Code Signature Invalid)

Exception Codes: 0x0000000000000032, 0x0000000103082000

Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: Namespace CODESIGNING, Code 0x2

Application Specific Information:

dyld: in dlopen()

<path to library B>

even if I add entitlement get-task-allow to executable A, it's still same.

What can I do, what am I missing?

Boost

Share this post

Copied to Clipboard

Replies 8

Boosts 0

Views 5.7k

Participants 6

Ken Thomases OP

Mar ’20

That's part of the purpose of the hardened runtime. By default, it won't allow an app to load an unsigned library or a library whose code signature has been invalidated because it's been modified since it's been signed.

You will have to sign the modified library B. Or, you could debug with a build of A that does not have the hardened runtime enabled. Alternatively, you could debug with SIP disabled.

You could add the Disable Library Validation Entitlement to A to relax the hardened runtime's restriction, but be sure you remove that for the build you ship unless you're sure you want to allow that.

    Add comment

    commvault_dev OP

    Mar ’20

    I have tried these

    1) codesign modified B => doesn't work

    2) codesign both A and B => doesn't work

    3) codesign both A and B by removing "-o runtime" - disabling hardend runtime => doesn't work

    with 2 and 3 now, binary wont even start. lldb says "bad executable (or shared library), dtruss says (no such file or directory)

    if I remove codesign from both A and B, then it works.

    Share this post

    Copied to Clipboard

      Add comment

      executable is killed after codesign (4)

      DTS Engineer OP

      Apple

      Mar ’20

      How are you “replacing” this binary? macOS has a long-standing wrinkle that causes problems if you overwrite a Mach-O file on disk (the kernel caches code signing info from the original file and doesn’t flush that cache when you rewrite it). If you want to replace a Mach-O file on disk, you should always replace the file with a new one. Thus, using

      mv

      not

      cp

      .

      Share and Enjoy

      Quinn “The Eskimo!”
      Apple Developer Relations, Developer Technical Support, Core OS/Hardware

      let myEmail = "eskimo" + "1" + "@apple.com"

      2

      Share this post

      Copied to Clipboard

        Add comment

        commvault_dev OP

        Mar ’20

        that perhaps is, because what I went on trying is, disabled SIP => things worked, enabled SIP => things continued working. now, I have issues with some binary not all, and a simple reboot fixed it.

        in log stream all I was getting is

        020-03-18 15:57:49.958688-0500 0xc530 Default 0x0 8777 0 taskgated: (Security) [com.apple.securityd:security_exception] UNIX error exception: 3

        2020-03-18 15:57:49.960037-0500 0xc530 Default 0x0 8777 0 taskgated: no signature for pid=5799 (cannot make code: UNIX[No such process])

        which perhaps indicates what your are suggesting about kernel caching code sign info.

        I would try mv when I try next and update here.

        Share this post

        Copied to Clipboard

          Add comment

          sandeeptt OP

          Mar ’20

          I too seeing the same issue.

          When I overwrite the old binaries with the newer one (with additional entitlements), I get "Killed: 9" error: Bad executable (or shared library)" when I execute any binary that has a dependecy on .dylib. The binaries that just depends on "/usr/lib/libSystem.B.dylib" works fine. When I reboot the machine, then all the binaries work fine and no error is seen.

          Do I need to flush dylib cache or any other cache to avoid the reboot? Or How can I fix it please?

          Share this post

          Copied to Clipboard

            Add comment

            executable is killed after codesign (7)

            DTS Engineer OP

            Apple

            Mar ’20

            See my response on the other thread you posted to.

            Share and Enjoy

            Quinn “The Eskimo!”
            Apple Developer Relations, Developer Technical Support, Core OS/Hardware

            let myEmail = "eskimo" + "1" + "@apple.com"

            Share this post

            Copied to Clipboard

              Add comment

              executable is killed after codesign (8)

              DTS Engineer OP

              Apple

              Jul ’21

              It is new in [Apple silicon]?

              No, but you’re more likely to encounter it on Apple silicon because code signing is absolutely required on that architecture. Previous architectures would let you build and run (at least locally) unsigned code.

              Share and Enjoy

              Quinn “The Eskimo!” @ Developer Technical Support @ Apple
              let myEmail = "eskimo" + "1" + "@" + "apple.com"

              Share this post

              Copied to Clipboard

                Add comment

                executable is killed after codesign (9)

                DTS Engineer OP

                Apple

                Oct ’21

                Use mv not cp is the key.

                Cool.

                I finally got around to documenting this gotcha officially: Updating Mac Software.

                Share and Enjoy

                Quinn “The Eskimo!” @ Developer Technical Support @ Apple
                let myEmail = "eskimo" + "1" + "@" + "apple.com"

                Share this post

                Copied to Clipboard

                  Add comment

                  executable is killed after codesign (2024)
                  Top Articles
                  Walgreens 8 Mile Dequindre
                  30 years later, suspect arrested in fatal Tampa shooting and robbery
                  Lexi Vonn
                  What is Mercantilism?
                  Www.craigslist Augusta Ga
                  P2P4U Net Soccer
                  Bed Bath And Body Works Hiring
                  Mid90S Common Sense Media
                  Sport Clip Hours
                  Charmeck Arrest Inquiry
                  Reddit Wisconsin Badgers Leaked
                  FAQ: Pressure-Treated Wood
                  Where does insurance expense go in accounting?
                  Hartland Liquidation Oconomowoc
                  Gemita Alvarez Desnuda
                  The best TV and film to watch this week - A Very Royal Scandal to Tulsa King
                  360 Tabc Answers
                  Sni 35 Wiring Diagram
                  91 East Freeway Accident Today 2022
                  The Pretty Kitty Tanglewood
                  Ubg98.Github.io Unblocked
                  Cbssports Rankings
                  Never Give Up Quotes to Keep You Going
                  Myql Loan Login
                  Silky Jet Water Flosser
                  Makemv Splunk
                  Darrell Waltrip Off Road Center
                  January 8 Jesus Calling
                  Black Panther 2 Showtimes Near Epic Theatres Of Palm Coast
                  Pronóstico del tiempo de 10 días para San Josecito, Provincia de San José, Costa Rica - The Weather Channel | weather.com
                  Our 10 Best Selfcleaningcatlitterbox in the US - September 2024
                  Little Einsteins Transcript
                  Craigslist/Phx
                  Kaiju Paradise Crafting Recipes
                  EST to IST Converter - Time Zone Tool
                  Litter-Robot 3 Pinch Contact & DFI Kit
                  Car Crash On 5 Freeway Today
                  Aveda Caramel Toner Formula
                  SOC 100 ONL Syllabus
                  ATM Near Me | Find The Nearest ATM Location | ATM Locator NL
                  Otter Bustr
                  Bitchinbubba Face
                  5 Tips To Throw A Fun Halloween Party For Adults
                  Easy Pigs in a Blanket Recipe - Emmandi's Kitchen
                  Craigslist Pets Plattsburgh Ny
                  Energy Management and Control System Expert (f/m/d) for Battery Storage Systems | StudySmarter - Talents
                  Az Unblocked Games: Complete with ease | airSlate SignNow
                  4k Movie, Streaming, Blu-Ray Disc, and Home Theater Product Reviews & News
                  Walmart Careers Stocker
                  March 2023 Wincalendar
                  How To Connect To Rutgers Wifi
                  Booked On The Bayou Houma 2023
                  Latest Posts
                  Article information

                  Author: Msgr. Refugio Daniel

                  Last Updated:

                  Views: 6293

                  Rating: 4.3 / 5 (54 voted)

                  Reviews: 85% of readers found this page helpful

                  Author information

                  Name: Msgr. Refugio Daniel

                  Birthday: 1999-09-15

                  Address: 8416 Beatty Center, Derekfort, VA 72092-0500

                  Phone: +6838967160603

                  Job: Mining Executive

                  Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

                  Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.