diff options
9 files changed, 459 insertions, 0 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 8592de5a66..e359da3cd0 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc | |||
| @@ -466,6 +466,7 @@ RECIPE_MAINTAINER:pn-ltp = "Yi Zhao <yi.zhao@windriver.com>" | |||
| 466 | RECIPE_MAINTAINER:pn-lttng-modules = "Richard Purdie <richard.purdie@linuxfoundation.org>" | 466 | RECIPE_MAINTAINER:pn-lttng-modules = "Richard Purdie <richard.purdie@linuxfoundation.org>" |
| 467 | RECIPE_MAINTAINER:pn-lttng-tools = "Richard Purdie <richard.purdie@linuxfoundation.org>" | 467 | RECIPE_MAINTAINER:pn-lttng-tools = "Richard Purdie <richard.purdie@linuxfoundation.org>" |
| 468 | RECIPE_MAINTAINER:pn-lttng-ust = "Richard Purdie <richard.purdie@linuxfoundation.org>" | 468 | RECIPE_MAINTAINER:pn-lttng-ust = "Richard Purdie <richard.purdie@linuxfoundation.org>" |
| 469 | RECIPE_MAINTAINER:pn-lua = "Alexander Kanavin <alex.kanavin@gmail.com>" | ||
| 469 | RECIPE_MAINTAINER:pn-lz4 = "Denys Dmytriyenko <denis@denix.org>" | 470 | RECIPE_MAINTAINER:pn-lz4 = "Denys Dmytriyenko <denis@denix.org>" |
| 470 | RECIPE_MAINTAINER:pn-lzo = "Denys Dmytriyenko <denis@denix.org>" | 471 | RECIPE_MAINTAINER:pn-lzo = "Denys Dmytriyenko <denis@denix.org>" |
| 471 | RECIPE_MAINTAINER:pn-lzip = "Denys Dmytriyenko <denis@denix.org>" | 472 | RECIPE_MAINTAINER:pn-lzip = "Denys Dmytriyenko <denis@denix.org>" |
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc index e0ae1dd971..3709998f29 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc | |||
| @@ -40,6 +40,7 @@ PTESTS_FAST = "\ | |||
| 40 | libxml-sax-base-perl-ptest \ | 40 | libxml-sax-base-perl-ptest \ |
| 41 | libxml-simple-perl-ptest \ | 41 | libxml-simple-perl-ptest \ |
| 42 | libxml2-ptest \ | 42 | libxml2-ptest \ |
| 43 | lua-ptest \ | ||
| 43 | lzo-ptest \ | 44 | lzo-ptest \ |
| 44 | m4-ptest \ | 45 | m4-ptest \ |
| 45 | nettle-ptest \ | 46 | nettle-ptest \ |
diff --git a/meta/recipes-devtools/lua/lua/0001-Allow-building-lua-without-readline-on-Linux.patch b/meta/recipes-devtools/lua/lua/0001-Allow-building-lua-without-readline-on-Linux.patch new file mode 100644 index 0000000000..e767900864 --- /dev/null +++ b/meta/recipes-devtools/lua/lua/0001-Allow-building-lua-without-readline-on-Linux.patch | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | From 601ef636fc4dfb2af3e7fda88d8ea1c1d92affe4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
| 3 | Date: Wed, 2 Oct 2019 17:54:15 +0200 | ||
| 4 | Subject: [PATCH] Allow building lua without readline on Linux | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
| 8 | --- | ||
| 9 | Makefile | 2 +- | ||
| 10 | src/Makefile | 3 +++ | ||
| 11 | src/luaconf.h | 5 +++++ | ||
| 12 | 3 files changed, 9 insertions(+), 1 deletion(-) | ||
| 13 | |||
| 14 | diff --git a/Makefile b/Makefile | ||
| 15 | index 119110d..9f6df45 100644 | ||
| 16 | --- a/Makefile | ||
| 17 | +++ b/Makefile | ||
| 18 | @@ -36,7 +36,7 @@ RM= rm -f | ||
| 19 | # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= | ||
| 20 | |||
| 21 | # Convenience platforms targets. | ||
| 22 | -PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris | ||
| 23 | +PLATS= aix bsd c89 freebsd generic linux linux-no-readline macosx mingw posix solaris | ||
| 24 | |||
| 25 | # What to install. | ||
| 26 | TO_BIN= lua luac | ||
| 27 | diff --git a/src/Makefile b/src/Makefile | ||
| 28 | index 64c78f7..5c0428a 100644 | ||
| 29 | --- a/src/Makefile | ||
| 30 | +++ b/src/Makefile | ||
| 31 | @@ -109,6 +109,9 @@ generic: $(ALL) | ||
| 32 | linux: | ||
| 33 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" | ||
| 34 | |||
| 35 | +linux-no-readline: | ||
| 36 | + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX_NO_READLINE" SYSLIBS="-Wl,-E -ldl" | ||
| 37 | + | ||
| 38 | macosx: | ||
| 39 | $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" | ||
| 40 | |||
| 41 | diff --git a/src/luaconf.h b/src/luaconf.h | ||
| 42 | index 9eeeea6..d71ca25 100644 | ||
| 43 | --- a/src/luaconf.h | ||
| 44 | +++ b/src/luaconf.h | ||
| 45 | @@ -64,6 +64,11 @@ | ||
| 46 | #define LUA_USE_READLINE /* needs some extra libraries */ | ||
| 47 | #endif | ||
| 48 | |||
| 49 | +#if defined(LUA_USE_LINUX_NO_READLINE) | ||
| 50 | +#define LUA_USE_POSIX | ||
| 51 | +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ | ||
| 52 | +#endif | ||
| 53 | + | ||
| 54 | |||
| 55 | #if defined(LUA_USE_MACOSX) | ||
| 56 | #define LUA_USE_POSIX | ||
| 57 | -- | ||
| 58 | 2.17.1 | ||
| 59 | |||
diff --git a/meta/recipes-devtools/lua/lua/0001-Fixed-bug-barriers-cannot-be-active-during-sweep.patch b/meta/recipes-devtools/lua/lua/0001-Fixed-bug-barriers-cannot-be-active-during-sweep.patch new file mode 100644 index 0000000000..a302874d76 --- /dev/null +++ b/meta/recipes-devtools/lua/lua/0001-Fixed-bug-barriers-cannot-be-active-during-sweep.patch | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | From 1e6df25ac28dcd89f0324177bb55019422404b44 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> | ||
| 3 | Date: Thu, 3 Sep 2020 15:32:17 +0800 | ||
| 4 | Subject: [PATCH] Fixed bug: barriers cannot be active during sweep | ||
| 5 | |||
| 6 | Barriers cannot be active during sweep, even in generational mode. | ||
| 7 | (Although gen. mode is not incremental, it can hit a barrier when | ||
| 8 | deleting a thread and closing its upvalues.) The colors of objects are | ||
| 9 | being changed during sweep and, therefore, cannot be trusted. | ||
| 10 | |||
| 11 | Upstream-Status: Backport [https://github.com/lua/lua/commit/a6da1472c0c5e05ff249325f979531ad51533110] | ||
| 12 | CVE: CVE-2020-24371 | ||
| 13 | |||
| 14 | [Adjust code KGC_INC -> KGC_NORMAL, refer 69371c4b84becac09c445aae01d005b49658ef82] | ||
| 15 | Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> | ||
| 16 | --- | ||
| 17 | src/lgc.c | 33 ++++++++++++++++++++++++--------- | ||
| 18 | 1 file changed, 24 insertions(+), 9 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/src/lgc.c b/src/lgc.c | ||
| 21 | index 973c269..7af23d5 100644 | ||
| 22 | --- a/src/lgc.c | ||
| 23 | +++ b/src/lgc.c | ||
| 24 | @@ -142,10 +142,17 @@ static int iscleared (global_State *g, const TValue *o) { | ||
| 25 | |||
| 26 | |||
| 27 | /* | ||
| 28 | -** barrier that moves collector forward, that is, mark the white object | ||
| 29 | -** being pointed by a black object. (If in sweep phase, clear the black | ||
| 30 | -** object to white [sweep it] to avoid other barrier calls for this | ||
| 31 | -** same object.) | ||
| 32 | +** Barrier that moves collector forward, that is, marks the white object | ||
| 33 | +** 'v' being pointed by the black object 'o'. In the generational | ||
| 34 | +** mode, 'v' must also become old, if 'o' is old; however, it cannot | ||
| 35 | +** be changed directly to OLD, because it may still point to non-old | ||
| 36 | +** objects. So, it is marked as OLD0. In the next cycle it will become | ||
| 37 | +** OLD1, and in the next it will finally become OLD (regular old). By | ||
| 38 | +** then, any object it points to will also be old. If called in the | ||
| 39 | +** incremental sweep phase, it clears the black object to white (sweep | ||
| 40 | +** it) to avoid other barrier calls for this same object. (That cannot | ||
| 41 | +** be done is generational mode, as its sweep does not distinguish | ||
| 42 | +** whites from deads.) | ||
| 43 | */ | ||
| 44 | void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { | ||
| 45 | global_State *g = G(L); | ||
| 46 | @@ -154,7 +161,8 @@ void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { | ||
| 47 | reallymarkobject(g, v); /* restore invariant */ | ||
| 48 | else { /* sweep phase */ | ||
| 49 | lua_assert(issweepphase(g)); | ||
| 50 | - makewhite(g, o); /* mark main obj. as white to avoid other barriers */ | ||
| 51 | + if (g->gckind == KGC_NORMAL) /* incremental mode? */ | ||
| 52 | + makewhite(g, o); /* mark 'o' as white to avoid other barriers */ | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | @@ -299,10 +307,15 @@ static void markbeingfnz (global_State *g) { | ||
| 57 | |||
| 58 | |||
| 59 | /* | ||
| 60 | -** Mark all values stored in marked open upvalues from non-marked threads. | ||
| 61 | -** (Values from marked threads were already marked when traversing the | ||
| 62 | -** thread.) Remove from the list threads that no longer have upvalues and | ||
| 63 | -** not-marked threads. | ||
| 64 | +** For each non-marked thread, simulates a barrier between each open | ||
| 65 | +** upvalue and its value. (If the thread is collected, the value will be | ||
| 66 | +** assigned to the upvalue, but then it can be too late for the barrier | ||
| 67 | +** to act. The "barrier" does not need to check colors: A non-marked | ||
| 68 | +** thread must be young; upvalues cannot be older than their threads; so | ||
| 69 | +** any visited upvalue must be young too.) Also removes the thread from | ||
| 70 | +** the list, as it was already visited. Removes also threads with no | ||
| 71 | +** upvalues, as they have nothing to be checked. (If the thread gets an | ||
| 72 | +** upvalue later, it will be linked in the list again.) | ||
| 73 | */ | ||
| 74 | static void remarkupvals (global_State *g) { | ||
| 75 | lua_State *thread; | ||
| 76 | @@ -313,9 +326,11 @@ static void remarkupvals (global_State *g) { | ||
| 77 | p = &thread->twups; /* keep marked thread with upvalues in the list */ | ||
| 78 | else { /* thread is not marked or without upvalues */ | ||
| 79 | UpVal *uv; | ||
| 80 | + lua_assert(!isold(thread) || thread->openupval == NULL); | ||
| 81 | *p = thread->twups; /* remove thread from the list */ | ||
| 82 | thread->twups = thread; /* mark that it is out of list */ | ||
| 83 | for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) { | ||
| 84 | + lua_assert(getage(uv) <= getage(thread)); | ||
| 85 | if (uv->u.open.touched) { | ||
| 86 | markvalue(g, uv->v); /* remark upvalue's value */ | ||
| 87 | uv->u.open.touched = 0; | ||
| 88 | -- | ||
| 89 | 1.9.1 | ||
| 90 | |||
diff --git a/meta/recipes-devtools/lua/lua/CVE-2020-15888.patch b/meta/recipes-devtools/lua/lua/CVE-2020-15888.patch new file mode 100644 index 0000000000..60a4125971 --- /dev/null +++ b/meta/recipes-devtools/lua/lua/CVE-2020-15888.patch | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | From 6298903e35217ab69c279056f925fb72900ce0b7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> | ||
| 3 | Date: Mon, 6 Jul 2020 12:11:54 -0300 | ||
| 4 | Subject: [PATCH] Keep minimum size when shrinking a stack | ||
| 5 | |||
| 6 | When shrinking a stack (during GC), do not make it smaller than the | ||
| 7 | initial stack size. | ||
| 8 | --- | ||
| 9 | ldo.c | 5 ++--- | ||
| 10 | 1 file changed, 2 insertions(+), 3 deletions(-) | ||
| 11 | ==== end of original header ==== | ||
| 12 | |||
| 13 | CVE: CVE-2020-15888 | ||
| 14 | |||
| 15 | Upstream-Status: backport [https://github.com/lua/lua.git] | ||
| 16 | |||
| 17 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 18 | |||
| 19 | ==== | ||
| 20 | diff --git a/ldo.c b/ldo.c | ||
| 21 | index c563b1d9..a89ac010 100644 | ||
| 22 | --- a/src/ldo.c | ||
| 23 | +++ b/src/ldo.c | ||
| 24 | @@ -220,7 +220,7 @@ static int stackinuse (lua_State *L) { | ||
| 25 | |||
| 26 | void luaD_shrinkstack (lua_State *L) { | ||
| 27 | int inuse = stackinuse(L); | ||
| 28 | - int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; | ||
| 29 | + int goodsize = inuse + BASIC_STACK_SIZE; | ||
| 30 | if (goodsize > LUAI_MAXSTACK) | ||
| 31 | goodsize = LUAI_MAXSTACK; /* respect stack limit */ | ||
| 32 | if (L->stacksize > LUAI_MAXSTACK) /* had been handling stack overflow? */ | ||
| 33 | @@ -229,8 +229,7 @@ void luaD_shrinkstack (lua_State *L) { | ||
| 34 | luaE_shrinkCI(L); /* shrink list */ | ||
| 35 | /* if thread is currently not handling a stack overflow and its | ||
| 36 | good size is smaller than current size, shrink its stack */ | ||
| 37 | - if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && | ||
| 38 | - goodsize < L->stacksize) | ||
| 39 | + if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && goodsize < L->stacksize) | ||
| 40 | luaD_reallocstack(L, goodsize); | ||
| 41 | else /* don't change stack */ | ||
| 42 | condmovestack(L,{},{}); /* (change only for debugging) */ | ||
| 43 | -- | ||
| 44 | 2.17.1 | ||
| 45 | |||
diff --git a/meta/recipes-devtools/lua/lua/CVE-2020-15945.patch b/meta/recipes-devtools/lua/lua/CVE-2020-15945.patch new file mode 100644 index 0000000000..89ce491487 --- /dev/null +++ b/meta/recipes-devtools/lua/lua/CVE-2020-15945.patch | |||
| @@ -0,0 +1,167 @@ | |||
| 1 | From d8d344365945a534f700c82c5dd26f704f89fef3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> | ||
| 3 | Date: Wed, 5 Aug 2020 16:59:58 +0800 | ||
| 4 | Subject: [PATCH] Fixed bug: invalid 'oldpc' when returning to a function | ||
| 5 | |||
| 6 | The field 'L->oldpc' is not always updated when control returns to a | ||
| 7 | function; an invalid value can seg. fault when computing 'changedline'. | ||
| 8 | (One example is an error in a finalizer; control can return to | ||
| 9 | 'luaV_execute' without executing 'luaD_poscall'.) Instead of trying to | ||
| 10 | fix all possible corner cases, it seems safer to be resilient to invalid | ||
| 11 | values for 'oldpc'. Valid but wrong values at most cause an extra call | ||
| 12 | to a line hook. | ||
| 13 | |||
| 14 | CVE: CVE-2020-15945 | ||
| 15 | |||
| 16 | [Adjust the code to be applicable to the tree] | ||
| 17 | |||
| 18 | Upstream-Status: Backport [https://github.com/lua/lua/commit/a2195644d89812e5b157ce7bac35543e06db05e3] | ||
| 19 | |||
| 20 | Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> | ||
| 21 | Signed-off-by: Joe Slater <joe.slater@@windriver.com> | ||
| 22 | |||
| 23 | --- | ||
| 24 | src/ldebug.c | 30 +++++++++++++++--------------- | ||
| 25 | src/ldebug.h | 4 ++++ | ||
| 26 | src/ldo.c | 2 +- | ||
| 27 | src/lstate.c | 1 + | ||
| 28 | src/lstate.h | 2 +- | ||
| 29 | 5 files changed, 22 insertions(+), 17 deletions(-) | ||
| 30 | |||
| 31 | diff --git a/src/ldebug.c b/src/ldebug.c | ||
| 32 | index 239affb..832b16c 100644 | ||
| 33 | --- a/src/ldebug.c | ||
| 34 | +++ b/src/ldebug.c | ||
| 35 | @@ -34,9 +34,8 @@ | ||
| 36 | #define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL) | ||
| 37 | |||
| 38 | |||
| 39 | -/* Active Lua function (given call info) */ | ||
| 40 | -#define ci_func(ci) (clLvalue((ci)->func)) | ||
| 41 | - | ||
| 42 | +/* inverse of 'pcRel' */ | ||
| 43 | +#define invpcRel(pc, p) ((p)->code + (pc) + 1) | ||
| 44 | |||
| 45 | static const char *funcnamefromcode (lua_State *L, CallInfo *ci, | ||
| 46 | const char **name); | ||
| 47 | @@ -71,20 +70,18 @@ static void swapextra (lua_State *L) { | ||
| 48 | |||
| 49 | /* | ||
| 50 | ** This function can be called asynchronously (e.g. during a signal). | ||
| 51 | -** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by | ||
| 52 | -** 'resethookcount') are for debug only, and it is no problem if they | ||
| 53 | -** get arbitrary values (causes at most one wrong hook call). 'hookmask' | ||
| 54 | -** is an atomic value. We assume that pointers are atomic too (e.g., gcc | ||
| 55 | -** ensures that for all platforms where it runs). Moreover, 'hook' is | ||
| 56 | -** always checked before being called (see 'luaD_hook'). | ||
| 57 | +** Fields 'basehookcount' and 'hookcount' (set by 'resethookcount') | ||
| 58 | +** are for debug only, and it is no problem if they get arbitrary | ||
| 59 | +** values (causes at most one wrong hook call). 'hookmask' is an atomic | ||
| 60 | +** value. We assume that pointers are atomic too (e.g., gcc ensures that | ||
| 61 | +** for all platforms where it runs). Moreover, 'hook' is always checked | ||
| 62 | +** before being called (see 'luaD_hook'). | ||
| 63 | */ | ||
| 64 | LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { | ||
| 65 | if (func == NULL || mask == 0) { /* turn off hooks? */ | ||
| 66 | mask = 0; | ||
| 67 | func = NULL; | ||
| 68 | } | ||
| 69 | - if (isLua(L->ci)) | ||
| 70 | - L->oldpc = L->ci->u.l.savedpc; | ||
| 71 | L->hook = func; | ||
| 72 | L->basehookcount = count; | ||
| 73 | resethookcount(L); | ||
| 74 | @@ -665,7 +662,10 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { | ||
| 75 | void luaG_traceexec (lua_State *L) { | ||
| 76 | CallInfo *ci = L->ci; | ||
| 77 | lu_byte mask = L->hookmask; | ||
| 78 | + const Proto *p = ci_func(ci)->p; | ||
| 79 | int counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT)); | ||
| 80 | + /* 'L->oldpc' may be invalid; reset it in this case */ | ||
| 81 | + int oldpc = (L->oldpc < p->sizecode) ? L->oldpc : 0; | ||
| 82 | if (counthook) | ||
| 83 | resethookcount(L); /* reset count */ | ||
| 84 | else if (!(mask & LUA_MASKLINE)) | ||
| 85 | @@ -677,15 +677,15 @@ void luaG_traceexec (lua_State *L) { | ||
| 86 | if (counthook) | ||
| 87 | luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */ | ||
| 88 | if (mask & LUA_MASKLINE) { | ||
| 89 | - Proto *p = ci_func(ci)->p; | ||
| 90 | int npc = pcRel(ci->u.l.savedpc, p); | ||
| 91 | int newline = getfuncline(p, npc); | ||
| 92 | if (npc == 0 || /* call linehook when enter a new function, */ | ||
| 93 | - ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ | ||
| 94 | - newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ | ||
| 95 | + ci->u.l.savedpc <= invpcRel(oldpc, p) || /* when jump back (loop), or when */ | ||
| 96 | + newline != getfuncline(p, oldpc)) /* enter a new line */ | ||
| 97 | luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */ | ||
| 98 | + | ||
| 99 | + L->oldpc = npc; /* 'pc' of last call to line hook */ | ||
| 100 | } | ||
| 101 | - L->oldpc = ci->u.l.savedpc; | ||
| 102 | if (L->status == LUA_YIELD) { /* did hook yield? */ | ||
| 103 | if (counthook) | ||
| 104 | L->hookcount = 1; /* undo decrement to zero */ | ||
| 105 | diff --git a/src/ldebug.h b/src/ldebug.h | ||
| 106 | index 0e31546..c224cc4 100644 | ||
| 107 | --- a/src/ldebug.h | ||
| 108 | +++ b/src/ldebug.h | ||
| 109 | @@ -13,6 +13,10 @@ | ||
| 110 | |||
| 111 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) | ||
| 112 | |||
| 113 | +/* Active Lua function (given call info) */ | ||
| 114 | +#define ci_func(ci) (clLvalue((ci)->func)) | ||
| 115 | + | ||
| 116 | + | ||
| 117 | #define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) | ||
| 118 | |||
| 119 | #define resethookcount(L) (L->hookcount = L->basehookcount) | ||
| 120 | diff --git a/src/ldo.c b/src/ldo.c | ||
| 121 | index 90b695f..f66ac1a 100644 | ||
| 122 | --- a/src/ldo.c | ||
| 123 | +++ b/src/ldo.c | ||
| 124 | @@ -382,7 +382,7 @@ int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) { | ||
| 125 | luaD_hook(L, LUA_HOOKRET, -1); | ||
| 126 | firstResult = restorestack(L, fr); | ||
| 127 | } | ||
| 128 | - L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ | ||
| 129 | + L->oldpc = pcRel(ci->u.l.savedpc, ci_func(ci)->p); /* 'oldpc' for caller function */ | ||
| 130 | } | ||
| 131 | res = ci->func; /* res == final position of 1st result */ | ||
| 132 | L->ci = ci->previous; /* back to caller */ | ||
| 133 | diff --git a/src/lstate.c b/src/lstate.c | ||
| 134 | index 9194ac3..3573e36 100644 | ||
| 135 | --- a/src/lstate.c | ||
| 136 | +++ b/src/lstate.c | ||
| 137 | @@ -236,6 +236,7 @@ static void preinit_thread (lua_State *L, global_State *g) { | ||
| 138 | L->nny = 1; | ||
| 139 | L->status = LUA_OK; | ||
| 140 | L->errfunc = 0; | ||
| 141 | + L->oldpc = 0; | ||
| 142 | } | ||
| 143 | |||
| 144 | |||
| 145 | diff --git a/src/lstate.h b/src/lstate.h | ||
| 146 | index a469466..d75eadf 100644 | ||
| 147 | --- a/src/lstate.h | ||
| 148 | +++ b/src/lstate.h | ||
| 149 | @@ -164,7 +164,6 @@ struct lua_State { | ||
| 150 | StkId top; /* first free slot in the stack */ | ||
| 151 | global_State *l_G; | ||
| 152 | CallInfo *ci; /* call info for current function */ | ||
| 153 | - const Instruction *oldpc; /* last pc traced */ | ||
| 154 | StkId stack_last; /* last free slot in the stack */ | ||
| 155 | StkId stack; /* stack base */ | ||
| 156 | UpVal *openupval; /* list of open upvalues in this stack */ | ||
| 157 | @@ -174,6 +173,7 @@ struct lua_State { | ||
| 158 | CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ | ||
| 159 | volatile lua_Hook hook; | ||
| 160 | ptrdiff_t errfunc; /* current error handling function (stack index) */ | ||
| 161 | + int oldpc; /* last pc traced */ | ||
| 162 | int stacksize; | ||
| 163 | int basehookcount; | ||
| 164 | int hookcount; | ||
| 165 | -- | ||
| 166 | 2.13.3 | ||
| 167 | |||
diff --git a/meta/recipes-devtools/lua/lua/lua.pc.in b/meta/recipes-devtools/lua/lua/lua.pc.in new file mode 100644 index 0000000000..c27e86e85d --- /dev/null +++ b/meta/recipes-devtools/lua/lua/lua.pc.in | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | prefix=/usr | ||
| 2 | libdir=${prefix}/lib | ||
| 3 | includedir=${prefix}/include | ||
| 4 | |||
| 5 | Name: Lua | ||
| 6 | Description: Lua language engine | ||
| 7 | Version: @VERSION@ | ||
| 8 | Requires: | ||
| 9 | Libs: -L${libdir} -llua -lm -ldl | ||
| 10 | Cflags: -I${includedir} | ||
diff --git a/meta/recipes-devtools/lua/lua/run-ptest b/meta/recipes-devtools/lua/lua/run-ptest new file mode 100644 index 0000000000..8e085e1af9 --- /dev/null +++ b/meta/recipes-devtools/lua/lua/run-ptest | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | cd test | ||
| 4 | lua -e"_U=true" all.lua > lua-test.tmp | ||
| 5 | |||
| 6 | echo "--- test output ---" | ||
| 7 | cat lua-test.tmp | ||
| 8 | echo "" | ||
| 9 | echo "" | ||
| 10 | echo "--- ptest result ---" | ||
| 11 | |||
| 12 | grep "final OK \!\!\!" lua-test.tmp > /dev/null | ||
| 13 | if [ $? -eq 0 ]; then | ||
| 14 | echo "PASS: lua" | ||
| 15 | else | ||
| 16 | echo "FAIL: lua" | ||
| 17 | fi | ||
| 18 | |||
| 19 | rm -f lua-test.tmp | ||
diff --git a/meta/recipes-devtools/lua/lua_5.3.6.bb b/meta/recipes-devtools/lua/lua_5.3.6.bb new file mode 100644 index 0000000000..f830e09259 --- /dev/null +++ b/meta/recipes-devtools/lua/lua_5.3.6.bb | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | DESCRIPTION = "Lua is a powerful light-weight programming language designed \ | ||
| 2 | for extending applications." | ||
| 3 | LICENSE = "MIT" | ||
| 4 | LIC_FILES_CHKSUM = "file://doc/readme.html;beginline=318;endline=352;md5=f43d8ee6bc4df18ef8b276439cc4a153" | ||
| 5 | HOMEPAGE = "http://www.lua.org/" | ||
| 6 | |||
| 7 | SRC_URI = "http://www.lua.org/ftp/lua-${PV}.tar.gz;name=tarballsrc \ | ||
| 8 | file://lua.pc.in \ | ||
| 9 | file://0001-Allow-building-lua-without-readline-on-Linux.patch \ | ||
| 10 | file://CVE-2020-15888.patch \ | ||
| 11 | file://CVE-2020-15945.patch \ | ||
| 12 | file://0001-Fixed-bug-barriers-cannot-be-active-during-sweep.patch \ | ||
| 13 | " | ||
| 14 | |||
| 15 | # if no test suite matches PV release of Lua exactly, download the suite for the closest Lua release. | ||
| 16 | PV_testsuites = "5.3.4" | ||
| 17 | |||
| 18 | SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', \ | ||
| 19 | 'http://www.lua.org/tests/lua-${PV_testsuites}-tests.tar.gz;name=tarballtest \ | ||
| 20 | file://run-ptest \ | ||
| 21 | ', '', d)}" | ||
| 22 | |||
| 23 | SRC_URI[tarballsrc.md5sum] = "83f23dbd5230140a3770d5f54076948d" | ||
| 24 | SRC_URI[tarballsrc.sha256sum] = "fc5fd69bb8736323f026672b1b7235da613d7177e72558893a0bdcd320466d60" | ||
| 25 | SRC_URI[tarballtest.md5sum] = "b14fe3748c1cb2d74e3acd1943629ba3" | ||
| 26 | SRC_URI[tarballtest.sha256sum] = "b80771238271c72565e5a1183292ef31bd7166414cd0d43a8eb79845fa7f599f" | ||
| 27 | |||
| 28 | inherit pkgconfig binconfig ptest | ||
| 29 | |||
| 30 | PACKAGECONFIG ??= "readline" | ||
| 31 | PACKAGECONFIG[readline] = ",,readline" | ||
| 32 | |||
| 33 | TARGET_CC_ARCH += " -fPIC ${LDFLAGS}" | ||
| 34 | EXTRA_OEMAKE = "'CC=${CC} -fPIC' 'MYCFLAGS=${CFLAGS} -fPIC' MYLDFLAGS='${LDFLAGS}'" | ||
| 35 | |||
| 36 | do_configure:prepend() { | ||
| 37 | sed -i -e s:/usr/local:${prefix}:g src/luaconf.h | ||
| 38 | sed -i -e s:lib/lua/:${baselib}/lua/:g src/luaconf.h | ||
| 39 | } | ||
| 40 | |||
| 41 | do_compile () { | ||
| 42 | oe_runmake ${@bb.utils.contains('PACKAGECONFIG', 'readline', 'linux', 'linux-no-readline', d)} | ||
| 43 | } | ||
| 44 | |||
| 45 | do_install () { | ||
| 46 | oe_runmake \ | ||
| 47 | 'INSTALL_TOP=${D}${prefix}' \ | ||
| 48 | 'INSTALL_BIN=${D}${bindir}' \ | ||
| 49 | 'INSTALL_INC=${D}${includedir}/' \ | ||
| 50 | 'INSTALL_MAN=${D}${mandir}/man1' \ | ||
| 51 | 'INSTALL_SHARE=${D}${datadir}/lua' \ | ||
| 52 | 'INSTALL_LIB=${D}${libdir}' \ | ||
| 53 | 'INSTALL_CMOD=${D}${libdir}/lua/5.3' \ | ||
| 54 | install | ||
| 55 | install -d ${D}${libdir}/pkgconfig | ||
| 56 | |||
| 57 | sed -e s/@VERSION@/${PV}/ ${WORKDIR}/lua.pc.in > ${WORKDIR}/lua.pc | ||
| 58 | install -m 0644 ${WORKDIR}/lua.pc ${D}${libdir}/pkgconfig/ | ||
| 59 | rmdir ${D}${datadir}/lua/5.3 | ||
| 60 | rmdir ${D}${datadir}/lua | ||
| 61 | } | ||
| 62 | |||
| 63 | do_install_ptest () { | ||
| 64 | cp -R --no-dereference --preserve=mode,links -v ${WORKDIR}/lua-${PV_testsuites}-tests ${D}${PTEST_PATH}/test | ||
| 65 | } | ||
| 66 | |||
| 67 | BBCLASSEXTEND = "native nativesdk" | ||
