-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it work in modern kernels #1
base: master
Are you sure you want to change the base?
Conversation
): it does not, for me at least. Errors are the same, just on different lines, in functions ‘fh_ftrace_thunk’ and ‘fh_install_hook’ in trap_hook.c file. It's all way above my skill, but I might get it if someone explains. Mind taking a look-see? |
You need to add a specialized hook in the kernel and then arrange the module so as to employ it. Not sure why such hook is not readily available in regular kernels, but the patch to add it is quite straightforward, and apparently it is the only reliable way to do it nowadays. Please see attachment that works fine for me. Besides, I've found and fixed some small bugs in opcode processing but because the main repo looks like abandoned I'm not sure where to push the fixes yet. The attached patch is targeted for regular kernel 5.15.146. |
Ooops. op_emu legal?????????????????? just noticed this inconsistency, lol . Or I mistake? |
I'm definitely not a lawyer, but after browsing through some relevant headers and license files, I'd say it looks like attaching the GPL was incorrect here. This certainly does NOT make the code itself illegal, as it is a fork of some master tree that obviously allowed forking by its license. Therefore, it might be problematic to e.g. include this module as a part of some distribution product or to upstream it. But other than that, I basically see no problem. Just apply appropriate correction to the license file and that's it. |
@zhubr maybe but no, 1 author have ASPL but @mirh lisense own code under GPLv2. I no can change license back to ASPL because code in this project have code from @mirh. At the moment, code from two authors under incompatible licenses is mixed in one project. You can’t just take your previous license and return it. The code is mixed. I'm deleting my fork and all my work. If anyone needs changes, they are saved in a closed merge request. It's a pity. But okay. |
Not sure what's funnier.. That I wasn't subscribed to my own repo, or that my hunger for pedantry (that brought me into spending big time to find the credits for every single line) somehow made the code turn out unproperly copyrighted. Even if the standard terms applied (which I don't really think is the case, even though it's not explicitly stated anywhere) you can mix whatever you want with GPL as long as you aren't shipping the actual binaries that "physically" bind together the different object code. |
:D |
Hi! I'll use this opportunity to say tons of thanks for publishing this module! It lets me run Android x86_64 image on an old Core2 laptop which would otherwise be impossible because of some few opcodes missing. And BTW I'd like to give back a small usermode test and some bugfixes :) |
It's not even mine actually (I probably broke it more than I fixed), it was originally from a brazilian guy. Which AFAIR was exactly like trying to do something with android (on an athlon or core 2), but then upgraded his system and lost interest. But speaking of that.. I knew @maurossi used to ship a hacked up workaround at least in the past. Idk what has been of it? |
Hello everyone. I am the original author of this code. My part of it is MIT licensed. |
@sinetek Hello. Thank you for your response. On this repo https://github.com/sinetek/xnu-amd license is
@mirh (and we all) can use
This files (exclude libudis86 real under Sorry for my English. I hope you understand me :) Maybe someone else will say something else about this. Maybe i just stupid i don't know :D |
The mac kernel is licensed with that, yes. But his modifications are MIT licensed, so we are good (and udis86 is licensed with BSD-2, so ditto). So, the only things left is how much of |
These licenses should all be compatible, with the notable exception of GPL, but I don't see how the GPL is relevant here? |
It is (GPL 2.0) present in the topmost LICENSE file of this repository, causing some confusion and panic to people. |
And it's the expected license of compiled linux modules. |
Well, if you intend to ship/share this module in binary form, yes. But imho this is becoming increasingly unlikely for a number of reasons anyway. Otherwise, for just publishing your module source, the license can be just anything (afaik). |
That's nonsense. NVIDIA's drivers do not ship GPL for example |
Since it turned out that the files written by @sinetek are under the MIT license, as he said, then using only them in this project does not affect the code under ASPL 2.0 and therefore the current GPLv2 license that @mirh chose for his changes does not cause any problems. So everything is fine and I panicked in vain. The only thing is that there is no mention of MIT in the files listed above, and if @sinetek allows (after all, he wrote the code), then the text of the MIT license could be added to these files, this would solve all the theoretical problems. Since the license cannot be implied, it must be explicit and explicitly stated. Yes, sometimes it’s just unnecessary bureaucracy. And we're all here for the fun. Sorry if my remark on licensing caused discomfort for someone :D The point is that I thought that the current GPL project contained code under ASPL, but judging by the author's response, this is not the case. So there are no problems. |
He can do that for his work, but I don't think he can relicense my whole
project.?
…On Wed, Mar 6, 2024 at 8:40 PM BLOGDRON ***@***.***> wrote:
Since it turned out that the files written by @sinetek
<https://github.com/sinetek> are under the MIT license, as he said, then
using only them in this project does not affect the code under ASPL 2.0 and
therefore the current GPLv2 license that @mirh <https://github.com/mirh>
chose for his changes does not cause any problems. So everything is fine
and I panicked in vain. The only thing is that there is no mention of MIT
in the files listed above, and if @sinetek <https://github.com/sinetek>
allows (after all, he wrote the code), then the text of the MIT license
could be added to these files, this would solve all the theoretical
problems. Since the license cannot be implied, it must be explicit and
explicitly stated. Yes, sometimes it’s just unnecessary bureaucracy. And
we're all here for the fun.
Sorry if my remark on licensing caused discomfort for someone :D
The point is that I thought that the current GPL project contained code
under ASPL, but judging by the author's response, this is not the case. So
there are no problems.
—
Reply to this email directly, view it on GitHub
<#1 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNCTC7ULB23ZXC5DPWYM7LYW7ARDAVCNFSM6AAAAAA5VAEB5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBSGE4DIMBYGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
No one has the right to license someone else's code except the author. Licenses can only be compatible and different code under different licenses can exist in one project licensed as a work under any license compatible with all other licenses. At the moment, some licenses are not indicated explicitly in the text, but only indirectly in words. As a result, everything got confused. I can use code under the MIT license in my project under the GPL license, for example, but this does not mean that I relicense the MIT code under the GPL license, it means that the project as a whole is under the GPL, but part of the code is under the MIT license, this is possible because the licenses are compatible. That's all. The problem is that the code under ASPL is incompatible with the GPL, and the words that your changes are under MIT (this solves all problems) are just words and the text of the license for your code is not explicitly indicated, this creates confusion.
I'm not a lawyer. These are just my thoughts. Above I listed the files used in this project, if the author of these files claims that they are under MIT, and not under ASPL, then there are no problems and you just need to add the license text and the author’s copyright to these files, otherwise everything is ambiguous. I will not speak further on this matter. I think everything is clear to everyone. |
@zhubr, since it doesn't seem to be illegal, could you please help me build it? I've patched the kernel to add the hook but have no idea what it is or how to arrange the module so as to employ it. |
When using a patched kernel (with setup_invalid_op_handler function added) you can apply the following patch to this module: |
Thanks, that fixed that, but now I have an error in opemu.c:254 |
I haven't tried in 32-bit. Some details in the sources suggest that it was likely possible at some point. Moreover, 64-bit registers support in current version is actually incomplete and somewhat buggy. Some ifdefs might be necessary. I'd still like to hear if @mirh is interested in PRs and patches to this repository and willing to fix GPL/ASPL confusion by either updating the top LICENSE file or inserting license headers to individual source files so as to clear any subsequent doubts. Or, if not, maybe I'll clone and try to fix it myself (but no promises). |
FWIW I can even add you to the project.. I try to even stay away from linux these days, and it's not like even back then I understood much about registers and opcodes. As for the license, I just realized that we've had a problem here. We couldn't just wave away Meowthra's code because he literally wrote "all rights reserved" (which I guess legally isn't much different from just any generic copyright notice, but practically it rules out any other alternative good faith interpretation) |
Ok, if you are not really interested in maintaining this project anymore, I think I'll better just clone the repository. I'll then eventually try to insert the missing license headers where possible or maybe remove some files. AFAICS as compared to xnu-amd there were 4 new files introduced: fpins.*, sse41.c, trap_hook.c. Those 4 files are either unnecessary for my specific needs or have to be completely redesigned anyway. |
Lines 24 to 26 in 4a56f54
Oh, come on. It was eventually all navel gazing for nothing. |
Ok. Thank you again for your work anyway :) |
broken again here on kernel 6.11.9 |
Can I ask what you are using the opemu for? :-) |
For example, running video game Black Mesa on Phenom II CPU Many processors are old, but they perform their tasks remarkably well, are reliable and often better than even new, budget ones. Sometimes people make software builds with the inclusion of instructions that are not in the old processor, often these instructions do nothing but simply break backward compatibility. The only goal of the opemuu is to make it possible to run software on processors that do not have the necessary instructions, there can be many options here. Sometimes emulation of instructions does not make sense, since the speed of the program drops catastrophically. But this is far from always the case, as I said above, often these are just useless instructions that, for example, only in one place of the program do the addition of several numbers at a time and that's it. |
Please show you error messages. Not working build or not working module? Applications not start?
op_emu detect not implemented instructions and show it in Im have local fork same this repo + this pull request path (for local home experiments). Maybe you need just rebuild you old module for you current |
Using spacefish's repository, building the project fails with many errors. |
Im trying fix errors
|
That's amazing, thanks for the explanation. Maybe it would make sense to separate the GCC fixes (various casts of address fields, fixes of the spacing and so on) from the addition of PMAXUD (AVX, AVX2, AVX-512 did not exist when I wrote this). But idk, you decide |
@philmb3487 Oh, need time for it, no have time now :( |
@blogdron |
@kukabu :( I must have done something wrong. I need to figure it out. I'll try, but I don't have much experience. If I understand correctly the problem is in
it's hard for me to understand what's going on there. I'm stupid :) |
@kukabu Hello Again, I no sure my changes in Im download game and make play test on But before pull request to @Spacefish or to this repo need more inspacts the code correctly, maybe latter. I'll leave everything like this for now. |
Hello |
Hello opemu original author, you say
Im can add Im have my local home fork for experiments, and Im create CREDITS file with all authors and all know changes, my home repo not on github but this CREDITS file ,
I think I have completely figured out what the project consists of, I realized that there are no licensing issues. The last touch, I would like to clearly indicate the license in the main file of your part of this project. Can you help me do this? I just want to clearly indicate you as the author and clearly indicate your license. After that, there will be no questions about the project as a whole and it will be able to live on :) Based on your words above I could simply make a change to specify your license, but I would still ask for your additional permission to specify the text of this license for the opemu project files. :) |
That's.. certainly some commitment, but that "All rights reserved" notice is such an eyesore if you ask to me. |
@mirh Im just copy-paste from headers, fixed " Copyright (c)" same sense. Some initial sources and their authors had to be searched for on the net. I don't have a goal to describe in detail who did what, I just wanted an information file from which it is clear that this is the brainchild of different pieces, different people and with different compatible licenses that you combined into one specific project. Now it is clear that the project consists of three things, an opcode decoder, an opcode emulator and a kernel module, the project is based on the module, the rest are its functional parts. Well, I gave myself the freedom to write briefly about the changes. That's all. Now everything looks clear and transparent, you can improve the module and even suggest including it in the Linux kernel :D Maybe all this is unnecessary, but I wrote it rather for my own peace of mind, so that I would not think about licenses and rights. And just change the code as I want and share it with whoever I want. =) Previously, I had uncertainty. |
Wait, does this not emulate SSE2? |
Yes, do what you want with it, it's fine. @megatog615 No, SSE2 is a requirement of AMD64, so I never found it necessary to add support for SSE2.. Apple switched to intel processors around the time when pure i386 chips disappeared, and it was just never really needed. Apple's early OS on intel had a crazy setup... AMD64 was a requirement for the OS, but the machine only supported a strange version of 32-bit UEFI, and could not boot a 64-bit kernel. So the kernel was entirely 32-bit, but the userspace would run in 64-bit. That caused trouble on AMD because the system-call entry/exit mechanism works differently. So it wasn't just SSE4 that needed emulating because the entire system-call interface wasn't working on AMD chips. |
I didn't invent the idea of the opemu, I read a paper about an implementation of it for mac os that was written in assembly language. I never found the original code, but based on the research paper the basic idea of using an opcode trap the idea was clear enough. |
Thank you |
not sure if it works :)