Code Monkey home page Code Monkey logo

Comments (4)

ryanmiao avatar ryanmiao commented on August 19, 2024

Amazing analyse, so the root problem is the code generation of the macro __FILE__ and __LINE__.

from kpatch.

jpoimboe avatar jpoimboe commented on August 19, 2024

For now I think it's ok if we just document this behavior. It is kind of annoying, but technically, it's working as expected. If the WARN call's line number changes, then it makes sense that the value of __LINE__ will be different and the function will be replaced to use the new value of __LINE__ in the WARN call.

The worst case is that we end up patching some functions that haven't really changed. If that turns out to be a problem for the user, we might be able to fix this in a different way. For example, they could modify the patch to redefine the WARN macro for the affected files, such that it hard codes the old line number instead of using __LINE__, so that the affected function is recompiled to be identical.

from kpatch.

sjenning avatar sjenning commented on August 19, 2024

@jpoimboe sounds like a reasonable (and the only) solution for now. Detecting line number changes when they are encoded in mov instructions... not sure how we could detect that and therefore determine equivalence at the object level.

from kpatch.

jpoimboe avatar jpoimboe commented on August 19, 2024

Since we have no plans to fix this, I'll just document it in the README as expected behavior.

A future fix might involve changing the WARN macro upstream so that it works kind of like the BUG macro, with its own warn_table.

from kpatch.

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.