From edbb37cea0faa94a15e622c6c25d4821b694d7c6 Mon Sep 17 00:00:00 2001 From: puhaodong Date: Sat, 11 Oct 2025 14:40:56 +0800 Subject: [PATCH 1/3] openEuler 24.03 sp1 6.6.0-72.0.0 kernel patch for AOSP15 --- .../0001-exagear-kernel-module.patch | 1123 +++++++++++++++++ .../0001.add_kbox_kernel_config.patch | 30 + .../0002.include_exagear_kconfig.patch | 25 + .../0009.enable_cgroup.patch | 18 + .../0010.fix_usermode_memory_layout.patch | 20 + 5 files changed, 1216 insertions(+) create mode 100644 patchForKernel/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch create mode 100644 patchForKernel/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch create mode 100644 patchForKernel/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch create mode 100644 patchForKernel/kernel_6.6.0-72.0.0/0009.enable_cgroup.patch create mode 100644 patchForKernel/kernel_6.6.0-72.0.0/0010.fix_usermode_memory_layout.patch diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch b/patchForKernel/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch new file mode 100644 index 0000000..2ad0dc6 --- /dev/null +++ b/patchForKernel/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch @@ -0,0 +1,1123 @@ +diff --git a/drivers/tango32-module/COPYING b/drivers/tango32-module/COPYING +new file mode 100644 +index 000000000..d159169d1 +--- /dev/null ++++ b/drivers/tango32-module/COPYING +@@ -0,0 +1,339 @@ ++ GNU GENERAL PUBLIC LICENSE ++ Version 2, June 1991 ++ ++ Copyright (C) 1989, 1991 Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ Everyone is permitted to copy and distribute verbatim copies ++ of this license document, but changing it is not allowed. ++ ++ Preamble ++ ++ The licenses for most software are designed to take away your ++freedom to share and change it. By contrast, the GNU General Public ++License is intended to guarantee your freedom to share and change free ++software--to make sure the software is free for all its users. This ++General Public License applies to most of the Free Software ++Foundation's software and to any other program whose authors commit to ++using it. (Some other Free Software Foundation software is covered by ++the GNU Lesser General Public License instead.) You can apply it to ++your programs, too. ++ ++ When we speak of free software, we are referring to freedom, not ++price. Our General Public Licenses are designed to make sure that you ++have the freedom to distribute copies of free software (and charge for ++this service if you wish), that you receive source code or can get it ++if you want it, that you can change the software or use pieces of it ++in new free programs; and that you know you can do these things. ++ ++ To protect your rights, we need to make restrictions that forbid ++anyone to deny you these rights or to ask you to surrender the rights. ++These restrictions translate to certain responsibilities for you if you ++distribute copies of the software, or if you modify it. ++ ++ For example, if you distribute copies of such a program, whether ++gratis or for a fee, you must give the recipients all the rights that ++you have. You must make sure that they, too, receive or can get the ++source code. And you must show them these terms so they know their ++rights. ++ ++ We protect your rights with two steps: (1) copyright the software, and ++(2) offer you this license which gives you legal permission to copy, ++distribute and/or modify the software. ++ ++ Also, for each author's protection and ours, we want to make certain ++that everyone understands that there is no warranty for this free ++software. If the software is modified by someone else and passed on, we ++want its recipients to know that what they have is not the original, so ++that any problems introduced by others will not reflect on the original ++authors' reputations. ++ ++ Finally, any free program is threatened constantly by software ++patents. We wish to avoid the danger that redistributors of a free ++program will individually obtain patent licenses, in effect making the ++program proprietary. To prevent this, we have made it clear that any ++patent must be licensed for everyone's free use or not licensed at all. ++ ++ The precise terms and conditions for copying, distribution and ++modification follow. ++ ++ GNU GENERAL PUBLIC LICENSE ++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ++ ++ 0. This License applies to any program or other work which contains ++a notice placed by the copyright holder saying it may be distributed ++under the terms of this General Public License. The "Program", below, ++refers to any such program or work, and a "work based on the Program" ++means either the Program or any derivative work under copyright law: ++that is to say, a work containing the Program or a portion of it, ++either verbatim or with modifications and/or translated into another ++language. (Hereinafter, translation is included without limitation in ++the term "modification".) Each licensee is addressed as "you". ++ ++Activities other than copying, distribution and modification are not ++covered by this License; they are outside its scope. The act of ++running the Program is not restricted, and the output from the Program ++is covered only if its contents constitute a work based on the ++Program (independent of having been made by running the Program). ++Whether that is true depends on what the Program does. ++ ++ 1. You may copy and distribute verbatim copies of the Program's ++source code as you receive it, in any medium, provided that you ++conspicuously and appropriately publish on each copy an appropriate ++copyright notice and disclaimer of warranty; keep intact all the ++notices that refer to this License and to the absence of any warranty; ++and give any other recipients of the Program a copy of this License ++along with the Program. ++ ++You may charge a fee for the physical act of transferring a copy, and ++you may at your option offer warranty protection in exchange for a fee. ++ ++ 2. You may modify your copy or copies of the Program or any portion ++of it, thus forming a work based on the Program, and copy and ++distribute such modifications or work under the terms of Section 1 ++above, provided that you also meet all of these conditions: ++ ++ a) You must cause the modified files to carry prominent notices ++ stating that you changed the files and the date of any change. ++ ++ b) You must cause any work that you distribute or publish, that in ++ whole or in part contains or is derived from the Program or any ++ part thereof, to be licensed as a whole at no charge to all third ++ parties under the terms of this License. ++ ++ c) If the modified program normally reads commands interactively ++ when run, you must cause it, when started running for such ++ interactive use in the most ordinary way, to print or display an ++ announcement including an appropriate copyright notice and a ++ notice that there is no warranty (or else, saying that you provide ++ a warranty) and that users may redistribute the program under ++ these conditions, and telling the user how to view a copy of this ++ License. (Exception: if the Program itself is interactive but ++ does not normally print such an announcement, your work based on ++ the Program is not required to print an announcement.) ++ ++These requirements apply to the modified work as a whole. If ++identifiable sections of that work are not derived from the Program, ++and can be reasonably considered independent and separate works in ++themselves, then this License, and its terms, do not apply to those ++sections when you distribute them as separate works. But when you ++distribute the same sections as part of a whole which is a work based ++on the Program, the distribution of the whole must be on the terms of ++this License, whose permissions for other licensees extend to the ++entire whole, and thus to each and every part regardless of who wrote it. ++ ++Thus, it is not the intent of this section to claim rights or contest ++your rights to work written entirely by you; rather, the intent is to ++exercise the right to control the distribution of derivative or ++collective works based on the Program. ++ ++In addition, mere aggregation of another work not based on the Program ++with the Program (or with a work based on the Program) on a volume of ++a storage or distribution medium does not bring the other work under ++the scope of this License. ++ ++ 3. You may copy and distribute the Program (or a work based on it, ++under Section 2) in object code or executable form under the terms of ++Sections 1 and 2 above provided that you also do one of the following: ++ ++ a) Accompany it with the complete corresponding machine-readable ++ source code, which must be distributed under the terms of Sections ++ 1 and 2 above on a medium customarily used for software interchange; or, ++ ++ b) Accompany it with a written offer, valid for at least three ++ years, to give any third party, for a charge no more than your ++ cost of physically performing source distribution, a complete ++ machine-readable copy of the corresponding source code, to be ++ distributed under the terms of Sections 1 and 2 above on a medium ++ customarily used for software interchange; or, ++ ++ c) Accompany it with the information you received as to the offer ++ to distribute corresponding source code. (This alternative is ++ allowed only for noncommercial distribution and only if you ++ received the program in object code or executable form with such ++ an offer, in accord with Subsection b above.) ++ ++The source code for a work means the preferred form of the work for ++making modifications to it. For an executable work, complete source ++code means all the source code for all modules it contains, plus any ++associated interface definition files, plus the scripts used to ++control compilation and installation of the executable. However, as a ++special exception, the source code distributed need not include ++anything that is normally distributed (in either source or binary ++form) with the major components (compiler, kernel, and so on) of the ++operating system on which the executable runs, unless that component ++itself accompanies the executable. ++ ++If distribution of executable or object code is made by offering ++access to copy from a designated place, then offering equivalent ++access to copy the source code from the same place counts as ++distribution of the source code, even though third parties are not ++compelled to copy the source along with the object code. ++ ++ 4. You may not copy, modify, sublicense, or distribute the Program ++except as expressly provided under this License. Any attempt ++otherwise to copy, modify, sublicense or distribute the Program is ++void, and will automatically terminate your rights under this License. ++However, parties who have received copies, or rights, from you under ++this License will not have their licenses terminated so long as such ++parties remain in full compliance. ++ ++ 5. You are not required to accept this License, since you have not ++signed it. However, nothing else grants you permission to modify or ++distribute the Program or its derivative works. These actions are ++prohibited by law if you do not accept this License. Therefore, by ++modifying or distributing the Program (or any work based on the ++Program), you indicate your acceptance of this License to do so, and ++all its terms and conditions for copying, distributing or modifying ++the Program or works based on it. ++ ++ 6. Each time you redistribute the Program (or any work based on the ++Program), the recipient automatically receives a license from the ++original licensor to copy, distribute or modify the Program subject to ++these terms and conditions. You may not impose any further ++restrictions on the recipients' exercise of the rights granted herein. ++You are not responsible for enforcing compliance by third parties to ++this License. ++ ++ 7. If, as a consequence of a court judgment or allegation of patent ++infringement or for any other reason (not limited to patent issues), ++conditions are imposed on you (whether by court order, agreement or ++otherwise) that contradict the conditions of this License, they do not ++excuse you from the conditions of this License. If you cannot ++distribute so as to satisfy simultaneously your obligations under this ++License and any other pertinent obligations, then as a consequence you ++may not distribute the Program at all. For example, if a patent ++license would not permit royalty-free redistribution of the Program by ++all those who receive copies directly or indirectly through you, then ++the only way you could satisfy both it and this License would be to ++refrain entirely from distribution of the Program. ++ ++If any portion of this section is held invalid or unenforceable under ++any particular circumstance, the balance of the section is intended to ++apply and the section as a whole is intended to apply in other ++circumstances. ++ ++It is not the purpose of this section to induce you to infringe any ++patents or other property right claims or to contest validity of any ++such claims; this section has the sole purpose of protecting the ++integrity of the free software distribution system, which is ++implemented by public license practices. Many people have made ++generous contributions to the wide range of software distributed ++through that system in reliance on consistent application of that ++system; it is up to the author/donor to decide if he or she is willing ++to distribute software through any other system and a licensee cannot ++impose that choice. ++ ++This section is intended to make thoroughly clear what is believed to ++be a consequence of the rest of this License. ++ ++ 8. If the distribution and/or use of the Program is restricted in ++certain countries either by patents or by copyrighted interfaces, the ++original copyright holder who places the Program under this License ++may add an explicit geographical distribution limitation excluding ++those countries, so that distribution is permitted only in or among ++countries not thus excluded. In such case, this License incorporates ++the limitation as if written in the body of this License. ++ ++ 9. The Free Software Foundation may publish revised and/or new versions ++of the General Public License from time to time. Such new versions will ++be similar in spirit to the present version, but may differ in detail to ++address new problems or concerns. ++ ++Each version is given a distinguishing version number. If the Program ++specifies a version number of this License which applies to it and "any ++later version", you have the option of following the terms and conditions ++either of that version or of any later version published by the Free ++Software Foundation. If the Program does not specify a version number of ++this License, you may choose any version ever published by the Free Software ++Foundation. ++ ++ 10. If you wish to incorporate parts of the Program into other free ++programs whose distribution conditions are different, write to the author ++to ask for permission. For software which is copyrighted by the Free ++Software Foundation, write to the Free Software Foundation; we sometimes ++make exceptions for this. Our decision will be guided by the two goals ++of preserving the free status of all derivatives of our free software and ++of promoting the sharing and reuse of software generally. ++ ++ NO WARRANTY ++ ++ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY ++FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN ++OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES ++PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED ++OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ++MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS ++TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE ++PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, ++REPAIR OR CORRECTION. ++ ++ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING ++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR ++REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, ++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING ++OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED ++TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY ++YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER ++PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE ++POSSIBILITY OF SUCH DAMAGES. ++ ++ END OF TERMS AND CONDITIONS ++ ++ How to Apply These Terms to Your New Programs ++ ++ If you develop a new program, and you want it to be of the greatest ++possible use to the public, the best way to achieve this is to make it ++free software which everyone can redistribute and change under these terms. ++ ++ To do so, attach the following notices to the program. It is safest ++to attach them to the start of each source file to most effectively ++convey the exclusion of warranty; and each file should have at least ++the "copyright" line and a pointer to where the full notice is found. ++ ++ ++ Copyright (C) ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ ++Also add information on how to contact you by electronic and paper mail. ++ ++If the program is interactive, make it output a short notice like this ++when it starts in an interactive mode: ++ ++ Gnomovision version 69, Copyright (C) year name of author ++ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. ++ This is free software, and you are welcome to redistribute it ++ under certain conditions; type `show c' for details. ++ ++The hypothetical commands `show w' and `show c' should show the appropriate ++parts of the General Public License. Of course, the commands you use may ++be called something other than `show w' and `show c'; they could even be ++mouse-clicks or menu items--whatever suits your program. ++ ++You should also get your employer (if you work as a programmer) or your ++school, if any, to sign a "copyright disclaimer" for the program, if ++necessary. Here is a sample; alter the names: ++ ++ Yoyodyne, Inc., hereby disclaims all copyright interest in the program ++ `Gnomovision' (which makes passes at compilers) written by James Hacker. ++ ++ , 1 April 1989 ++ Ty Coon, President of Vice ++ ++This General Public License does not permit incorporating your program into ++proprietary programs. If your program is a subroutine library, you may ++consider it more useful to permit linking proprietary applications with the ++library. If this is what you want to do, use the GNU Lesser General ++Public License instead of this License. +diff --git a/drivers/tango32-module/Kconfig b/drivers/tango32-module/Kconfig +new file mode 100644 +index 000000000..b152e7d99 +--- /dev/null ++++ b/drivers/tango32-module/Kconfig +@@ -0,0 +1,8 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++config TANGO32 ++ tristate "32-bit syscall support for the Tango binary translator" ++ depends on 64BIT && COMPAT ++ help ++ This driver exposes 32-bit compat syscalls to 64-bit processes. It is ++ intended for the use of the Tango binary translator. +diff --git a/drivers/tango32-module/Makefile b/drivers/tango32-module/Makefile +new file mode 100644 +index 000000000..cd0066e14 +--- /dev/null ++++ b/drivers/tango32-module/Makefile +@@ -0,0 +1,10 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++obj-$(CONFIG_TANGO32) += tango32.o ++ ++KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build ++M ?= $(shell pwd) ++KBUILD_OPTIONS += CONFIG_TANGO32=m ++ ++modules modules_install clean: ++ $(MAKE) -C $(KERNEL_SRC) M=$(M) $(KBUILD_OPTIONS) W=1 $(@) +diff --git a/drivers/tango32-module/README.md b/drivers/tango32-module/README.md +new file mode 100644 +index 000000000..e76507e52 +--- /dev/null ++++ b/drivers/tango32-module/README.md +@@ -0,0 +1,7 @@ ++# Tango kernel module ++ ++This is the source code for the kernel module used by the [Tango binary translator](https://www.amanieusystems.com/) which translates 32-bit ARM programs to run on 64-bit only ARM processors. ++ ++This kernel module allows 64-bit processes to emulate 32-bit system calls that cannot be entirely emulated in userspace. The interface is provided through ioctls on the `/dev/tango32` device node. ++ ++The minimum supported kernel version to v5.6. There is partial support for older kernels but this is not supported and some ioctls may behave incorrectly. +diff --git a/drivers/tango32-module/tango32.c b/drivers/tango32-module/tango32.c +new file mode 100644 +index 000000000..7210f2d93 +--- /dev/null ++++ b/drivers/tango32-module/tango32.c +@@ -0,0 +1,605 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "tango32.h" ++ ++/* fdget_pos and fdput_pos are not exported to modules. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) ++ ++static inline bool file_needs_f_pos_lock(struct file *file) ++{ ++ return (file->f_mode & FMODE_ATOMIC_POS) && ++ (file_count(file) > 1 || file->f_op->iterate_shared); ++} ++ ++static struct fd my_fdget_pos(unsigned int fd) ++{ ++ struct fd f = fdget(fd); ++ struct file *file = fd_file(f); ++ ++ if (file && file_needs_f_pos_lock(file)) { ++ f.word |= FDPUT_POS_UNLOCK; ++ mutex_lock(&file->f_pos_lock); ++ } ++ return f; ++} ++static void my_fdput_pos(struct fd f) ++{ ++ if (f.word & FDPUT_POS_UNLOCK) ++ mutex_unlock(&fd_file(f)->f_pos_lock); ++ fdput(f); ++} ++ ++#else ++ ++static struct fd my_fdget_pos(unsigned int fd) ++{ ++ struct fd f = fdget(fd); ++ if (f.file && (f.file->f_mode & FMODE_ATOMIC_POS)) { ++ if (file_count(f.file) > 1) { ++ f.flags |= FDPUT_POS_UNLOCK; ++ mutex_lock(&f.file->f_pos_lock); ++ } ++ } ++ return f; ++} ++static void my_fdput_pos(struct fd fd) ++{ ++ if (fd.flags & FDPUT_POS_UNLOCK) ++ mutex_unlock(&fd.file->f_pos_lock); ++ fdput(fd); ++} ++ ++// These wrappers are not available on older kernels. ++#define fd_file(f) (f).file ++static inline bool fd_empty(struct fd f) ++{ ++ return unlikely(!f.file); ++} ++ ++#endif ++ ++static bool is_32bit(void) ++{ ++ return test_thread_flag(TIF_32BIT); ++} ++ ++static void set_32bit(bool val) ++{ ++ if (val) ++ set_thread_flag(TIF_32BIT); ++ else ++ clear_thread_flag(TIF_32BIT); ++} ++ ++static long tango32_get_version(struct tango32_abi_version __user *argp) ++{ ++ bool compat; ++ struct tango32_abi_version abi = { .major = TANGO32_ABI_MAJOR, ++ .minor = TANGO32_ABI_MINOR }; ++ ++ /* ++ * Sanity check: ensure that setting TIF_32BIT properly results in ++ * in_compat_syscall() returning true. ++ */ ++ set_32bit(true); ++ compat = in_compat_syscall(); ++ set_32bit(false); ++ ++ if (!compat) ++ return -EIO; ++ ++ if (copy_to_user(argp, &abi, sizeof(abi))) ++ return -EFAULT; ++ ++ return 0; ++} ++ ++/* ++* Based on validate_prctl_map_addr in kernel/sys.c. ++*/ ++static int validate_mm_fields(const struct tango32_mm *mm_fields) ++{ ++ unsigned long mmap_max_addr = TASK_SIZE; ++ /* ++ * mmap_min_addr is not exported to modules. However this isn't a big ++ * issue here since these values are mostly informational. The only one ++ * which is actually used for VM allocations is brk but this is still ++ * checked again mmap_min_addr in the brk syscall. ++ */ ++ unsigned long mmap_min_addr = PAGE_SIZE; ++ long retval = -EINVAL, i; ++ ++ static const unsigned char offsets[] = { ++ offsetof(struct tango32_mm, start_code), ++ offsetof(struct tango32_mm, end_code), ++ offsetof(struct tango32_mm, start_data), ++ offsetof(struct tango32_mm, end_data), ++ offsetof(struct tango32_mm, start_brk), ++ offsetof(struct tango32_mm, brk), ++ offsetof(struct tango32_mm, start_stack), ++ offsetof(struct tango32_mm, arg_start), ++ offsetof(struct tango32_mm, arg_end), ++ offsetof(struct tango32_mm, env_start), ++ offsetof(struct tango32_mm, env_end), ++ }; ++ ++ /* ++ * Make sure the members are not somewhere outside ++ * of allowed address space. ++ */ ++ for (i = 0; i < ARRAY_SIZE(offsets); i++) { ++ u64 val = *(u64 *)((char *)mm_fields + offsets[i]); ++ ++ if ((unsigned long)val >= mmap_max_addr || ++ (unsigned long)val < mmap_min_addr) ++ goto out; ++ } ++ ++ /* ++ * Make sure the pairs are ordered. ++ */ ++#define __prctl_check_order(__m1, __op, __m2) \ ++ ((unsigned long)mm_fields->__m1 __op(unsigned long) mm_fields->__m2) ? \ ++ 0 : \ ++ -EINVAL ++ retval = __prctl_check_order(start_code, <, end_code); ++ retval |= __prctl_check_order(start_data, <=, end_data); ++ retval |= __prctl_check_order(start_brk, <=, brk); ++ retval |= __prctl_check_order(arg_start, <=, arg_end); ++ retval |= __prctl_check_order(env_start, <=, env_end); ++ if (retval) ++ goto out; ++#undef __prctl_check_order ++ ++ retval = -EINVAL; ++ ++ /* ++ * Neither we should allow to override limits if they set. ++ */ ++ if (check_data_rlimit(rlimit(RLIMIT_DATA), mm_fields->brk, ++ mm_fields->start_brk, mm_fields->end_data, ++ mm_fields->start_data)) ++ goto out; ++ ++ retval = 0; ++out: ++ return retval; ++} ++ ++static long tango32_set_mm(struct tango32_mm __user *argp) ++{ ++ struct mm_struct *mm = current->mm; ++ unsigned long user_auxv[AT_VECTOR_SIZE]; ++ struct tango32_mm mm_fields; ++ long retval; ++ ++ BUILD_BUG_ON(sizeof(user_auxv) != sizeof(mm->saved_auxv)); ++ ++ if (copy_from_user(&mm_fields, argp, sizeof(mm_fields))) ++ return -EFAULT; ++ ++ /* ++ * Sanity-check the input values. ++ */ ++ retval = validate_mm_fields(&mm_fields); ++ if (retval) ++ return retval; ++ ++ if (mm_fields.auxv_size) { ++ /* ++ * Someone is trying to cheat the auxv vector. ++ */ ++ if (!mm_fields.auxv || ++ mm_fields.auxv_size > sizeof(mm->saved_auxv)) ++ return -EINVAL; ++ ++ memset(user_auxv, 0, sizeof(user_auxv)); ++ if (copy_from_user(user_auxv, ++ (const void __user *)mm_fields.auxv, ++ mm_fields.auxv_size)) ++ return -EFAULT; ++ ++ /* Last entry must be AT_NULL as specification requires */ ++ user_auxv[AT_VECTOR_SIZE - 2] = AT_NULL; ++ user_auxv[AT_VECTOR_SIZE - 1] = AT_NULL; ++ } ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) ++ if (mmap_read_lock_killable(mm)) ++ return -EINTR; ++#else ++ if (down_read_killable(&mm->mmap_sem)) ++ return -EINTR; ++#endif ++ ++ spin_lock(&mm->arg_lock); ++ mm->start_code = mm_fields.start_code; ++ mm->end_code = mm_fields.end_code; ++ mm->start_data = mm_fields.start_data; ++ mm->end_data = mm_fields.end_data; ++ mm->start_brk = mm_fields.start_brk; ++ mm->brk = mm_fields.brk; ++ mm->start_stack = mm_fields.start_stack; ++ mm->arg_start = mm_fields.arg_start; ++ mm->arg_end = mm_fields.arg_end; ++ mm->env_start = mm_fields.env_start; ++ mm->env_end = mm_fields.env_end; ++ spin_unlock(&mm->arg_lock); ++ ++ if (mm_fields.auxv_size) ++ memcpy(mm->saved_auxv, user_auxv, sizeof(user_auxv)); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) ++ mmap_read_unlock(mm); ++#else ++ up_read(&mm->mmap_sem); ++#endif ++ ++ return retval; ++} ++ ++static long tango32_set_mmap_base(unsigned long arg) ++{ ++ unsigned long mmap_max_addr = TASK_SIZE; ++ /* mmap_min_addr is not exported to modules, pick a safe default. */ ++ unsigned long mmap_min_addr = 0x10000000; ++ struct mm_struct *mm = current->mm; ++ ++ if (arg >= mmap_max_addr || arg <= mmap_min_addr) ++ return -EINVAL; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) ++ if (mmap_write_lock_killable(mm)) ++ return -EINTR; ++#else ++ if (down_write_killable(&mm->mmap_sem)) ++ return -EINTR; ++#endif ++ ++ mm->mmap_base = arg; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) ++ mmap_write_unlock(mm); ++#else ++ up_write(&mm->mmap_sem); ++#endif ++ ++ return 0; ++} ++ ++static long tango32_compat_ioctl(struct tango32_compat_ioctl __user *argp) ++{ ++ struct tango32_compat_ioctl args; ++ struct fd f; ++ long retval; ++ ++ if (copy_from_user(&args, argp, sizeof(args))) ++ return -EFAULT; ++ ++ f = fdget(args.fd); ++ if (fd_empty(f)) ++ return -EBADF; ++ ++ /* ++ * Pretend to be a 32-bit task for the duration of this syscall. ++ */ ++ set_32bit(true); ++ ++ retval = security_file_ioctl(fd_file(f), args.cmd, args.arg); ++ if (retval) ++ goto out; ++ ++ retval = -ENOIOCTLCMD; ++ if (fd_file(f)->f_op->compat_ioctl) ++ retval = fd_file(f)->f_op->compat_ioctl(fd_file(f), args.cmd, args.arg); ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) ++#warning "Support for kernels before v5.6 is experimental" ++ /* ++ * Older kernels don't provide compat_ioctl on all devices, so as a ++ * workaround we pass the ioctls through unmodified if compat_ioctl is ++ * not provided. This should work for most ioctls. ++ */ ++ else if (fd_file(f)->f_op->unlocked_ioctl) ++ retval = fd_file(f)->f_op->unlocked_ioctl(fd_file(f), args.cmd, ++ args.arg); ++#endif ++ ++out: ++ set_32bit(false); ++ fdput(f); ++ ++ return retval; ++} ++ ++static long ++tango32_compat_set_robust_list(struct tango32_compat_robust_list __user *argp) ++{ ++ struct tango32_compat_robust_list args; ++ ++ if (copy_from_user(&args, argp, sizeof(args))) ++ return -EFAULT; ++ ++ if (args.len != sizeof(*current->compat_robust_list)) ++ return -EINVAL; ++ ++ current->compat_robust_list = compat_ptr(args.head); ++ ++ return 0; ++} ++ ++static long ++tango32_compat_get_robust_list(struct tango32_compat_robust_list __user *argp) ++{ ++ struct tango32_compat_robust_list out; ++ ++ out.head = ptr_to_compat(current->compat_robust_list); ++ out.len = sizeof(*current->compat_robust_list); ++ ++ if (copy_to_user(argp, &out, sizeof(out))) ++ return -EFAULT; ++ ++ return 0; ++} ++ ++/* Copied from fs/readdir.c */ ++#define unsafe_copy_dirent_name(_dst, _src, _len, label) \ ++ do { \ ++ char __user *dst = (_dst); \ ++ const char *src = (_src); \ ++ size_t len = (_len); \ ++ unsafe_put_user(0, dst + len, label); \ ++ unsafe_copy_to_user(dst, src, len, label); \ ++ } while (0) ++ ++/* Copied from fs/readdir.c */ ++static int verify_dirent_name(const char *name, int len) ++{ ++ if (len <= 0 || len >= PATH_MAX) ++ return -EIO; ++ if (memchr(name, '/', len)) ++ return -EIO; ++ return 0; ++} ++ ++/* Copied from fs/readdir.c */ ++struct getdents_callback64 { ++ struct dir_context ctx; ++ struct linux_dirent64 __user *current_dir; ++ int prev_reclen; ++ int count; ++ int error; ++}; ++ ++/* Copied from fs/readdir.c */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) ++static bool filldir64(struct dir_context *ctx, const char *name, int namlen, ++ loff_t offset, u64 ino, unsigned int d_type) ++{ ++ struct linux_dirent64 __user *dirent, *prev; ++ struct getdents_callback64 *buf = ++ container_of(ctx, struct getdents_callback64, ctx); ++ int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, ++ sizeof(u64)); ++ int prev_reclen; ++ ++ buf->error = verify_dirent_name(name, namlen); ++ if (unlikely(buf->error)) ++ return false; ++ buf->error = -EINVAL; /* only used if we fail.. */ ++ if (reclen > buf->count) ++ return false; ++ prev_reclen = buf->prev_reclen; ++ if (prev_reclen && signal_pending(current)) ++ return false; ++ dirent = buf->current_dir; ++ prev = (void __user *)dirent - prev_reclen; ++ if (!user_write_access_begin(prev, reclen + prev_reclen)) ++ goto efault; ++ ++ /* This might be 'dirent->d_off', but if so it will get overwritten */ ++ unsafe_put_user(offset, &prev->d_off, efault_end); ++ unsafe_put_user(ino, &dirent->d_ino, efault_end); ++ unsafe_put_user(reclen, &dirent->d_reclen, efault_end); ++ unsafe_put_user(d_type, &dirent->d_type, efault_end); ++ unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end); ++ user_write_access_end(); ++ ++ buf->prev_reclen = reclen; ++ buf->current_dir = (void __user *)dirent + reclen; ++ buf->count -= reclen; ++ return true; ++ ++efault_end: ++ user_write_access_end(); ++efault: ++ buf->error = -EFAULT; ++ return false; ++} ++#else ++static int filldir64(struct dir_context *ctx, const char *name, int namlen, ++ loff_t offset, u64 ino, unsigned int d_type) ++{ ++ struct linux_dirent64 __user *dirent, *prev; ++ struct getdents_callback64 *buf = ++ container_of(ctx, struct getdents_callback64, ctx); ++ int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, ++ sizeof(u64)); ++ int prev_reclen; ++ ++ buf->error = verify_dirent_name(name, namlen); ++ if (unlikely(buf->error)) ++ return buf->error; ++ buf->error = -EINVAL; /* only used if we fail.. */ ++ if (reclen > buf->count) ++ return -EINVAL; ++ prev_reclen = buf->prev_reclen; ++ if (prev_reclen && signal_pending(current)) ++ return -EINTR; ++ dirent = buf->current_dir; ++ prev = (void __user *)dirent - prev_reclen; ++ if (!user_write_access_begin(prev, reclen + prev_reclen)) ++ goto efault; ++ ++ /* This might be 'dirent->d_off', but if so it will get overwritten */ ++ unsafe_put_user(offset, &prev->d_off, efault_end); ++ unsafe_put_user(ino, &dirent->d_ino, efault_end); ++ unsafe_put_user(reclen, &dirent->d_reclen, efault_end); ++ unsafe_put_user(d_type, &dirent->d_type, efault_end); ++ unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end); ++ user_write_access_end(); ++ ++ buf->prev_reclen = reclen; ++ buf->current_dir = (void __user *)dirent + reclen; ++ buf->count -= reclen; ++ return 0; ++ ++efault_end: ++ user_write_access_end(); ++efault: ++ buf->error = -EFAULT; ++ return -EFAULT; ++} ++#endif ++ ++static long ++tango32_compat_getdents64(struct tango32_compat_getdents64 __user *argp) ++{ ++ struct tango32_compat_getdents64 args; ++ struct fd f; ++ struct getdents_callback64 buf = {}; ++ int error; ++ ++ if (copy_from_user(&args, argp, sizeof(args))) ++ return -EFAULT; ++ ++ f = my_fdget_pos(args.fd); ++ if (!fd_file(f)) ++ return -EBADF; ++ ++ /* ++ * Pretend to be a 32-bit task for the duration of this syscall. ++ */ ++ set_32bit(true); ++ ++ buf.ctx.actor = filldir64; ++ buf.count = args.count; ++ buf.current_dir = (struct linux_dirent64 __user *)args.dirp; ++ ++ error = iterate_dir(fd_file(f), &buf.ctx); ++ if (error >= 0) ++ error = buf.error; ++ if (buf.prev_reclen) { ++ struct linux_dirent64 __user *lastdirent; ++ typeof(lastdirent->d_off) d_off = buf.ctx.pos; ++ ++ lastdirent = (void __user *)buf.current_dir - buf.prev_reclen; ++ if (put_user(d_off, &lastdirent->d_off)) ++ error = -EFAULT; ++ else ++ error = args.count - buf.count; ++ } ++ ++ set_32bit(false); ++ my_fdput_pos(f); ++ return error; ++} ++ ++static long tango32_compat_lseek(struct tango32_compat_lseek __user *argp) ++{ ++ struct tango32_compat_lseek args; ++ int retval; ++ struct fd f; ++ loff_t offset; ++ ++ if (copy_from_user(&args, argp, sizeof(args))) ++ return -EFAULT; ++ ++ f = my_fdget_pos(args.fd); ++ if (fd_empty(f)) ++ return -EBADF; ++ ++ /* ++ * Pretend to be a 32-bit task for the duration of this syscall. ++ */ ++ set_32bit(true); ++ ++ retval = -EINVAL; ++ if (args.whence > SEEK_MAX) ++ goto out_putf; ++ ++ offset = vfs_llseek(fd_file(f), args.offset, args.whence); ++ ++ retval = (int)offset; ++ if (offset >= 0) { ++ retval = -EFAULT; ++ args.result = offset; ++ if (!copy_to_user(argp, &args, sizeof(args))) ++ retval = 0; ++ } ++ ++out_putf: ++ set_32bit(false); ++ my_fdput_pos(f); ++ return retval; ++} ++ ++static long tango32_ioctl(struct file *filp, unsigned int cmd, ++ unsigned long arg) ++{ ++ void __user *argp = (void __user *)arg; ++ ++ /* ++ * Sanity check: we should only get called from 64-bit processes. ++ */ ++ if (is_32bit()) ++ return -EINVAL; ++ ++ switch (cmd) { ++ case TANGO32_GET_VERSION: ++ return tango32_get_version(argp); ++ case TANGO32_SET_MM: ++ return tango32_set_mm(argp); ++ case TANGO32_SET_MMAP_BASE: ++ return tango32_set_mmap_base(arg); ++ case TANGO32_COMPAT_IOCTL: ++ return tango32_compat_ioctl(argp); ++ case TANGO32_COMPAT_SET_ROBUST_LIST: ++ return tango32_compat_set_robust_list(argp); ++ case TANGO32_COMPAT_GET_ROBUST_LIST: ++ return tango32_compat_get_robust_list(argp); ++ case TANGO32_COMPAT_GETDENTS64: ++ return tango32_compat_getdents64(argp); ++ case TANGO32_COMPAT_LSEEK: ++ return tango32_compat_lseek(argp); ++ } ++ ++ return -ENOIOCTLCMD; ++} ++ ++static const struct file_operations tango32_fops = { ++ .owner = THIS_MODULE, ++ .unlocked_ioctl = tango32_ioctl, ++}; ++ ++static struct miscdevice tango32_device = { ++ .minor = MISC_DYNAMIC_MINOR, ++ .name = "tango32", ++ .fops = &tango32_fops, ++ .mode = 0666, ++}; ++ ++module_misc_device(tango32_device); ++ ++MODULE_DESCRIPTION("32-bit syscall support for the Tango binary translator"); ++MODULE_AUTHOR("Amanieu d'Antras"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/tango32-module/tango32.h b/drivers/tango32-module/tango32.h +new file mode 100644 +index 000000000..74dab1ca2 +--- /dev/null ++++ b/drivers/tango32-module/tango32.h +@@ -0,0 +1,118 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++ ++#ifndef TANGO32_H_ ++#define TANGO32_H_ ++ ++#include ++#include ++ ++#define TANGO32_IOCTL_BASE 't' ++ ++#define TANGO32_ABI_MAJOR 2 ++#define TANGO32_ABI_MINOR 0 ++ ++/* ++ * Returns the ABI version for this module. ++ * ++ * Minor version increments indicate API additions and major version increments ++ * indicate breaking changes. ++ */ ++struct tango32_abi_version { ++ __u16 major; ++ __u16 minor; ++}; ++#define TANGO32_GET_VERSION \ ++ _IOR(TANGO32_IOCTL_BASE, 0xa0, struct tango32_abi_version) ++ ++/* ++ * Sets the given fields in the kernel memory map for the current process. ++ * ++ * This is similar to prctl_mm_map but with 2 differences: ++ * - exe_fd is removed. ++ * - all fields are u64. ++ * ++ * This is primarily provided to support kernels (like Android's) which are ++ * built without CONFIG_CHECKPOINT_RESTORE. ++ */ ++struct tango32_mm { ++ __u64 start_code; ++ __u64 end_code; ++ __u64 start_data; ++ __u64 end_data; ++ __u64 start_brk; ++ __u64 brk; ++ __u64 start_stack; ++ __u64 arg_start; ++ __u64 arg_end; ++ __u64 env_start; ++ __u64 env_end; ++ __u64 auxv; ++ __u64 auxv_size; ++}; ++#define TANGO32_SET_MM _IOW(TANGO32_IOCTL_BASE, 0xa1, struct tango32_mm) ++ ++/* ++ * Sets the mmap_base value for the current process. ++ */ ++#define TANGO32_SET_MMAP_BASE _IO(TANGO32_IOCTL_BASE, 0xa2) ++ ++/* ++ * Executes a compat (32-bit) ioctl on the given file descriptor. ++ * ++ * Note that this does not handle generic file descriptor ioctls that are ++ * normally handled by do_vfs_ioctl(). ++ */ ++struct tango32_compat_ioctl { ++ __u32 fd; ++ __u32 cmd; ++ __u32 arg; ++}; ++#define TANGO32_COMPAT_IOCTL \ ++ _IOW(TANGO32_IOCTL_BASE, 0xa3, struct tango32_compat_ioctl) ++ ++/* ++ * Executes a compat (32-bit) set_robust_list on the current thread. ++ */ ++struct tango32_compat_robust_list { ++ __u32 head; ++ __u32 len; ++}; ++#define TANGO32_COMPAT_SET_ROBUST_LIST \ ++ _IOW(TANGO32_IOCTL_BASE, 0xa4, struct tango32_compat_robust_list) ++ ++/* ++ * Executes a compat (32-bit) get_robust_list on the current thread. ++ */ ++#define TANGO32_COMPAT_GET_ROBUST_LIST \ ++ _IOR(TANGO32_IOCTL_BASE, 0xa5, struct tango32_compat_robust_list) ++ ++/* ++ * Executes a compat (32-bit) getdents64 syscall. ++ * ++ * This has special semantics on ext4 since it returns directory offsets with a ++ * different encoding that fits in 32 bits. ++ */ ++struct tango32_compat_getdents64 { ++ __u32 fd; ++ __u32 count; ++ __u64 dirp; ++}; ++#define TANGO32_COMPAT_GETDENTS64 \ ++ _IOW(TANGO32_IOCTL_BASE, 0xa6, struct tango32_compat_getdents64) ++ ++/* ++ * Executes a compat (32-bit) lseek syscall. ++ * ++ * This has special semantics on ext4 since it operates on directory offsets ++ * with a different encoding that fits in 32 bits. ++ */ ++struct tango32_compat_lseek { ++ __u32 fd; ++ __u32 whence; ++ __u64 offset; ++ __u64 result; ++}; ++#define TANGO32_COMPAT_LSEEK \ ++ _IOWR(TANGO32_IOCTL_BASE, 0xa7, struct tango32_compat_lseek) ++ ++#endif /* TANGO32_H_ */ diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch b/patchForKernel/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch new file mode 100644 index 0000000..29567be --- /dev/null +++ b/patchForKernel/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch @@ -0,0 +1,30 @@ +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index a0bba8e54..ac3a7f4c7 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -1394,6 +1394,22 @@ config ARM64_ILP32 + is an ABI where long and pointers are 32bits but it uses the AARCH64 + instruction set. + ++config KBOX ++ bool "Kernel support for Kbox" ++ select STAGING ++ select ANDROID ++ select ASHMEM ++ select ANDROID_BINDER_IPC ++ select ANDROID_BINDERFS ++ select ANDROID_ALARM ++ select ANON_VMA_NAME ++ select TANGO32 ++ select VFAT_FS ++ select INPUT_UINPUT ++ default y ++ help ++ This option enables kernel support for Kbox and selects dependent kernel options. ++ + menuconfig AARCH32_EL0 + bool "Kernel support for 32-bit EL0" + depends on ARM64_4K_PAGES || EXPERT +-- +2.33.0 + diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch b/patchForKernel/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch new file mode 100644 index 0000000..367c22e --- /dev/null +++ b/patchForKernel/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch @@ -0,0 +1,25 @@ +diff --git a/drivers/Kconfig b/drivers/Kconfig +index 3be1197..1048bd6 100644 +--- a/drivers/Kconfig ++++ b/drivers/Kconfig +@@ -251,4 +251,8 @@ source "drivers/roh/Kconfig" + + source "drivers/coda/Kconfig" + ++if KBOX ++ source "drivers/tango32-module/Kconfig" ++endif ++ + endmenu +diff --git a/drivers/Makefile b/drivers/Makefile +index 3955e60..ef0d5ac 100644 +--- a/drivers/Makefile ++++ b/drivers/Makefile +@@ -195,6 +195,7 @@ obj-$(CONFIG_GNSS) += gnss/ + obj-$(CONFIG_INTERCONNECT) += interconnect/ + obj-$(CONFIG_COUNTER) += counter/ + obj-$(CONFIG_MOST) += most/ ++obj-$(CONFIG_TANGO32) += tango32-module/ + obj-$(CONFIG_PECI) += peci/ + obj-$(CONFIG_HTE) += hte/ + obj-$(CONFIG_DRM_ACCEL) += accel/ diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0009.enable_cgroup.patch b/patchForKernel/kernel_6.6.0-72.0.0/0009.enable_cgroup.patch new file mode 100644 index 0000000..9d2cc3f --- /dev/null +++ b/patchForKernel/kernel_6.6.0-72.0.0/0009.enable_cgroup.patch @@ -0,0 +1,18 @@ +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c +index ece2f4e..921d620 100644 +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -512,9 +512,11 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, + cred = of->file->f_cred; + tcred = get_task_cred(task); + if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) && +- !uid_eq(cred->euid, tcred->uid) && +- !uid_eq(cred->euid, tcred->suid)) ++ !uid_eq(cred->euid, tcred->uid) && ++ !uid_eq(cred->euid, tcred->suid) && ++ !(ns_capable(tcred->user_ns, CAP_SYS_NICE))) { + ret = -EACCES; ++ } + put_cred(tcred); + if (ret) + goto out_finish; diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0010.fix_usermode_memory_layout.patch b/patchForKernel/kernel_6.6.0-72.0.0/0010.fix_usermode_memory_layout.patch new file mode 100644 index 0000000..803b47e --- /dev/null +++ b/patchForKernel/kernel_6.6.0-72.0.0/0010.fix_usermode_memory_layout.patch @@ -0,0 +1,20 @@ +diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h +index f1cfb52ba..c6aff6f44 100644 +--- a/arch/arm64/include/asm/processor.h ++++ b/arch/arm64/include/asm/processor.h +@@ -45,7 +45,12 @@ + * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area. + */ + ++#ifdef CONFIG_KBOX ++#define DEFAULT_MAP_WINDOW_64 (UL(1) << 46) ++#else + #define DEFAULT_MAP_WINDOW_64 (UL(1) << VA_BITS_MIN) ++#endif ++ + #define TASK_SIZE_64 (UL(1) << vabits_actual) + + #ifdef CONFIG_COMPAT +-- +2.33.0 + -- Gitee From 4fa8364058e2189063d63979ca509060eff480b2 Mon Sep 17 00:00:00 2001 From: puhaodong Date: Sat, 11 Oct 2025 14:48:51 +0800 Subject: [PATCH 2/3] kernel patch path modify --- .../kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch | 0 .../kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch | 0 .../kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch | 0 .../kernel_6.6.0-72.0.0/0003.enable_cgroup.patch} | 0 .../kernel_6.6.0-72.0.0/0004.fix_usermode_memory_layout.patch} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename patchForKernel/{ => openEuler_24.03}/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch (100%) rename patchForKernel/{ => openEuler_24.03}/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch (100%) rename patchForKernel/{ => openEuler_24.03}/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch (100%) rename patchForKernel/{kernel_6.6.0-72.0.0/0009.enable_cgroup.patch => openEuler_24.03/kernel_6.6.0-72.0.0/0003.enable_cgroup.patch} (100%) rename patchForKernel/{kernel_6.6.0-72.0.0/0010.fix_usermode_memory_layout.patch => openEuler_24.03/kernel_6.6.0-72.0.0/0004.fix_usermode_memory_layout.patch} (100%) diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch b/patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch similarity index 100% rename from patchForKernel/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch rename to patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0001-exagear-kernel-module.patch diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch b/patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch similarity index 100% rename from patchForKernel/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch rename to patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0001.add_kbox_kernel_config.patch diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch b/patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch similarity index 100% rename from patchForKernel/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch rename to patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0002.include_exagear_kconfig.patch diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0009.enable_cgroup.patch b/patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0003.enable_cgroup.patch similarity index 100% rename from patchForKernel/kernel_6.6.0-72.0.0/0009.enable_cgroup.patch rename to patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0003.enable_cgroup.patch diff --git a/patchForKernel/kernel_6.6.0-72.0.0/0010.fix_usermode_memory_layout.patch b/patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0004.fix_usermode_memory_layout.patch similarity index 100% rename from patchForKernel/kernel_6.6.0-72.0.0/0010.fix_usermode_memory_layout.patch rename to patchForKernel/openEuler_24.03/kernel_6.6.0-72.0.0/0004.fix_usermode_memory_layout.patch -- Gitee From 46c031a904852185228cf5f71c63ba181d5795ce Mon Sep 17 00:00:00 2001 From: puhaodong Date: Sat, 11 Oct 2025 15:46:30 +0800 Subject: [PATCH 3/3] aosp15 modify for kernel 24.03 --- patchForAndroid15/system/core/system-core-0001.patch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/patchForAndroid15/system/core/system-core-0001.patch b/patchForAndroid15/system/core/system-core-0001.patch index 810ce45..f2e82de 100644 --- a/patchForAndroid15/system/core/system-core-0001.patch +++ b/patchForAndroid15/system/core/system-core-0001.patch @@ -581,7 +581,7 @@ index 55bbe46e1..b7288c227 100644 /* diff --git a/rootdir/init.rc b/rootdir/init.rc -index 1acd63774..12d696a6d 100644 +index 1acd63774..48b261e28 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -265,10 +265,10 @@ on init @@ -605,6 +605,15 @@ index 1acd63774..12d696a6d 100644 # Mount default storage into root namespace mount none /mnt/user/0 /storage bind rec +@@ -1095,7 +1094,7 @@ on post-fs-data + # sys.memfd_use set to false by default, which keeps it disabled + # until it is confirmed that apps and vendor processes don't make + # IOCTLs on ashmem fds any more. +- setprop sys.use_memfd false ++ setprop sys.use_memfd true + + # Set fscklog permission + chown root system /dev/fscklogs/log diff --git a/rootdir/init.usb.rc b/rootdir/init.usb.rc index b30d6d02c..4dd943149 100644 --- a/rootdir/init.usb.rc -- Gitee