Date   

[meta-oe] [PATCH] gsl: upgrade 2.7 -> 2.7.1

wangmy
 

Changes:
update libtool version numbers

Signed-off-by: Wang Mingyu <wangmy@...>
---
meta-oe/recipes-support/gsl/gsl_2.7.1.bb | 4 ++++
meta-oe/recipes-support/gsl/gsl_2.7.bb | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
create mode 100644 meta-oe/recipes-support/gsl/gsl_2.7.1.bb
delete mode 100644 meta-oe/recipes-support/gsl/gsl_2.7.bb

diff --git a/meta-oe/recipes-support/gsl/gsl_2.7.1.bb b/meta-oe/recipes-support/gsl/gsl_2.7.1.bb
new file mode 100644
index 0000000000..a4dc1437e2
--- /dev/null
+++ b/meta-oe/recipes-support/gsl/gsl_2.7.1.bb
@@ -0,0 +1,4 @@
+include gsl.inc
+
+SRC_URI = "${GNU_MIRROR}/gsl/gsl-${PV}.tar.gz"
+SRC_URI[sha256sum] = "dcb0fbd43048832b757ff9942691a8dd70026d5da0ff85601e52687f6deeb34b"
diff --git a/meta-oe/recipes-support/gsl/gsl_2.7.bb b/meta-oe/recipes-support/gsl/gsl_2.7.bb
deleted file mode 100644
index d40eebb4ca..0000000000
--- a/meta-oe/recipes-support/gsl/gsl_2.7.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-include gsl.inc
-
-SRC_URI = "${GNU_MIRROR}/gsl/gsl-${PV}.tar.gz"
-SRC_URI[sha256sum] = "efbbf3785da0e53038be7907500628b466152dbc3c173a87de1b5eba2e23602b"
--
2.25.1


Re: [PATCH 1/1] buildstats: disk usage outside bbclass

Uladzimir Bely <ubely@...>
 

In mail from воскресенье, 5 декабря 2021 г. 01:30:54 +03 user Peter
Kjellerstedt wrote:

-----Original Message-----
From: openembedded-devel@... <openembedded-
devel@...> On Behalf Of Uladzimir Bely
Sent: den 4 december 2021 07:33
To: openembedded-devel@...
Subject: [oe] [PATCH 1/1] buildstats: disk usage outside bbclass

This allows to use a custom disk stats command
without modifying buildstats.bbclass.
---

meta/classes/buildstats-utils.bbclass | 4 ++++
meta/classes/buildstats.bbclass | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
create mode 100644 meta/classes/buildstats-utils.bbclass

diff --git a/meta/classes/buildstats-utils.bbclass
b/meta/classes/buildstats-utils.bbclass
new file mode 100644
index 00000000..712674d0
--- /dev/null
+++ b/meta/classes/buildstats-utils.bbclass
@@ -0,0 +1,4 @@
+def buildstats_disk_usage(path):
+ import subprocess
+ return subprocess.check_output(["du", "-shx", path],
+ stderr=subprocess.STDOUT).decode('utf-8')
diff --git a/meta/classes/buildstats.bbclass
b/meta/classes/buildstats.bbclass index 0de60520..1cade568 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -8,6 +8,8 @@ BUILDSTATS_BASE = "${TMPDIR}/buildstats/"

#

##########################################################################
######

+inherit buildstats-utils
+

def get_buildprocess_cputime(pid):
with open("/proc/%d/stat" % pid, "r") as f:
fields = f.readline().rstrip().split()

@@ -244,8 +246,7 @@ python run_buildstats () {

rootfs = d.getVar('IMAGE_ROOTFS')

if os.path.isdir(rootfs):
try:
- rootfs_size = subprocess.check_output(["du",
"-sh", rootfs], -
stderr=subprocess.STDOUT).decode('utf-8') +
rootfs_size = buildstats_disk_usage(rootfs)
A simpler solution is to introduce a bitbake variable for the "du -sh"
command. Then you can just override it with your command as you please.
I.e., add:

BUILDSTATS_DISK_USAGE ??= "du -sh"

after BUILDSTATS_BASE at the top of the file and change the above to:

rootfs_size = subprocess.check_output(
d.getVar('BUILDSTATS_DISK_USAGE').split() +
[rootfs], stderr=subprocess.STDOUT).decode('utf-8')
f.write("Uncompressed Rootfs size: %s" %
rootfs_size)

except subprocess.CalledProcessError as err:
bb.warn("Failed to get rootfs size: %s" %
err.output.decode('utf-8'))

--
2.20.1
//Peter
Thanks, the idea of using a variable is really simpler.

I've prepared a corresponding patch for a maillist:
https://lists.openembedded.org/g/openembedded-devel/message/94215
I hope, it's good enough to be applied to oe-core upstream soon.

--
Uladzimir Bely
Promwad Ltd.
External service provider of ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn, Germany
+49 (89) 122 67 24-0
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov


[meta-oe][PATCH] buildstats: support of custom disk usage command

Uladzimir Bely <ubely@...>
 

This helps to make buildstats code usage easier in third-party
projects like Isar (https://github.com/ilbers/isar/). In Isar
rootfs is created using 'sudo' and some subpaths like '/proc'
may be mounted. So, "du -sh" on rootfs produces multiple
'Permission denied' warnings.

Customizable disk usage command allows to deal with these issues
(e.g., "-x" option or "sudo" can be added).

Signed-off-by: Uladzimir Bely <ubely@...>
---
meta/classes/buildstats.bbclass | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 0de605200a..9f80cbd75c 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -8,6 +8,8 @@ BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
#
################################################################################

+BUILDSTATS_DISK_USAGE_CMD ??= "du -sh"
+
def get_buildprocess_cputime(pid):
with open("/proc/%d/stat" % pid, "r") as f:
fields = f.readline().rstrip().split()
@@ -244,7 +246,8 @@ python run_buildstats () {
rootfs = d.getVar('IMAGE_ROOTFS')
if os.path.isdir(rootfs):
try:
- rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
+ rootfs_size = subprocess.check_output(
+ d.getVar('BUILDSTATS_DISK_USAGE_CMD').split() + [rootfs],
stderr=subprocess.STDOUT).decode('utf-8')
f.write("Uncompressed Rootfs size: %s" % rootfs_size)
except subprocess.CalledProcessError as err:
--
2.20.1


[meta-oe][PATCH] Revert "ccid: Fix floating runtime dependency on flex"

Jacob Kroon
 

With the switch to recipe-specific sysroots this patch is no longer
needed. Tested building with and without the patch and the resulting
binaries are identical.

This reverts commit 960314be5d854212ee65604a68a92a3616b2a544.

Signed-off-by: Jacob Kroon <jacob.kroon@...>
---
.../ccid/ccid/no-dep-on-libfl.patch | 18 ------------------
meta-oe/recipes-support/ccid/ccid_1.4.33.bb | 1 -
2 files changed, 19 deletions(-)
delete mode 100644 meta-oe/recipes-support/ccid/ccid/no-dep-on-libfl.patch

diff --git a/meta-oe/recipes-support/ccid/ccid/no-dep-on-libfl.patch b/meta-oe/recipes-support/ccid/ccid/no-dep-on-libfl.patch
deleted file mode 100644
index 477cc31ad..000000000
--- a/meta-oe/recipes-support/ccid/ccid/no-dep-on-libfl.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-No need to link with libfl.
-
-Upstream-Status: Pending
-Signed-off-by: Jacob Kroon <jacob.kroon@...>
-
-Index: ccid-1.4.8/src/Makefile.am
-===================================================================
---- ccid-1.4.8.orig/src/Makefile.am
-+++ ccid-1.4.8/src/Makefile.am
-@@ -53,7 +53,7 @@ PROVIDED_BY_PCSC = debug.c
- endif
-
- libccid_la_SOURCES = $(COMMON) $(USB) $(TOKEN_PARSER) $(PROVIDED_BY_PCSC) $(T1)
--libccid_la_LIBADD = $(LEXLIB) $(LIBUSB_LIBS) $(PTHREAD_LIBS)
-+libccid_la_LIBADD = $(LIBUSB_LIBS) $(PTHREAD_LIBS)
- libccid_la_CFLAGS = $(PCSC_CFLAGS) $(LIBUSB_CFLAGS) $(PTHREAD_CFLAGS) \
- $(SYMBOL_VISIBILITY) -D$(CCID_VERSION) -DSIMCLIST_NO_DUMPRESTORE
- libccid_la_LDFLAGS = -avoid-version
diff --git a/meta-oe/recipes-support/ccid/ccid_1.4.33.bb b/meta-oe/recipes-support/ccid/ccid_1.4.33.bb
index 4b1c42173..e3cb7cef1 100644
--- a/meta-oe/recipes-support/ccid/ccid_1.4.33.bb
+++ b/meta-oe/recipes-support/ccid/ccid_1.4.33.bb
@@ -7,7 +7,6 @@ DEPENDS = "virtual/libusb0 pcsc-lite"
RDEPENDS:${PN} = "pcsc-lite"

SRC_URI = "https://ccid.apdu.fr/files/ccid-${PV}.tar.bz2 \
- file://no-dep-on-libfl.patch \
file://0001-Add-build-rule-for-README.patch \
"


Re: [meta-oe][PATCH] gdb: fix aarch64 remote debugging gdb/28355

Khem Raj
 

please submit this to openembedded-core mailing list as gdb is part of oe-core.

On Sun, Dec 5, 2021 at 10:27 PM Matthias Klein <matthias@...> wrote:

The raspberry3-64 machine from meta-raspberrypi is affected by this bug.

https://sourceware.org/bugzilla/show_bug.cgi?id=28355
https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=eb79b2318066cafb75ffdce310e3bbd44f7c79e3
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=7fd8546853e3f0333ba8d8238413aba7eb45c69f

Signed-off-by: Matthias Klein <matthias@...>
---
meta/recipes-devtools/gdb/gdb-11.1.inc | 1 +
...erver-register-set-selection-dynamic.patch | 317 ++++++++++++++++++
2 files changed, 318 insertions(+)
create mode 100644 meta/recipes-devtools/gdb/gdb/0011-AArch64-Make-gdbserver-register-set-selection-dynamic.patch

diff --git a/meta/recipes-devtools/gdb/gdb-11.1.inc b/meta/recipes-devtools/gdb/gdb-11.1.inc
index 686627926d..a480997220 100644
--- a/meta/recipes-devtools/gdb/gdb-11.1.inc
+++ b/meta/recipes-devtools/gdb/gdb-11.1.inc
@@ -15,5 +15,6 @@ SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \
file://0008-resolve-restrict-keyword-conflict.patch \
file://0009-Fix-invalid-sigprocmask-call.patch \
file://0010-gdbserver-ctrl-c-handling.patch \
+ file://0011-AArch64-Make-gdbserver-register-set-selection-dynamic.patch \
"
SRC_URI[sha256sum] = "cccfcc407b20d343fb320d4a9a2110776dd3165118ffd41f4b1b162340333f94"
diff --git a/meta/recipes-devtools/gdb/gdb/0011-AArch64-Make-gdbserver-register-set-selection-dynamic.patch b/meta/recipes-devtools/gdb/gdb/0011-AArch64-Make-gdbserver-register-set-selection-dynamic.patch
new file mode 100644
index 0000000000..6fc1859391
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0011-AArch64-Make-gdbserver-register-set-selection-dynamic.patch
@@ -0,0 +1,317 @@
+From eb79b2318066cafb75ffdce310e3bbd44f7c79e3 Mon Sep 17 00:00:00 2001
+From: Luis Machado <luis.machado@...>
+Date: Fri, 29 Oct 2021 14:54:36 -0300
+Subject: [PATCH] [AArch64] Make gdbserver register set selection dynamic
+
+The current register set selection mechanism for AArch64 is static, based
+on a pre-populated array of register sets.
+
+This means that we might potentially probe register sets that are not
+available. This is OK if the kernel errors out during ptrace, but probing the
+tag_ctl register, for example, does not result in a ptrace error if the kernel
+supports the tagged address ABI but not MTE (PR 28355).
+
+Making the register set selection dynamic, based on feature checks, solves
+this and simplifies the code a bit. It allows us to list all of the register
+sets only once, and pick and choose based on HWCAP/HWCAP2 or other properties.
+
+gdb/ChangeLog:
+
+2021-11-03 Luis Machado <luis.machado@...>
+
+ PR gdb/28355
+
+ * arch/aarch64.h (struct aarch64_features): New struct.
+
+gdbserver/ChangeLog:
+
+2021-11-03 Luis Machado <luis.machado@...>
+
+ PR gdb/28355
+
+ * linux-aarch64-low.cc (is_sve_tdesc): Remove.
+ (aarch64_target::low_arch_setup): Rework to adjust the register sets.
+ (aarch64_regsets): Update to list all register sets.
+ (aarch64_regsets_info, regs_info_aarch64): Replace NULL with nullptr.
+ (aarch64_sve_regsets, aarch64_sve_regsets_info)
+ (regs_info_aarch64_sve): Remove.
+ (aarch64_adjust_register_sets): New.
+ (aarch64_target::get_regs_info): Remove references to removed structs.
+ (initialize_low_arch): Likewise.
+
+[ChangeLog entry stripped so that patch applies cleanly]
+Upstream-Status: Accepted
+---
+
+diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
+index 0eb702c5b5e..95edb664b55 100644
+--- a/gdb/arch/aarch64.h
++++ b/gdb/arch/aarch64.h
+@@ -22,6 +22,15 @@
+
+ #include "gdbsupport/tdesc.h"
+
++/* Holds information on what architectural features are available. This is
++ used to select register sets. */
++struct aarch64_features
++{
++ bool sve = false;
++ bool pauth = false;
++ bool mte = false;
++};
++
+ /* Create the aarch64 target description. A non zero VQ value indicates both
+ the presence of SVE and the Vector Quotient - the number of 128bit chunks in
+ an SVE Z register. HAS_PAUTH_P indicates the presence of the PAUTH
+diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
+index daccfef746e..9a8cb4169a7 100644
+--- a/gdbserver/linux-aarch64-low.cc
++++ b/gdbserver/linux-aarch64-low.cc
+@@ -196,16 +196,6 @@ is_64bit_tdesc (void)
+ return register_size (regcache->tdesc, 0) == 8;
+ }
+
+-/* Return true if the regcache contains the number of SVE registers. */
+-
+-static bool
+-is_sve_tdesc (void)
+-{
+- struct regcache *regcache = get_thread_regcache (current_thread, 0);
+-
+- return tdesc_contains_feature (regcache->tdesc, "org.gnu.gdb.aarch64.sve");
+-}
+-
+ static void
+ aarch64_fill_gregset (struct regcache *regcache, void *buf)
+ {
+@@ -680,40 +670,6 @@ aarch64_target::low_new_fork (process_info *parent,
+ *child->priv->arch_private = *parent->priv->arch_private;
+ }
+
+-/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */
+-#define AARCH64_HWCAP_PACA (1 << 30)
+-
+-/* Implementation of linux target ops method "low_arch_setup". */
+-
+-void
+-aarch64_target::low_arch_setup ()
+-{
+- unsigned int machine;
+- int is_elf64;
+- int tid;
+-
+- tid = lwpid_of (current_thread);
+-
+- is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine);
+-
+- if (is_elf64)
+- {
+- uint64_t vq = aarch64_sve_get_vq (tid);
+- unsigned long hwcap = linux_get_hwcap (8);
+- unsigned long hwcap2 = linux_get_hwcap2 (8);
+- bool pauth_p = hwcap & AARCH64_HWCAP_PACA;
+- /* MTE is AArch64-only. */
+- bool mte_p = hwcap2 & HWCAP2_MTE;
+-
+- current_process ()->tdesc
+- = aarch64_linux_read_description (vq, pauth_p, mte_p);
+- }
+- else
+- current_process ()->tdesc = aarch32_linux_read_description ();
+-
+- aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
+-}
+-
+ /* Wrapper for aarch64_sve_regs_copy_to_reg_buf. */
+
+ static void
+@@ -730,21 +686,36 @@ aarch64_sve_regs_copy_from_regcache (struct regcache *regcache, void *buf)
+ return aarch64_sve_regs_copy_from_reg_buf (regcache, buf);
+ }
+
++/* Array containing all the possible register sets for AArch64/Linux. During
++ architecture setup, these will be checked against the HWCAP/HWCAP2 bits for
++ validity and enabled/disabled accordingly.
++
++ Their sizes are set to 0 here, but they will be adjusted later depending
++ on whether each register set is available or not. */
+ static struct regset_info aarch64_regsets[] =
+ {
++ /* GPR registers. */
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
+- sizeof (struct user_pt_regs), GENERAL_REGS,
++ 0, GENERAL_REGS,
+ aarch64_fill_gregset, aarch64_store_gregset },
++ /* Floating Point (FPU) registers. */
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
+- sizeof (struct user_fpsimd_state), FP_REGS,
++ 0, FP_REGS,
+ aarch64_fill_fpregset, aarch64_store_fpregset
+ },
++ /* Scalable Vector Extension (SVE) registers. */
++ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE,
++ 0, EXTENDED_REGS,
++ aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache
++ },
++ /* PAC registers. */
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK,
+- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS,
+- NULL, aarch64_store_pauthregset },
++ 0, OPTIONAL_REGS,
++ nullptr, aarch64_store_pauthregset },
++ /* Tagged address control / MTE registers. */
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL,
+- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset,
+- aarch64_store_mteregset },
++ 0, OPTIONAL_REGS,
++ aarch64_fill_mteregset, aarch64_store_mteregset },
+ NULL_REGSET
+ };
+
+@@ -752,47 +723,95 @@ static struct regsets_info aarch64_regsets_info =
+ {
+ aarch64_regsets, /* regsets */
+ 0, /* num_regsets */
+- NULL, /* disabled_regsets */
++ nullptr, /* disabled_regsets */
+ };
+
+ static struct regs_info regs_info_aarch64 =
+ {
+- NULL, /* regset_bitmap */
+- NULL, /* usrregs */
++ nullptr, /* regset_bitmap */
++ nullptr, /* usrregs */
+ &aarch64_regsets_info,
+ };
+
+-static struct regset_info aarch64_sve_regsets[] =
++/* Given FEATURES, adjust the available register sets by setting their
++ sizes. A size of 0 means the register set is disabled and won't be
++ used. */
++
++static void
++aarch64_adjust_register_sets (const struct aarch64_features &features)
+ {
+- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
+- sizeof (struct user_pt_regs), GENERAL_REGS,
+- aarch64_fill_gregset, aarch64_store_gregset },
+- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE,
+- SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE), EXTENDED_REGS,
+- aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache
+- },
+- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK,
+- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS,
+- NULL, aarch64_store_pauthregset },
+- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL,
+- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset,
+- aarch64_store_mteregset },
+- NULL_REGSET
+-};
++ struct regset_info *regset;
+
+-static struct regsets_info aarch64_sve_regsets_info =
+- {
+- aarch64_sve_regsets, /* regsets. */
+- 0, /* num_regsets. */
+- NULL, /* disabled_regsets. */
+- };
++ for (regset = aarch64_regsets; regset->size >= 0; regset++)
++ {
++ switch (regset->nt_type)
++ {
++ case NT_PRSTATUS:
++ /* General purpose registers are always present. */
++ regset->size = sizeof (struct user_pt_regs);
++ break;
++ case NT_FPREGSET:
++ /* This is unavailable when SVE is present. */
++ if (!features.sve)
++ regset->size = sizeof (struct user_fpsimd_state);
++ break;
++ case NT_ARM_SVE:
++ if (features.sve)
++ regset->size = SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE);
++ break;
++ case NT_ARM_PAC_MASK:
++ if (features.pauth)
++ regset->size = AARCH64_PAUTH_REGS_SIZE;
++ break;
++ case NT_ARM_TAGGED_ADDR_CTRL:
++ if (features.mte)
++ regset->size = AARCH64_LINUX_SIZEOF_MTE;
++ break;
++ default:
++ gdb_assert_not_reached ("Unknown register set found.");
++ }
++ }
++}
+
+-static struct regs_info regs_info_aarch64_sve =
+- {
+- NULL, /* regset_bitmap. */
+- NULL, /* usrregs. */
+- &aarch64_sve_regsets_info,
+- };
++/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */
++#define AARCH64_HWCAP_PACA (1 << 30)
++
++/* Implementation of linux target ops method "low_arch_setup". */
++
++void
++aarch64_target::low_arch_setup ()
++{
++ unsigned int machine;
++ int is_elf64;
++ int tid;
++
++ tid = lwpid_of (current_thread);
++
++ is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine);
++
++ if (is_elf64)
++ {
++ struct aarch64_features features;
++
++ uint64_t vq = aarch64_sve_get_vq (tid);
++ features.sve = (vq > 0);
++ /* A-profile PAC is 64-bit only. */
++ features.pauth = linux_get_hwcap (8) & AARCH64_HWCAP_PACA;
++ /* A-profile MTE is 64-bit only. */
++ features.mte = linux_get_hwcap2 (8) & HWCAP2_MTE;
++
++ current_process ()->tdesc
++ = aarch64_linux_read_description (vq, features.pauth, features.mte);
++
++ /* Adjust the register sets we should use for this particular set of
++ features. */
++ aarch64_adjust_register_sets (features);
++ }
++ else
++ current_process ()->tdesc = aarch32_linux_read_description ();
++
++ aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
++}
+
+ /* Implementation of linux target ops method "get_regs_info". */
+
+@@ -802,9 +821,7 @@ aarch64_target::get_regs_info ()
+ if (!is_64bit_tdesc ())
+ return &regs_info_aarch32;
+
+- if (is_sve_tdesc ())
+- return &regs_info_aarch64_sve;
+-
++ /* AArch64 64-bit registers. */
+ return &regs_info_aarch64;
+ }
+
+@@ -3294,5 +3311,4 @@ initialize_low_arch (void)
+ initialize_low_arch_aarch32 ();
+
+ initialize_regsets_info (&aarch64_regsets_info);
+- initialize_regsets_info (&aarch64_sve_regsets_info);
+ }
+--
+2.27.0
+
--
2.30.2




[meta-oe][PATCH] gdb: fix aarch64 remote debugging gdb/28355

Matthias Klein
 

The raspberry3-64 machine from meta-raspberrypi is affected by this bug.

https://sourceware.org/bugzilla/show_bug.cgi?id=3D28355
https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dpatch;h=3Deb79b23180=
66cafb75ffdce310e3bbd44f7c79e3
https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3D7fd854685=
3e3f0333ba8d8238413aba7eb45c69f

Signed-off-by: Matthias Klein <matthias@...>
---
meta/recipes-devtools/gdb/gdb-11.1.inc | 1 +
...erver-register-set-selection-dynamic.patch | 317 ++++++++++++++++++
2 files changed, 318 insertions(+)
create mode 100644 meta/recipes-devtools/gdb/gdb/0011-AArch64-Make-gdbse=
rver-register-set-selection-dynamic.patch

diff --git a/meta/recipes-devtools/gdb/gdb-11.1.inc b/meta/recipes-devtoo=
ls/gdb/gdb-11.1.inc
index 686627926d..a480997220 100644
--- a/meta/recipes-devtools/gdb/gdb-11.1.inc
+++ b/meta/recipes-devtools/gdb/gdb-11.1.inc
@@ -15,5 +15,6 @@ SRC_URI =3D "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \
file://0008-resolve-restrict-keyword-conflict.patch \
file://0009-Fix-invalid-sigprocmask-call.patch \
file://0010-gdbserver-ctrl-c-handling.patch \
+ file://0011-AArch64-Make-gdbserver-register-set-selection-dyn=
amic.patch \
"
SRC_URI[sha256sum] =3D "cccfcc407b20d343fb320d4a9a2110776dd3165118ffd41f=
4b1b162340333f94"
diff --git a/meta/recipes-devtools/gdb/gdb/0011-AArch64-Make-gdbserver-re=
gister-set-selection-dynamic.patch b/meta/recipes-devtools/gdb/gdb/0011-A=
Arch64-Make-gdbserver-register-set-selection-dynamic.patch
new file mode 100644
index 0000000000..6fc1859391
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0011-AArch64-Make-gdbserver-register-=
set-selection-dynamic.patch
@@ -0,0 +1,317 @@
+From eb79b2318066cafb75ffdce310e3bbd44f7c79e3 Mon Sep 17 00:00:00 2001
+From: Luis Machado <luis.machado@...>
+Date: Fri, 29 Oct 2021 14:54:36 -0300
+Subject: [PATCH] [AArch64] Make gdbserver register set selection dynamic
+
+The current register set selection mechanism for AArch64 is static, base=
d
+on a pre-populated array of register sets.
+
+This means that we might potentially probe register sets that are not
+available. This is OK if the kernel errors out during ptrace, but probin=
g the
+tag_ctl register, for example, does not result in a ptrace error if the =
kernel
+supports the tagged address ABI but not MTE (PR 28355).
+
+Making the register set selection dynamic, based on feature checks, solv=
es
+this and simplifies the code a bit. It allows us to list all of the regi=
ster
+sets only once, and pick and choose based on HWCAP/HWCAP2 or other prope=
rties.
+
+gdb/ChangeLog:
+
+2021-11-03 Luis Machado <luis.machado@...>
+
+ PR gdb/28355
+
+ * arch/aarch64.h (struct aarch64_features): New struct.
+
+gdbserver/ChangeLog:
+
+2021-11-03 Luis Machado <luis.machado@...>
+
+ PR gdb/28355
+
+ * linux-aarch64-low.cc (is_sve_tdesc): Remove.
+ (aarch64_target::low_arch_setup): Rework to adjust the register sets.
+ (aarch64_regsets): Update to list all register sets.
+ (aarch64_regsets_info, regs_info_aarch64): Replace NULL with nullptr.
+ (aarch64_sve_regsets, aarch64_sve_regsets_info)
+ (regs_info_aarch64_sve): Remove.
+ (aarch64_adjust_register_sets): New.
+ (aarch64_target::get_regs_info): Remove references to removed structs.
+ (initialize_low_arch): Likewise.
+
+[ChangeLog entry stripped so that patch applies cleanly]
+Upstream-Status: Accepted
+---
+
+diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
+index 0eb702c5b5e..95edb664b55 100644
+--- a/gdb/arch/aarch64.h
++++ b/gdb/arch/aarch64.h
+@@ -22,6 +22,15 @@
+=20
+ #include "gdbsupport/tdesc.h"
+=20
++/* Holds information on what architectural features are available. Thi=
s is
++ used to select register sets. */
++struct aarch64_features
++{
++ bool sve =3D false;
++ bool pauth =3D false;
++ bool mte =3D false;
++};
++
+ /* Create the aarch64 target description. A non zero VQ value indicate=
s both
+ the presence of SVE and the Vector Quotient - the number of 128bit c=
hunks in
+ an SVE Z register. HAS_PAUTH_P indicates the presence of the PAUTH
+diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-lo=
w.cc
+index daccfef746e..9a8cb4169a7 100644
+--- a/gdbserver/linux-aarch64-low.cc
++++ b/gdbserver/linux-aarch64-low.cc
+@@ -196,16 +196,6 @@ is_64bit_tdesc (void)
+ return register_size (regcache->tdesc, 0) =3D=3D 8;
+ }
+=20
+-/* Return true if the regcache contains the number of SVE registers. *=
/
+-
+-static bool
+-is_sve_tdesc (void)
+-{
+- struct regcache *regcache =3D get_thread_regcache (current_thread, 0)=
;
+-
+- return tdesc_contains_feature (regcache->tdesc, "org.gnu.gdb.aarch64.=
sve");
+-}
+-
+ static void
+ aarch64_fill_gregset (struct regcache *regcache, void *buf)
+ {
+@@ -680,40 +670,6 @@ aarch64_target::low_new_fork (process_info *parent,
+ *child->priv->arch_private =3D *parent->priv->arch_private;
+ }
+=20
+-/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwca=
p.h. */
+-#define AARCH64_HWCAP_PACA (1 << 30)
+-
+-/* Implementation of linux target ops method "low_arch_setup". */
+-
+-void
+-aarch64_target::low_arch_setup ()
+-{
+- unsigned int machine;
+- int is_elf64;
+- int tid;
+-
+- tid =3D lwpid_of (current_thread);
+-
+- is_elf64 =3D linux_pid_exe_is_elf_64_file (tid, &machine);
+-
+- if (is_elf64)
+- {
+- uint64_t vq =3D aarch64_sve_get_vq (tid);
+- unsigned long hwcap =3D linux_get_hwcap (8);
+- unsigned long hwcap2 =3D linux_get_hwcap2 (8);
+- bool pauth_p =3D hwcap & AARCH64_HWCAP_PACA;
+- /* MTE is AArch64-only. */
+- bool mte_p =3D hwcap2 & HWCAP2_MTE;
+-
+- current_process ()->tdesc
+- =3D aarch64_linux_read_description (vq, pauth_p, mte_p);
+- }
+- else
+- current_process ()->tdesc =3D aarch32_linux_read_description ();
+-
+- aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
+-}
+-
+ /* Wrapper for aarch64_sve_regs_copy_to_reg_buf. */
+=20
+ static void
+@@ -730,21 +686,36 @@ aarch64_sve_regs_copy_from_regcache (struct regcac=
he *regcache, void *buf)
+ return aarch64_sve_regs_copy_from_reg_buf (regcache, buf);
+ }
+=20
++/* Array containing all the possible register sets for AArch64/Linux. =
During
++ architecture setup, these will be checked against the HWCAP/HWCAP2 b=
its for
++ validity and enabled/disabled accordingly.
++
++ Their sizes are set to 0 here, but they will be adjusted later depen=
ding
++ on whether each register set is available or not. */
+ static struct regset_info aarch64_regsets[] =3D
+ {
++ /* GPR registers. */
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
+- sizeof (struct user_pt_regs), GENERAL_REGS,
++ 0, GENERAL_REGS,
+ aarch64_fill_gregset, aarch64_store_gregset },
++ /* Floating Point (FPU) registers. */
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
+- sizeof (struct user_fpsimd_state), FP_REGS,
++ 0, FP_REGS,
+ aarch64_fill_fpregset, aarch64_store_fpregset
+ },
++ /* Scalable Vector Extension (SVE) registers. */
++ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE,
++ 0, EXTENDED_REGS,
++ aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regca=
che
++ },
++ /* PAC registers. */
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK,
+- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS,
+- NULL, aarch64_store_pauthregset },
++ 0, OPTIONAL_REGS,
++ nullptr, aarch64_store_pauthregset },
++ /* Tagged address control / MTE registers. */
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL,
+- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset,
+- aarch64_store_mteregset },
++ 0, OPTIONAL_REGS,
++ aarch64_fill_mteregset, aarch64_store_mteregset },
+ NULL_REGSET
+ };
+=20
+@@ -752,47 +723,95 @@ static struct regsets_info aarch64_regsets_info =3D
+ {
+ aarch64_regsets, /* regsets */
+ 0, /* num_regsets */
+- NULL, /* disabled_regsets */
++ nullptr, /* disabled_regsets */
+ };
+=20
+ static struct regs_info regs_info_aarch64 =3D
+ {
+- NULL, /* regset_bitmap */
+- NULL, /* usrregs */
++ nullptr, /* regset_bitmap */
++ nullptr, /* usrregs */
+ &aarch64_regsets_info,
+ };
+=20
+-static struct regset_info aarch64_sve_regsets[] =3D
++/* Given FEATURES, adjust the available register sets by setting their
++ sizes. A size of 0 means the register set is disabled and won't be
++ used. */
++
++static void
++aarch64_adjust_register_sets (const struct aarch64_features &features)
+ {
+- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
+- sizeof (struct user_pt_regs), GENERAL_REGS,
+- aarch64_fill_gregset, aarch64_store_gregset },
+- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE,
+- SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE), EXTENDED_REGS,
+- aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regca=
che
+- },
+- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK,
+- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS,
+- NULL, aarch64_store_pauthregset },
+- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL,
+- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset,
+- aarch64_store_mteregset },
+- NULL_REGSET
+-};
++ struct regset_info *regset;
+=20
+-static struct regsets_info aarch64_sve_regsets_info =3D
+- {
+- aarch64_sve_regsets, /* regsets. */
+- 0, /* num_regsets. */
+- NULL, /* disabled_regsets. */
+- };
++ for (regset =3D aarch64_regsets; regset->size >=3D 0; regset++)
++ {
++ switch (regset->nt_type)
++ {
++ case NT_PRSTATUS:
++ /* General purpose registers are always present. */
++ regset->size =3D sizeof (struct user_pt_regs);
++ break;
++ case NT_FPREGSET:
++ /* This is unavailable when SVE is present. */
++ if (!features.sve)
++ regset->size =3D sizeof (struct user_fpsimd_state);
++ break;
++ case NT_ARM_SVE:
++ if (features.sve)
++ regset->size =3D SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE)=
;
++ break;
++ case NT_ARM_PAC_MASK:
++ if (features.pauth)
++ regset->size =3D AARCH64_PAUTH_REGS_SIZE;
++ break;
++ case NT_ARM_TAGGED_ADDR_CTRL:
++ if (features.mte)
++ regset->size =3D AARCH64_LINUX_SIZEOF_MTE;
++ break;
++ default:
++ gdb_assert_not_reached ("Unknown register set found.");
++ }
++ }
++}
+=20
+-static struct regs_info regs_info_aarch64_sve =3D
+- {
+- NULL, /* regset_bitmap. */
+- NULL, /* usrregs. */
+- &aarch64_sve_regsets_info,
+- };
++/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwca=
p.h. */
++#define AARCH64_HWCAP_PACA (1 << 30)
++
++/* Implementation of linux target ops method "low_arch_setup". */
++
++void
++aarch64_target::low_arch_setup ()
++{
++ unsigned int machine;
++ int is_elf64;
++ int tid;
++
++ tid =3D lwpid_of (current_thread);
++
++ is_elf64 =3D linux_pid_exe_is_elf_64_file (tid, &machine);
++
++ if (is_elf64)
++ {
++ struct aarch64_features features;
++
++ uint64_t vq =3D aarch64_sve_get_vq (tid);
++ features.sve =3D (vq > 0);
++ /* A-profile PAC is 64-bit only. */
++ features.pauth =3D linux_get_hwcap (8) & AARCH64_HWCAP_PACA;
++ /* A-profile MTE is 64-bit only. */
++ features.mte =3D linux_get_hwcap2 (8) & HWCAP2_MTE;
++
++ current_process ()->tdesc
++ =3D aarch64_linux_read_description (vq, features.pauth, features.mte);
++
++ /* Adjust the register sets we should use for this particular set=
of
++ features. */
++ aarch64_adjust_register_sets (features);
++ }
++ else
++ current_process ()->tdesc =3D aarch32_linux_read_description ();
++
++ aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
++}
+=20
+ /* Implementation of linux target ops method "get_regs_info". */
+=20
+@@ -802,9 +821,7 @@ aarch64_target::get_regs_info ()
+ if (!is_64bit_tdesc ())
+ return &regs_info_aarch32;
+=20
+- if (is_sve_tdesc ())
+- return &regs_info_aarch64_sve;
+-
++ /* AArch64 64-bit registers. */
+ return &regs_info_aarch64;
+ }
+=20
+@@ -3294,5 +3311,4 @@ initialize_low_arch (void)
+ initialize_low_arch_aarch32 ();
+=20
+ initialize_regsets_info (&aarch64_regsets_info);
+- initialize_regsets_info (&aarch64_sve_regsets_info);
+ }
+--=20
+2.27.0
+
--=20
2.30.2


[meta-oe][PATCH] fb-test: fix SRC_URI

Oleksandr Kravchuk
 

Original repo doesn't exist any more. Even though I couldn't find any
new official repo, this is the only one on github that contains used
commit hash.

Signed-off-by: Oleksandr Kravchuk <open.source@...>
---
.../recipes-test/fbtest/{fb-test_git.bb => fb-test_1.1.0.bb} | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
rename meta-oe/recipes-test/fbtest/{fb-test_git.bb => fb-test_1.1.0.bb} (82%)

diff --git a/meta-oe/recipes-test/fbtest/fb-test_git.bb b/meta-oe/recipes-test/fbtest/fb-test_1.1.0.bb
similarity index 82%
rename from meta-oe/recipes-test/fbtest/fb-test_git.bb
rename to meta-oe/recipes-test/fbtest/fb-test_1.1.0.bb
index 299213572..14ab41b14 100644
--- a/meta-oe/recipes-test/fbtest/fb-test_git.bb
+++ b/meta-oe/recipes-test/fbtest/fb-test_1.1.0.bb
@@ -1,12 +1,10 @@
SUMMARY = "Test suite for Linux framebuffer"

-PV = "1.1.0"
-
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"

SRCREV = "063ec650960c2d79ac51f5c5f026cb05343a33e2"
-SRC_URI = "git://github.com/prpplague/fb-test-app.git;branch=master;protocol=https"
+SRC_URI = "git://github.com//ponty/fb-test-app.git;branch=master;protocol=https"

S = "${WORKDIR}/git"

--
2.25.1


honister merge request: Dec 5th

Armin Kuster
 

The following changes since commit f31b9854b13e46cb74569538a33c36730c00c695:

  sdbus-c++: don't fetch googletest during do_configure (2021-11-18
07:34:55 -0800)

are available in the Git repository at:

  https://git.openembedded.org/meta-openembedded honister-next

for you to fetch changes up to f632403d1800363ac63a1ad5543278b82c659832:

  ifenslave: switch from master to main (2021-11-30 14:27:58 -0800)

----------------------------------------------------------------
Jeremy Puhlman (1):
      ifenslave: switch from master to main

 meta-networking/recipes-support/ifenslave/ifenslave_2.12.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Re: [PATCH 1/1] buildstats: disk usage outside bbclass

Peter Kjellerstedt
 

-----Original Message-----
From: openembedded-devel@... <openembedded-
devel@...> On Behalf Of Uladzimir Bely
Sent: den 4 december 2021 07:33
To: openembedded-devel@...
Subject: [oe] [PATCH 1/1] buildstats: disk usage outside bbclass

This allows to use a custom disk stats command
without modifying buildstats.bbclass.
---
meta/classes/buildstats-utils.bbclass | 4 ++++
meta/classes/buildstats.bbclass | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
create mode 100644 meta/classes/buildstats-utils.bbclass

diff --git a/meta/classes/buildstats-utils.bbclass
b/meta/classes/buildstats-utils.bbclass
new file mode 100644
index 00000000..712674d0
--- /dev/null
+++ b/meta/classes/buildstats-utils.bbclass
@@ -0,0 +1,4 @@
+def buildstats_disk_usage(path):
+ import subprocess
+ return subprocess.check_output(["du", "-shx", path],
+ stderr=subprocess.STDOUT).decode('utf-8')
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 0de60520..1cade568 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -8,6 +8,8 @@ BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
#

################################################################################

+inherit buildstats-utils
+
def get_buildprocess_cputime(pid):
with open("/proc/%d/stat" % pid, "r") as f:
fields = f.readline().rstrip().split()
@@ -244,8 +246,7 @@ python run_buildstats () {
rootfs = d.getVar('IMAGE_ROOTFS')
if os.path.isdir(rootfs):
try:
- rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
- stderr=subprocess.STDOUT).decode('utf-8')
+ rootfs_size = buildstats_disk_usage(rootfs)
A simpler solution is to introduce a bitbake variable for the "du -sh"
command. Then you can just override it with your command as you please.
I.e., add:

BUILDSTATS_DISK_USAGE ??= "du -sh"

after BUILDSTATS_BASE at the top of the file and change the above to:

rootfs_size = subprocess.check_output(
d.getVar('BUILDSTATS_DISK_USAGE').split() + [rootfs],
stderr=subprocess.STDOUT).decode('utf-8')

f.write("Uncompressed Rootfs size: %s" % rootfs_size)
except subprocess.CalledProcessError as err:
bb.warn("Failed to get rootfs size: %s" % err.output.decode('utf-8'))
--
2.20.1
//Peter


[PATCH 1/1] buildstats: disk usage outside bbclass

Uladzimir Bely <ubely@...>
 

This allows to use a custom disk stats command
without modifying buildstats.bbclass.
---
meta/classes/buildstats-utils.bbclass | 4 ++++
meta/classes/buildstats.bbclass | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
create mode 100644 meta/classes/buildstats-utils.bbclass

diff --git a/meta/classes/buildstats-utils.bbclass b/meta/classes/buildstats-utils.bbclass
new file mode 100644
index 00000000..712674d0
--- /dev/null
+++ b/meta/classes/buildstats-utils.bbclass
@@ -0,0 +1,4 @@
+def buildstats_disk_usage(path):
+ import subprocess
+ return subprocess.check_output(["du", "-shx", path],
+ stderr=subprocess.STDOUT).decode('utf-8')
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 0de60520..1cade568 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -8,6 +8,8 @@ BUILDSTATS_BASE = "${TMPDIR}/buildstats/"
#
################################################################################

+inherit buildstats-utils
+
def get_buildprocess_cputime(pid):
with open("/proc/%d/stat" % pid, "r") as f:
fields = f.readline().rstrip().split()
@@ -244,8 +246,7 @@ python run_buildstats () {
rootfs = d.getVar('IMAGE_ROOTFS')
if os.path.isdir(rootfs):
try:
- rootfs_size = subprocess.check_output(["du", "-sh", rootfs],
- stderr=subprocess.STDOUT).decode('utf-8')
+ rootfs_size = buildstats_disk_usage(rootfs)
f.write("Uncompressed Rootfs size: %s" % rootfs_size)
except subprocess.CalledProcessError as err:
bb.warn("Failed to get rootfs size: %s" % err.output.decode('utf-8'))
--
2.20.1


[PATCH 0/1] [meta-oe] buildstats: avoiding disk usage warnings in Isar

Uladzimir Bely <ubely@...>
 

Recently we've borrowed buildstats functionality to Isar (https://github.com/
ilbers/isar/). Everything works well, but there is a problem with a large
number of warnings in the console.

The problems comes from run_buildstats() function (bb.build.TaskSucceeded
handler). Here, rootfs_size is calculated by executing "du -sh" on the
directory.

In case of Isar, this directory may: 1) be created by root, so some
directories are not available for the user; 2) have ./proc and ./dev mounted.
So "du" produces a big amount of "Permissions denied" warnings.

The easiest solution in our case is using "sudo du -shx" instead. This
solution works, bus it requires forking buildstats.bbclass, so our copy will
differ from OE's one. That's what we want to avoid.

I'm looking for a proper way to make some changes in openembedded-core
upstream that will continue using "du -sh" (or "du -shx") in OE/Yocto/etc, but
will allow to use "sudo du -shx" in Isar.

Current idea is to put "du -sh" functionality to some small separate file (.py
or .bbclass) so it could be called from buidstats.bbclass via some abstract
method. Isar could just use its own implementation.

But I'm not sure that it would be a good option for OE-core, because it
doesn't bring any essential improvements for it.

Probably, someone could hint some other way to deal with the issue that
doesn't require changes in files borrowed from OE?

The following patch is an example how it could look like.

Uladzimir Bely (1):
buildstats: disk usage outside bbclass

meta/classes/buildstats-utils.bbclass | 4 ++++
meta/classes/buildstats.bbclass | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
create mode 100644 meta/classes/buildstats-utils.bbclass

--
2.20.1


Re: [meta-java] Request to pull honister branch and override syntax commits from master-next to master branch

Jacob Kroon
 

Hi Richard,

On 11/17/21 16:57, Richard Leitner wrote:
Hi Geoff,

On Sun, Nov 14, 2021 at 08:55:41PM -0800, Geoff Parker via lists.openembedded.org wrote:
I made this request a month ago, still no change to the master branch
so that builds can be made using meta-java with honister or master
openembedded layers.
Thanks for the reminder.
It seems my CI script missed the final push.
I think your CI script needs some more love :-D
Or in case of errors, perhaps publish them here.

Jacob


Re: Unable to build image with qt examples

Ankur Tyagi
 

Hi Martin,

That solved the issue, thanks.

regards
Ankur


[meta-oe][master][honister][PATCH] gattlib: Explicitly disable Python support

Peter Kjellerstedt
 

Under some configuration, CMake may pick up the existence of python
from the native recipe sysroot and use that when linking for target,
resulting in the following error:

ld: .../recipe-sysroot-native/usr/lib/libpython3.10.so: error adding
symbols: file in wrong format

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@...>
---
meta-oe/recipes-connectivity/gattlib/gattlib_git.bb | 1 +
1 file changed, 1 insertion(+)

diff --git a/meta-oe/recipes-connectivity/gattlib/gattlib_git.bb b/meta-oe/recipes-connectivity/gattlib/gattlib_git.bb
index ecff79be4..3fe4c9404 100644
--- a/meta-oe/recipes-connectivity/gattlib/gattlib_git.bb
+++ b/meta-oe/recipes-connectivity/gattlib/gattlib_git.bb
@@ -23,6 +23,7 @@ PACKAGECONFIG[examples] = "-DGATTLIB_BUILD_EXAMPLES=ON,-DGATTLIB_BUILD_EXAMPLES=
# Set this to force use of DBus API if Bluez version is older than 5.42
PACKAGECONFIG[force-dbus] = "-DGATTLIB_FORCE_DBUS=TRUE,-DGATTLIB_FORCE_DBUS=FALSE"

+EXTRA_OECMAKE += "-DGATTLIB_PYTHON_INTERFACE=OFF"
EXTRA_OECMAKE += "-DGATTLIB_BUILD_DOCS=OFF"

inherit pkgconfig cmake


Re: [meta-perl][PATCH] io-compress-lzma-perl: add recipe for version 2.096

Khem Raj
 

On Fri, Dec 3, 2021 at 9:28 AM Sakib Sajal <sakib.sajal@...> wrote:

Add recipe for io-compress-lzma-perl and its dependencies.

Signed-off-by: Sakib Sajal <sakib.sajal@...>
---
.../libio/compress-raw-lzma-perl_2.096.bb | 33 +++++++++++++++++++
.../libio/io-compress-lzma-perl_2.096.bb | 25 ++++++++++++++
.../libio/io-compress-perl_2.096.bb | 25 ++++++++++++++
3 files changed, 83 insertions(+)
create mode 100644 meta-perl/recipes-perl/libio/compress-raw-lzma-perl_2.096.bb
create mode 100644 meta-perl/recipes-perl/libio/io-compress-lzma-perl_2.096.bb
create mode 100644 meta-perl/recipes-perl/libio/io-compress-perl_2.096.bb

diff --git a/meta-perl/recipes-perl/libio/compress-raw-lzma-perl_2.096.bb b/meta-perl/recipes-perl/libio/compress-raw-lzma-perl_2.096.bb
new file mode 100644
index 000000000..431a18f0c
--- /dev/null
+++ b/meta-perl/recipes-perl/libio/compress-raw-lzma-perl_2.096.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = ""Compress::Raw::Lzma" provides an interface to the in-memory \
+compression/uncompression functions from the lzma compression library."
+
+SECTION = "libs"
+LICENSE = "Artisticv1 | GPLv1+"
+PR = "r0"
Drop PR

+
+MAINTAINER= "Poky <poky@...>"
+HOMEPAGE= "https://metacpan.org/release/Compress-Raw-Lzma"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
+file://${COMMON_LICENSE_DIR}/GPL-1.0-only;md5=e9e36a9de734199567a4d769498f743d"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/P/PM/PMQS/Compress-Raw-Lzma-2.096.tar.gz"
+
+SRC_URI[md5sum] = "b5079bb43712fcd1e74b80777fa376ed"
+SRC_URI[sha256sum] = "f3afb267b1303b0f125976e9e4a70c6a4a205e35e7c99b408911f5e5c6578217"
+
+DEPENDS += "xz"
+
+S = "${WORKDIR}/Compress-Raw-Lzma-${PV}"
+
+inherit cpan
+
+export LIBLZMA_INCLUDE="-I${STAGING_DIR_HOST}${includedir}"
+export LIBLZMA_LIB="-I${STAGING_DIR_HOST}${libdir}"
+
+do_compile() {
+ export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
searching for libc-* might not work with musl C library, so either
make it a bit relaxed or some other way
perhaps based on TCLIBC

+ cpan_do_compile
+}
+
+BBCLASSEXTEND = "native"
diff --git a/meta-perl/recipes-perl/libio/io-compress-lzma-perl_2.096.bb b/meta-perl/recipes-perl/libio/io-compress-lzma-perl_2.096.bb
new file mode 100644
index 000000000..27dfe01c2
--- /dev/null
+++ b/meta-perl/recipes-perl/libio/io-compress-lzma-perl_2.096.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "This module provides a Perl interface that allows writing lzma compressed \
+data to files or buffer."
+
+SECTION = "libs"
+LICENSE = "Artisticv1 | GPLv1+"
+PR = "r0"
Drop it

+
+MAINTAINER= "Poky <poky@...>"
+HOMEPAGE= "https://metacpan.org/release/IO-Compress-Lzma"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
+file://${COMMON_LICENSE_DIR}/GPL-1.0-only;md5=e9e36a9de734199567a4d769498f743d"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/P/PM/PMQS/IO-Compress-Lzma-2.096.tar.gz"
+
+SRC_URI[md5sum] = "6c1b70740605b8073e4fbb5ba1e7bbdb"
+SRC_URI[sha256sum] = "2f29125f19bb41d29c4b5a2467e3560b7bce5d428176a046b7c8a51609dce6e8"
+RDEPENDS_${PN} += "compress-raw-lzma-perl"
+RDEPENDS_${PN} += "io-compress-perl"
the override syntax need fixing perhaps.

+
+S = "${WORKDIR}/IO-Compress-Lzma-${PV}"
+
+inherit cpan allarch
+
+BBCLASSEXTEND = "native"
diff --git a/meta-perl/recipes-perl/libio/io-compress-perl_2.096.bb b/meta-perl/recipes-perl/libio/io-compress-perl_2.096.bb
new file mode 100644
index 000000000..a7c669ff4
--- /dev/null
+++ b/meta-perl/recipes-perl/libio/io-compress-perl_2.096.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "This module is not intended for direct use in application code. Its sole \
+purpose is to be sub-classed by IO::Compress modules."
+
+SECTION = "libs"
+LICENSE = "Artisticv1 | GPLv1+"
+PR = "r0"
drop

+
+MAINTAINER= "Poky <poky@...>"
+HOMEPAGE= "https://metacpan.org/release/IO-Compress"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
+file://${COMMON_LICENSE_DIR}/GPL-1.0-only;md5=e9e36a9de734199567a4d769498f743d"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/P/PM/PMQS/IO-Compress-2.096.tar.gz"
+
+SRC_URI[md5sum] = "18ad197cad5ca87bc3a7d2538998e017"
+SRC_URI[sha256sum] = "9d219fd5df4b490b5d2f847921e3cb1c3392758fa0bae9b05a8992b3620ba572"
+RDEPENDS_${PN} += "compress-raw-bzip2-perl"
+RDEPENDS_${PN} += "compress-raw-zlib-perl"
+
+S = "${WORKDIR}/IO-Compress-${PV}"
+
+inherit cpan allarch
+
+BBCLASSEXTEND = "native"
--
2.33.0




[meta-perl][PATCH] io-compress-lzma-perl: add recipe for version 2.096

Sakib Sajal
 

Add recipe for io-compress-lzma-perl and its dependencies.

Signed-off-by: Sakib Sajal <sakib.sajal@...>
---
.../libio/compress-raw-lzma-perl_2.096.bb | 33 +++++++++++++++++++
.../libio/io-compress-lzma-perl_2.096.bb | 25 ++++++++++++++
.../libio/io-compress-perl_2.096.bb | 25 ++++++++++++++
3 files changed, 83 insertions(+)
create mode 100644 meta-perl/recipes-perl/libio/compress-raw-lzma-perl_2.096.bb
create mode 100644 meta-perl/recipes-perl/libio/io-compress-lzma-perl_2.096.bb
create mode 100644 meta-perl/recipes-perl/libio/io-compress-perl_2.096.bb

diff --git a/meta-perl/recipes-perl/libio/compress-raw-lzma-perl_2.096.bb b/meta-perl/recipes-perl/libio/compress-raw-lzma-perl_2.096.bb
new file mode 100644
index 000000000..431a18f0c
--- /dev/null
+++ b/meta-perl/recipes-perl/libio/compress-raw-lzma-perl_2.096.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = ""Compress::Raw::Lzma" provides an interface to the in-memory \
+compression/uncompression functions from the lzma compression library."
+
+SECTION = "libs"
+LICENSE = "Artisticv1 | GPLv1+"
+PR = "r0"
+
+MAINTAINER= "Poky <poky@...>"
+HOMEPAGE= "https://metacpan.org/release/Compress-Raw-Lzma"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
+file://${COMMON_LICENSE_DIR}/GPL-1.0-only;md5=e9e36a9de734199567a4d769498f743d"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/P/PM/PMQS/Compress-Raw-Lzma-2.096.tar.gz"
+
+SRC_URI[md5sum] = "b5079bb43712fcd1e74b80777fa376ed"
+SRC_URI[sha256sum] = "f3afb267b1303b0f125976e9e4a70c6a4a205e35e7c99b408911f5e5c6578217"
+
+DEPENDS += "xz"
+
+S = "${WORKDIR}/Compress-Raw-Lzma-${PV}"
+
+inherit cpan
+
+export LIBLZMA_INCLUDE="-I${STAGING_DIR_HOST}${includedir}"
+export LIBLZMA_LIB="-I${STAGING_DIR_HOST}${libdir}"
+
+do_compile() {
+ export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
+ cpan_do_compile
+}
+
+BBCLASSEXTEND = "native"
diff --git a/meta-perl/recipes-perl/libio/io-compress-lzma-perl_2.096.bb b/meta-perl/recipes-perl/libio/io-compress-lzma-perl_2.096.bb
new file mode 100644
index 000000000..27dfe01c2
--- /dev/null
+++ b/meta-perl/recipes-perl/libio/io-compress-lzma-perl_2.096.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "This module provides a Perl interface that allows writing lzma compressed \
+data to files or buffer."
+
+SECTION = "libs"
+LICENSE = "Artisticv1 | GPLv1+"
+PR = "r0"
+
+MAINTAINER= "Poky <poky@...>"
+HOMEPAGE= "https://metacpan.org/release/IO-Compress-Lzma"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
+file://${COMMON_LICENSE_DIR}/GPL-1.0-only;md5=e9e36a9de734199567a4d769498f743d"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/P/PM/PMQS/IO-Compress-Lzma-2.096.tar.gz"
+
+SRC_URI[md5sum] = "6c1b70740605b8073e4fbb5ba1e7bbdb"
+SRC_URI[sha256sum] = "2f29125f19bb41d29c4b5a2467e3560b7bce5d428176a046b7c8a51609dce6e8"
+RDEPENDS_${PN} += "compress-raw-lzma-perl"
+RDEPENDS_${PN} += "io-compress-perl"
+
+S = "${WORKDIR}/IO-Compress-Lzma-${PV}"
+
+inherit cpan allarch
+
+BBCLASSEXTEND = "native"
diff --git a/meta-perl/recipes-perl/libio/io-compress-perl_2.096.bb b/meta-perl/recipes-perl/libio/io-compress-perl_2.096.bb
new file mode 100644
index 000000000..a7c669ff4
--- /dev/null
+++ b/meta-perl/recipes-perl/libio/io-compress-perl_2.096.bb
@@ -0,0 +1,25 @@
+DESCRIPTION = "This module is not intended for direct use in application code. Its sole \
+purpose is to be sub-classed by IO::Compress modules."
+
+SECTION = "libs"
+LICENSE = "Artisticv1 | GPLv1+"
+PR = "r0"
+
+MAINTAINER= "Poky <poky@...>"
+HOMEPAGE= "https://metacpan.org/release/IO-Compress"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
+file://${COMMON_LICENSE_DIR}/GPL-1.0-only;md5=e9e36a9de734199567a4d769498f743d"
+
+SRC_URI = "https://cpan.metacpan.org/authors/id/P/PM/PMQS/IO-Compress-2.096.tar.gz"
+
+SRC_URI[md5sum] = "18ad197cad5ca87bc3a7d2538998e017"
+SRC_URI[sha256sum] = "9d219fd5df4b490b5d2f847921e3cb1c3392758fa0bae9b05a8992b3620ba572"
+RDEPENDS_${PN} += "compress-raw-bzip2-perl"
+RDEPENDS_${PN} += "compress-raw-zlib-perl"
+
+S = "${WORKDIR}/IO-Compress-${PV}"
+
+inherit cpan allarch
+
+BBCLASSEXTEND = "native"
--
2.33.0


[meta-networking][dunfell][PATCH 3/3] dovecot: Fix CVE-2020-12674

sana kazi
 

Added patch for CVE-2020-12674

Link: http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz

Signed-off-by: Sana Kazi <Sana.Kazi@...>
Signed-off-by: Sana Kazi <sanakazisk19@...>
---
...uth-mech-rpa-Fail-on-zero-len-buffer.patch | 30 +++++++++++++++++++
.../dovecot/dovecot_2.2.36.4.bb | 1 +
2 files changed, 31 insertions(+)
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0001-auth-mech-rpa-Fail-on-zero-len-buffer.patch

diff --git a/meta-networking/recipes-support/dovecot/dovecot/0001-auth-mech-rpa-Fail-on-zero-len-buffer.patch b/meta-networking/recipes-support/dovecot/dovecot/0001-auth-mech-rpa-Fail-on-zero-len-buffer.patch
new file mode 100644
index 0000000000..5580cd409f
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0001-auth-mech-rpa-Fail-on-zero-len-buffer.patch
@@ -0,0 +1,30 @@
+From bd9d2fe7da833f0e4705a8280efc56930371806b Mon Sep 17 00:00:00 2001
+From: Aki Tuomi <aki.tuomi@...>
+Date: Wed, 6 May 2020 13:40:36 +0300
+Subject: [PATCH 1/3] auth: mech-rpa - Fail on zero len buffer
+
+---
+ src/auth/mech-rpa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12674
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/auth/mech-rpa.c b/src/auth/mech-rpa.c
+index 08298ebdd6..2de8705b4f 100644
+--- a/src/auth/mech-rpa.c
++++ b/src/auth/mech-rpa.c
+@@ -224,7 +224,7 @@ rpa_read_buffer(pool_t pool, const unsigned char **data,
+ return 0;
+
+ len = *p++;
+- if (p + len > end)
++ if (p + len > end || len == 0)
+ return 0;
+
+ *buffer = p_malloc(pool, len);
+--
+2.11.0
diff --git a/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb b/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
index e36e51c283..29905196b6 100644
--- a/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
+++ b/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
@@ -25,6 +25,7 @@ SRC_URI = "http://dovecot.org/releases/2.2/dovecot-${PV}.tar.gz \
file://0013-lib-mail-Fix-parse_too_many_nested_mime_parts.patch \
file://buffer_free_fix.patch \
file://0002-lib-ntlm-Check-buffer-length-on-responses.patch \
+ file://0001-auth-mech-rpa-Fail-on-zero-len-buffer.patch \
"

SRC_URI[md5sum] = "66c4d71858b214afee5b390ee602dee2"
--
2.17.1


[meta-networking][dunfell][PATCH 2/3] dovecot: Fix CVE-2020-12673

sana kazi
 

Added patch for CVE-2020-12673

Link: http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz

Signed-off-by: Sana Kazi <Sana.Kazi@...>
Signed-off-by: Sana Kazi <sanakazisk19@...>
---
...tlm-Check-buffer-length-on-responses.patch | 37 +++++++++++++++++++
.../dovecot/dovecot_2.2.36.4.bb | 1 +
2 files changed, 38 insertions(+)
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0002-lib-ntlm-Check-buffer-length-on-responses.patch

diff --git a/meta-networking/recipes-support/dovecot/dovecot/0002-lib-ntlm-Check-buffer-length-on-responses.patch b/meta-networking/recipes-support/dovecot/dovecot/0002-lib-ntlm-Check-buffer-length-on-responses.patch
new file mode 100644
index 0000000000..81aead8aad
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0002-lib-ntlm-Check-buffer-length-on-responses.patch
@@ -0,0 +1,37 @@
+Backport of:
+
+From 1c6405d3026e5ceae3d214d63945bba85251af4c Mon Sep 17 00:00:00 2001
+From: Aki Tuomi <aki.tuomi@...>
+Date: Mon, 18 May 2020 12:33:39 +0300
+Subject: [PATCH 2/3] lib-ntlm: Check buffer length on responses
+
+Add missing check for buffer length.
+
+If this is not checked, it is possible to send message which
+causes read past buffer bug.
+
+Broken in c7480644202e5451fbed448508ea29a25cffc99c
+---
+ src/lib-ntlm/ntlm-message.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12673
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+--- a/src/lib-ntlm/ntlm-message.c
++++ b/src/lib-ntlm/ntlm-message.c
+@@ -184,6 +184,11 @@ static int ntlmssp_check_buffer(const st
+ if (length == 0 && space == 0)
+ return 1;
+
++ if (length > data_size) {
++ *error = "buffer length out of bounds";
++ return 0;
++ }
++
+ if (offset >= data_size) {
+ *error = "buffer offset out of bounds";
+ return 0;
diff --git a/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb b/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
index 407604c819..e36e51c283 100644
--- a/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
+++ b/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
@@ -24,6 +24,7 @@ SRC_URI = "http://dovecot.org/releases/2.2/dovecot-${PV}.tar.gz \
file://0012-lib-mail-Fix-handling-trailing-in-MIME-boundaries.patch \
file://0013-lib-mail-Fix-parse_too_many_nested_mime_parts.patch \
file://buffer_free_fix.patch \
+ file://0002-lib-ntlm-Check-buffer-length-on-responses.patch \
"

SRC_URI[md5sum] = "66c4d71858b214afee5b390ee602dee2"
--
2.17.1


[meta-networking][dunfell][PATCH 1/3] dovecot: Fix CVE-2020-12100

sana kazi
 

Added patches to fix CVE-2020-12100

Link: http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz

Signed-off-by: Sana Kazi <Sana.Kazi@...>
Signed-off-by: Sana Kazi <sanakazisk19@...>
---
...-parser-Add-a-message_part_finish-he.patch | 76 +++++++
...-parser-Change-message_part_append-t.patch | 71 +++++++
...-parser-Optimize-updating-children_c.patch | 49 +++++
...-parser-Optimize-appending-new-part-.patch | 88 ++++++++
...-parser-Minor-code-cleanup-to-findin.patch | 45 +++++
...-parser-Truncate-excessively-long-MI.patch | 163 +++++++++++++++
...-parser-Optimize-boundary-lookups-wh.patch | 72 +++++++
...-parser-Add-boundary_remove_until-he.patch | 50 +++++
...-parser-Don-t-use-memory-pool-for-pa.patch | 169 ++++++++++++++++
...-parser-Support-limiting-max-number-.patch | 188 ++++++++++++++++++
...-parser-Support-limiting-max-number-.patch | 87 ++++++++
...handling-trailing-in-MIME-boundaries.patch | 133 +++++++++++++
...Fix-parse_too_many_nested_mime_parts.patch | 32 +++
.../dovecot/dovecot/buffer_free_fix.patch | 27 +++
.../dovecot/dovecot_2.2.36.4.bb | 14 ++
15 files changed, 1264 insertions(+)
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0001-lib-mail-message-parser-Add-a-message_part_finish-he.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0002-lib-mail-message-parser-Change-message_part_append-t.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0003-lib-mail-message-parser-Optimize-updating-children_c.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0004-lib-mail-message-parser-Optimize-appending-new-part-.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0005-lib-mail-message-parser-Minor-code-cleanup-to-findin.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0006-lib-mail-message-parser-Truncate-excessively-long-MI.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0007-lib-mail-message-parser-Optimize-boundary-lookups-wh.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0008-lib-mail-message-parser-Add-boundary_remove_until-he.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0009-lib-mail-message-parser-Don-t-use-memory-pool-for-pa.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0010-lib-mail-message-parser-Support-limiting-max-number-.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0011-lib-mail-message-parser-Support-limiting-max-number-.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0012-lib-mail-Fix-handling-trailing-in-MIME-boundaries.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/0013-lib-mail-Fix-parse_too_many_nested_mime_parts.patch
create mode 100644 meta-networking/recipes-support/dovecot/dovecot/buffer_free_fix.patch

diff --git a/meta-networking/recipes-support/dovecot/dovecot/0001-lib-mail-message-parser-Add-a-message_part_finish-he.patch b/meta-networking/recipes-support/dovecot/dovecot/0001-lib-mail-message-parser-Add-a-message_part_finish-he.patch
new file mode 100644
index 0000000000..583f71ca58
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0001-lib-mail-message-parser-Add-a-message_part_finish-he.patch
@@ -0,0 +1,76 @@
+From 667d353b0f217372e8cc43ea4fe13466689c7ed0 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 11:33:31 +0300
+Subject: [PATCH 01/13] lib-mail: message-parser - Add a message_part_finish()
+ helper function
+
+---
+ src/lib-mail/message-parser.c | 25 ++++++++++++-------------
+ 1 file changed, 12 insertions(+), 13 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index b1de1950a..aaa8dd8b7 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -195,6 +195,13 @@ message_part_append(pool_t pool, struct message_part *parent)
+ return part;
+ }
+
++static void message_part_finish(struct message_parser_ctx *ctx)
++{
++ message_size_add(&ctx->part->parent->body_size, &ctx->part->body_size);
++ message_size_add(&ctx->part->parent->body_size, &ctx->part->header_size);
++ ctx->part = ctx->part->parent;
++}
++
+ static void parse_next_body_multipart_init(struct message_parser_ctx *ctx)
+ {
+ struct message_boundary *b;
+@@ -312,19 +319,16 @@ static int parse_part_finish(struct message_parser_ctx *ctx,
+ struct message_boundary *boundary,
+ struct message_block *block_r, bool first_line)
+ {
+- struct message_part *part;
+ size_t line_size;
+
+ i_assert(ctx->last_boundary == NULL);
+
+ /* get back to parent MIME part, summing the child MIME part sizes
+ into parent's body sizes */
+- for (part = ctx->part; part != boundary->part; part = part->parent) {
+- message_size_add(&part->parent->body_size, &part->body_size);
+- message_size_add(&part->parent->body_size, &part->header_size);
++ while (ctx->part != boundary->part) {
++ message_part_finish(ctx);
++ i_assert(ctx->part != NULL);
+ }
+- i_assert(part != NULL);
+- ctx->part = part;
+
+ if (boundary->epilogue_found) {
+ /* this boundary isn't needed anymore */
+@@ -1132,13 +1136,8 @@ int message_parser_parse_next_block(struct message_parser_ctx *ctx,
+ i_assert(ctx->input->eof || ctx->input->closed ||
+ ctx->input->stream_errno != 0 ||
+ ctx->broken_reason != NULL);
+- while (ctx->part->parent != NULL) {
+- message_size_add(&ctx->part->parent->body_size,
+- &ctx->part->body_size);
+- message_size_add(&ctx->part->parent->body_size,
+- &ctx->part->header_size);
+- ctx->part = ctx->part->parent;
+- }
++ while (ctx->part->parent != NULL)
++ message_part_finish(ctx);
+ }
+
+ if (block_r->size == 0) {
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0002-lib-mail-message-parser-Change-message_part_append-t.patch b/meta-networking/recipes-support/dovecot/dovecot/0002-lib-mail-message-parser-Change-message_part_append-t.patch
new file mode 100644
index 0000000000..9f24320ebf
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0002-lib-mail-message-parser-Change-message_part_append-t.patch
@@ -0,0 +1,71 @@
+From de0da7bc8df55521db8fa787f88e293618c96386 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 11:34:22 +0300
+Subject: [PATCH 02/13] lib-mail: message-parser - Change message_part_append()
+ to do all work internally
+
+---
+ src/lib-mail/message-parser.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index aaa8dd8b7..2edf3e7a6 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -167,16 +167,17 @@ static int message_parser_read_more(struct message_parser_ctx *ctx,
+ return 1;
+ }
+
+-static struct message_part *
+-message_part_append(pool_t pool, struct message_part *parent)
++static void
++message_part_append(struct message_parser_ctx *ctx)
+ {
++ struct message_part *parent = ctx->part;
+ struct message_part *p, *part, **list;
+
+ i_assert(parent != NULL);
+ i_assert((parent->flags & (MESSAGE_PART_FLAG_MULTIPART |
+ MESSAGE_PART_FLAG_MESSAGE_RFC822)) != 0);
+
+- part = p_new(pool, struct message_part, 1);
++ part = p_new(ctx->part_pool, struct message_part, 1);
+ part->parent = parent;
+ for (p = parent; p != NULL; p = p->parent)
+ p->children_count++;
+@@ -192,7 +193,7 @@ message_part_append(pool_t pool, struct message_part *parent)
+ list = &(*list)->next;
+
+ *list = part;
+- return part;
++ ctx->part = part;
+ }
+
+ static void message_part_finish(struct message_parser_ctx *ctx)
+@@ -220,7 +221,7 @@ static void parse_next_body_multipart_init(struct message_parser_ctx *ctx)
+ static int parse_next_body_message_rfc822_init(struct message_parser_ctx *ctx,
+ struct message_block *block_r)
+ {
+- ctx->part = message_part_append(ctx->part_pool, ctx->part);
++ message_part_append(ctx);
+ return parse_next_header_init(ctx, block_r);
+ }
+
+@@ -270,7 +271,7 @@ boundary_line_find(struct message_parser_ctx *ctx,
+ static int parse_next_mime_header_init(struct message_parser_ctx *ctx,
+ struct message_block *block_r)
+ {
+- ctx->part = message_part_append(ctx->part_pool, ctx->part);
++ message_part_append(ctx);
+ ctx->part->flags |= MESSAGE_PART_FLAG_IS_MIME;
+
+ return parse_next_header_init(ctx, block_r);
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0003-lib-mail-message-parser-Optimize-updating-children_c.patch b/meta-networking/recipes-support/dovecot/dovecot/0003-lib-mail-message-parser-Optimize-updating-children_c.patch
new file mode 100644
index 0000000000..e530902350
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0003-lib-mail-message-parser-Optimize-updating-children_c.patch
@@ -0,0 +1,49 @@
+From a9800b436fcf1f9633c2b136a9c5cb7a486a8a52 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 11:36:48 +0300
+Subject: [PATCH 03/13] lib-mail: message-parser - Optimize updating
+ children_count
+
+---
+ src/lib-mail/message-parser.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index 2edf3e7a6..05768a058 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -171,7 +171,7 @@ static void
+ message_part_append(struct message_parser_ctx *ctx)
+ {
+ struct message_part *parent = ctx->part;
+- struct message_part *p, *part, **list;
++ struct message_part *part, **list;
+
+ i_assert(parent != NULL);
+ i_assert((parent->flags & (MESSAGE_PART_FLAG_MULTIPART |
+@@ -179,8 +179,6 @@ message_part_append(struct message_parser_ctx *ctx)
+
+ part = p_new(ctx->part_pool, struct message_part, 1);
+ part->parent = parent;
+- for (p = parent; p != NULL; p = p->parent)
+- p->children_count++;
+
+ /* set child position */
+ part->physical_pos =
+@@ -200,6 +198,7 @@ static void message_part_finish(struct message_parser_ctx *ctx)
+ {
+ message_size_add(&ctx->part->parent->body_size, &ctx->part->body_size);
+ message_size_add(&ctx->part->parent->body_size, &ctx->part->header_size);
++ ctx->part->parent->children_count += 1 + ctx->part->children_count;
+ ctx->part = ctx->part->parent;
+ }
+
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0004-lib-mail-message-parser-Optimize-appending-new-part-.patch b/meta-networking/recipes-support/dovecot/dovecot/0004-lib-mail-message-parser-Optimize-appending-new-part-.patch
new file mode 100644
index 0000000000..c35bf883e6
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0004-lib-mail-message-parser-Optimize-appending-new-part-.patch
@@ -0,0 +1,88 @@
+From 99ee7596712cf0ea0a288b712bc898ecb2b35f9b Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 12:00:38 +0300
+Subject: [PATCH 04/13] lib-mail: message-parser - Optimize appending new part
+ to linked list
+
+---
+ src/lib-mail/message-parser.c | 28 ++++++++++++++++++++++------
+ 1 file changed, 22 insertions(+), 6 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -1,7 +1,7 @@
+ /* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
+
+ #include "lib.h"
+-#include "buffer.h"
++#include "array.h"
+ #include "str.h"
+ #include "istream.h"
+ #include "rfc822-parser.h"
+@@ -34,6 +34,9 @@ struct message_parser_ctx {
+ const char *last_boundary;
+ struct message_boundary *boundaries;
+
++ struct message_part **next_part;
++ ARRAY(struct message_part **) next_part_stack;
++
+ size_t skip;
+ char last_chr;
+ unsigned int want_count;
+@@ -171,7 +174,7 @@ static void
+ message_part_append(struct message_parser_ctx *ctx)
+ {
+ struct message_part *parent = ctx->part;
+- struct message_part *part, **list;
++ struct message_part *part;
+
+ i_assert(parent != NULL);
+ i_assert((parent->flags & (MESSAGE_PART_FLAG_MULTIPART |
+@@ -186,16 +189,27 @@ message_part_append(struct message_parse
+ parent->body_size.physical_size +
+ parent->header_size.physical_size;
+
+- list = &part->parent->children;
+- while (*list != NULL)
+- list = &(*list)->next;
++ /* add to parent's linked list */
++ *ctx->next_part = part;
++ /* update the parent's end-of-linked-list pointer */
++ struct message_part **next_part = &part->next;
++ array_append(&ctx->next_part_stack, &next_part, 1);
++ /* This part is now the new parent for the next message_part_append()
++ call. Its linked list begins with the children pointer. */
++ ctx->next_part = &part->children;
+
+- *list = part;
+ ctx->part = part;
+ }
+
+ static void message_part_finish(struct message_parser_ctx *ctx)
+ {
++ struct message_part **const *parent_next_partp;
++ unsigned int count = array_count(&ctx->next_part_stack);
++
++ parent_next_partp = array_idx(&ctx->next_part_stack, count-1);
++ array_delete(&ctx->next_part_stack, count-1, 1);
++ ctx->next_part = *parent_next_partp;
++
+ message_size_add(&ctx->part->parent->body_size, &ctx->part->body_size);
+ message_size_add(&ctx->part->parent->body_size, &ctx->part->header_size);
+ ctx->part->parent->children_count += 1 + ctx->part->children_count;
+@@ -1062,7 +1076,9 @@ message_parser_init(pool_t part_pool, st
+ ctx = message_parser_init_int(input, hdr_flags, flags);
+ ctx->part_pool = part_pool;
+ ctx->parts = ctx->part = p_new(part_pool, struct message_part, 1);
++ ctx->next_part = &ctx->part->children;
+ ctx->parse_next_block = parse_next_header_init;
++ p_array_init(&ctx->next_part_stack, ctx->parser_pool, 4);
+ return ctx;
+ }
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0005-lib-mail-message-parser-Minor-code-cleanup-to-findin.patch b/meta-networking/recipes-support/dovecot/dovecot/0005-lib-mail-message-parser-Minor-code-cleanup-to-findin.patch
new file mode 100644
index 0000000000..4e63509b45
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0005-lib-mail-message-parser-Minor-code-cleanup-to-findin.patch
@@ -0,0 +1,45 @@
+From e39c95b248917eb2b596ca55a957f3cbc7fd406f Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 12:10:07 +0300
+Subject: [PATCH 05/13] lib-mail: message-parser - Minor code cleanup to
+ finding the end of boundary line
+
+---
+ src/lib-mail/message-parser.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index ff4e09e5a..6c6a680b5 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -260,17 +260,16 @@ boundary_line_find(struct message_parser_ctx *ctx,
+ }
+
+ /* need to find the end of line */
+- if (memchr(data + 2, '\n', size - 2) == NULL &&
+- size < BOUNDARY_END_MAX_LEN &&
++ data += 2;
++ size -= 2;
++ if (memchr(data, '\n', size) == NULL &&
++ size+2 < BOUNDARY_END_MAX_LEN &&
+ !ctx->input->eof && !full) {
+ /* no LF found */
+ ctx->want_count = BOUNDARY_END_MAX_LEN;
+ return 0;
+ }
+
+- data += 2;
+- size -= 2;
+-
+ *boundary_r = boundary_find(ctx->boundaries, data, size);
+ if (*boundary_r == NULL)
+ return -1;
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0006-lib-mail-message-parser-Truncate-excessively-long-MI.patch b/meta-networking/recipes-support/dovecot/dovecot/0006-lib-mail-message-parser-Truncate-excessively-long-MI.patch
new file mode 100644
index 0000000000..1012d7983e
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0006-lib-mail-message-parser-Truncate-excessively-long-MI.patch
@@ -0,0 +1,163 @@
+From aed125484a346b4893c1a169088c39fe7ced01f3 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 12:53:12 +0300
+Subject: [PATCH 06/13] lib-mail: message-parser - Truncate excessively long
+ MIME boundaries
+
+RFC 2046 requires that the boundaries are a maximum of 70 characters
+(excluding the "--" prefix and suffix). We allow 80 characters for a bit of
+extra safety. Anything longer than that is truncated and treated the same
+as if it was just 80 characters.
+---
+ src/lib-mail/message-parser.c | 7 ++-
+ src/lib-mail/test-message-parser.c | 95 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 100 insertions(+), 2 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index 6c6a680b5..92f541b02 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -10,7 +10,8 @@
+
+ /* RFC-2046 requires boundaries are max. 70 chars + "--" prefix + "--" suffix.
+ We'll add a bit more just in case. */
+-#define BOUNDARY_END_MAX_LEN (70 + 2 + 2 + 10)
++#define BOUNDARY_STRING_MAX_LEN (70 + 10)
++#define BOUNDARY_END_MAX_LEN (BOUNDARY_STRING_MAX_LEN + 2 + 2)
+
+ struct message_boundary {
+ struct message_boundary *next;
+@@ -526,8 +527,10 @@ static void parse_content_type(struct message_parser_ctx *ctx,
+ rfc2231_parse(&parser, &results);
+ for (; *results != NULL; results += 2) {
+ if (strcasecmp(results[0], "boundary") == 0) {
++ /* truncate excessively long boundaries */
+ ctx->last_boundary =
+- p_strdup(ctx->parser_pool, results[1]);
++ p_strndup(ctx->parser_pool, results[1],
++ BOUNDARY_STRING_MAX_LEN);
+ break;
+ }
+ }
+diff --git a/src/lib-mail/test-message-parser.c b/src/lib-mail/test-message-parser.c
+index 1f1aa1437..94aa3eb7c 100644
+--- a/src/lib-mail/test-message-parser.c
++++ b/src/lib-mail/test-message-parser.c
+@@ -642,6 +642,100 @@ static void test_message_parser_no_eoh(void)
+ test_end();
+ }
+
++static void test_message_parser_long_mime_boundary(void)
++{
++ /* Close the boundaries in wrong reverse order. But because all
++ boundaries are actually truncated to the same size (..890) it
++ works the same as if all of them were duplicate boundaries. */
++static const char input_msg[] =
++"Content-Type: multipart/mixed; boundary=\"1234567890123456789012345678901234567890123456789012345678901234567890123456789012\"\n"
++"\n"
++"--1234567890123456789012345678901234567890123456789012345678901234567890123456789012\n"
++"Content-Type: multipart/mixed; boundary=\"123456789012345678901234567890123456789012345678901234567890123456789012345678901\"\n"
++"\n"
++"--123456789012345678901234567890123456789012345678901234567890123456789012345678901\n"
++"Content-Type: multipart/mixed; boundary=\"12345678901234567890123456789012345678901234567890123456789012345678901234567890\"\n"
++"\n"
++"--12345678901234567890123456789012345678901234567890123456789012345678901234567890\n"
++"Content-Type: text/plain\n"
++"\n"
++"1\n"
++"--1234567890123456789012345678901234567890123456789012345678901234567890123456789012\n"
++"Content-Type: text/plain\n"
++"\n"
++"22\n"
++"--123456789012345678901234567890123456789012345678901234567890123456789012345678901\n"
++"Content-Type: text/plain\n"
++"\n"
++"333\n"
++"--12345678901234567890123456789012345678901234567890123456789012345678901234567890\n"
++"Content-Type: text/plain\n"
++"\n"
++"4444\n";
++ struct message_parser_ctx *parser;
++ struct istream *input;
++ struct message_part *parts, *part;
++ struct message_block block;
++ pool_t pool;
++ int ret;
++
++ test_begin("message parser long mime boundary");
++ pool = pool_alloconly_create("message parser", 10240);
++ input = test_istream_create(input_msg);
++
++ parser = message_parser_init(pool, input, 0, 0);
++ while ((ret = message_parser_parse_next_block(parser, &block)) > 0) ;
++ test_assert(ret < 0);
++ message_parser_deinit(&parser, &parts);
++
++ part = parts;
++ test_assert(part->children_count == 6);
++ test_assert(part->flags == (MESSAGE_PART_FLAG_MULTIPART | MESSAGE_PART_FLAG_IS_MIME));
++ test_assert(part->header_size.lines == 2);
++ test_assert(part->header_size.physical_size == 126);
++ test_assert(part->header_size.virtual_size == 126+2);
++ test_assert(part->body_size.lines == 22);
++ test_assert(part->body_size.physical_size == 871);
++ test_assert(part->body_size.virtual_size == 871+22);
++
++ part = parts->children;
++ test_assert(part->children_count == 5);
++ test_assert(part->flags == (MESSAGE_PART_FLAG_MULTIPART | MESSAGE_PART_FLAG_IS_MIME));
++ test_assert(part->header_size.lines == 2);
++ test_assert(part->header_size.physical_size == 125);
++ test_assert(part->header_size.virtual_size == 125+2);
++ test_assert(part->body_size.lines == 19);
++ test_assert(part->body_size.physical_size == 661);
++ test_assert(part->body_size.virtual_size == 661+19);
++
++ part = parts->children->children;
++ test_assert(part->children_count == 4);
++ test_assert(part->flags == (MESSAGE_PART_FLAG_MULTIPART | MESSAGE_PART_FLAG_IS_MIME));
++ test_assert(part->header_size.lines == 2);
++ test_assert(part->header_size.physical_size == 124);
++ test_assert(part->header_size.virtual_size == 124+2);
++ test_assert(part->body_size.lines == 16);
++ test_assert(part->body_size.physical_size == 453);
++ test_assert(part->body_size.virtual_size == 453+16);
++
++ part = parts->children->children->children;
++ for (unsigned int i = 1; i <= 3; i++, part = part->next) {
++ test_assert(part->children_count == 0);
++ test_assert(part->flags == (MESSAGE_PART_FLAG_TEXT | MESSAGE_PART_FLAG_IS_MIME));
++ test_assert(part->header_size.lines == 2);
++ test_assert(part->header_size.physical_size == 26);
++ test_assert(part->header_size.virtual_size == 26+2);
++ test_assert(part->body_size.lines == 0);
++ test_assert(part->body_size.physical_size == i);
++ test_assert(part->body_size.virtual_size == i);
++ }
++
++ test_parsed_parts(input, parts);
++ i_stream_unref(&input);
++ pool_unref(&pool);
++ test_end();
++}
++
+ int main(void)
+ {
+ static void (*test_functions[])(void) = {
+@@ -654,6 +748,7 @@ int main(void)
+ test_message_parser_garbage_suffix_mime_boundary,
+ test_message_parser_continuing_mime_boundary,
+ test_message_parser_continuing_truncated_mime_boundary,
++ test_message_parser_long_mime_boundary,
+ test_message_parser_no_eoh,
+ NULL
+ };
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0007-lib-mail-message-parser-Optimize-boundary-lookups-wh.patch b/meta-networking/recipes-support/dovecot/dovecot/0007-lib-mail-message-parser-Optimize-boundary-lookups-wh.patch
new file mode 100644
index 0000000000..eeb6c96f1a
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0007-lib-mail-message-parser-Optimize-boundary-lookups-wh.patch
@@ -0,0 +1,72 @@
+From 5f8de52fec3191a1aa68a399ee2068485737dc4f Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 13:06:02 +0300
+Subject: [PATCH 07/13] lib-mail: message-parser - Optimize boundary lookups
+ when exact boundary is found
+
+When an exact boundary is found, there's no need to continue looking for
+more boundaries.
+---
+ src/lib-mail/message-parser.c | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index 92f541b02..c2934c761 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -80,8 +80,14 @@ boundary_find(struct message_boundary *boundaries,
+ while (boundaries != NULL) {
+ if (boundaries->len <= len &&
+ memcmp(boundaries->boundary, data, boundaries->len) == 0 &&
+- (best == NULL || best->len < boundaries->len))
++ (best == NULL || best->len < boundaries->len)) {
+ best = boundaries;
++ if (best->len == len) {
++ /* This is exactly the wanted boundary. There
++ can't be a better one. */
++ break;
++ }
++ }
+
+ boundaries = boundaries->next;
+ }
+@@ -263,15 +269,27 @@ boundary_line_find(struct message_parser_ctx *ctx,
+ /* need to find the end of line */
+ data += 2;
+ size -= 2;
+- if (memchr(data, '\n', size) == NULL &&
++ const unsigned char *lf_pos = memchr(data, '\n', size);
++ if (lf_pos == NULL &&
+ size+2 < BOUNDARY_END_MAX_LEN &&
+ !ctx->input->eof && !full) {
+ /* no LF found */
+ ctx->want_count = BOUNDARY_END_MAX_LEN;
+ return 0;
+ }
+-
+- *boundary_r = boundary_find(ctx->boundaries, data, size);
++ size_t find_size = size;
++
++ if (lf_pos != NULL) {
++ find_size = lf_pos - data;
++ if (find_size > 0 && data[find_size-1] == '\r')
++ find_size--;
++ if (find_size > 2 && data[find_size-1] == '-' &&
++ data[find_size-2] == '-')
++ find_size -= 2;
++ } else if (find_size > BOUNDARY_END_MAX_LEN)
++ find_size = BOUNDARY_END_MAX_LEN;
++
++ *boundary_r = boundary_find(ctx->boundaries, data, find_size);
+ if (*boundary_r == NULL)
+ return -1;
+
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0008-lib-mail-message-parser-Add-boundary_remove_until-he.patch b/meta-networking/recipes-support/dovecot/dovecot/0008-lib-mail-message-parser-Add-boundary_remove_until-he.patch
new file mode 100644
index 0000000000..4af070a879
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0008-lib-mail-message-parser-Add-boundary_remove_until-he.patch
@@ -0,0 +1,50 @@
+From 929396767d831bedbdec6392aaa835b045332fd3 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 14:53:27 +0300
+Subject: [PATCH 08/13] lib-mail: message-parser - Add boundary_remove_until()
+ helper function
+
+---
+ src/lib-mail/message-parser.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index c2934c761..028f74159 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -223,6 +223,13 @@ static void message_part_finish(struct message_parser_ctx *ctx)
+ ctx->part = ctx->part->parent;
+ }
+
++static void
++boundary_remove_until(struct message_parser_ctx *ctx,
++ struct message_boundary *boundary)
++{
++ ctx->boundaries = boundary;
++}
++
+ static void parse_next_body_multipart_init(struct message_parser_ctx *ctx)
+ {
+ struct message_boundary *b;
+@@ -364,10 +371,10 @@ static int parse_part_finish(struct message_parser_ctx *ctx,
+
+ if (boundary->epilogue_found) {
+ /* this boundary isn't needed anymore */
+- ctx->boundaries = boundary->next;
++ boundary_remove_until(ctx, boundary->next);
+ } else {
+ /* forget about the boundaries we possibly skipped */
+- ctx->boundaries = boundary;
++ boundary_remove_until(ctx, boundary);
+ }
+
+ /* the boundary itself should already be in buffer. add that. */
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0009-lib-mail-message-parser-Don-t-use-memory-pool-for-pa.patch b/meta-networking/recipes-support/dovecot/dovecot/0009-lib-mail-message-parser-Don-t-use-memory-pool-for-pa.patch
new file mode 100644
index 0000000000..aade7dc2b3
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0009-lib-mail-message-parser-Don-t-use-memory-pool-for-pa.patch
@@ -0,0 +1,169 @@
+From d53d83214b1d635446a8cf8ff9438cc530133d62 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 15:00:57 +0300
+Subject: [PATCH 09/13] lib-mail: message-parser - Don't use memory pool for
+ parser
+
+This reduces memory usage when parsing many MIME parts where boundaries are
+being added and removed constantly.
+---
+ src/lib-mail/message-parser.c | 48 ++++++++++++++++++++++++++++---------------
+ 1 file changed, 32 insertions(+), 16 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index 028f74159..8970d8e0e 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -17,14 +17,14 @@ struct message_boundary {
+ struct message_boundary *next;
+
+ struct message_part *part;
+- const char *boundary;
++ char *boundary;
+ size_t len;
+
+ unsigned int epilogue_found:1;
+ };
+
+ struct message_parser_ctx {
+- pool_t parser_pool, part_pool;
++ pool_t part_pool;
+ struct istream *input;
+ struct message_part *parts, *part;
+ const char *broken_reason;
+@@ -32,7 +32,7 @@ struct message_parser_ctx {
+ enum message_header_parser_flags hdr_flags;
+ enum message_parser_flags flags;
+
+- const char *last_boundary;
++ char *last_boundary;
+ struct message_boundary *boundaries;
+
+ struct message_part **next_part;
+@@ -223,10 +223,24 @@ static void message_part_finish(struct message_parser_ctx *ctx)
+ ctx->part = ctx->part->parent;
+ }
+
++static void message_boundary_free(struct message_boundary *b)
++{
++ i_free(b->boundary);
++ i_free(b);
++}
++
+ static void
+ boundary_remove_until(struct message_parser_ctx *ctx,
+ struct message_boundary *boundary)
+ {
++ while (ctx->boundaries != boundary) {
++ struct message_boundary *cur = ctx->boundaries;
++
++ i_assert(cur != NULL);
++ ctx->boundaries = cur->next;
++ message_boundary_free(cur);
++
++ }
+ ctx->boundaries = boundary;
+ }
+
+@@ -234,15 +248,14 @@ static void parse_next_body_multipart_init(struct message_parser_ctx *ctx)
+ {
+ struct message_boundary *b;
+
+- b = p_new(ctx->parser_pool, struct message_boundary, 1);
++ b = i_new(struct message_boundary, 1);
+ b->part = ctx->part;
+ b->boundary = ctx->last_boundary;
++ ctx->last_boundary = NULL;
+ b->len = strlen(b->boundary);
+
+ b->next = ctx->boundaries;
+ ctx->boundaries = b;
+-
+- ctx->last_boundary = NULL;
+ }
+
+ static int parse_next_body_message_rfc822_init(struct message_parser_ctx *ctx,
+@@ -359,6 +372,8 @@ static int parse_part_finish(struct message_parser_ctx *ctx,
+ struct message_block *block_r, bool first_line)
+ {
+ size_t line_size;
++ size_t boundary_len = boundary->len;
++ bool boundary_epilogue_found = boundary->epilogue_found;
+
+ i_assert(ctx->last_boundary == NULL);
+
+@@ -391,7 +406,7 @@ static int parse_part_finish(struct message_parser_ctx *ctx,
+ i_assert(block_r->data[0] == '\n');
+ line_size = 1;
+ }
+- line_size += 2 + boundary->len + (boundary->epilogue_found ? 2 : 0);
++ line_size += 2 + boundary_len + (boundary_epilogue_found ? 2 : 0);
+ i_assert(block_r->size >= ctx->skip + line_size);
+ block_r->size = line_size;
+ parse_body_add_block(ctx, block_r);
+@@ -553,9 +568,9 @@ static void parse_content_type(struct message_parser_ctx *ctx,
+ for (; *results != NULL; results += 2) {
+ if (strcasecmp(results[0], "boundary") == 0) {
+ /* truncate excessively long boundaries */
++ i_free(ctx->last_boundary);
+ ctx->last_boundary =
+- p_strndup(ctx->parser_pool, results[1],
+- BOUNDARY_STRING_MAX_LEN);
++ i_strndup(results[1], BOUNDARY_STRING_MAX_LEN);
+ break;
+ }
+ }
+@@ -678,7 +693,7 @@ static int parse_next_header(struct message_parser_ctx *ctx,
+ i_assert(!ctx->multipart);
+ part->flags = 0;
+ }
+- ctx->last_boundary = NULL;
++ i_free(ctx->last_boundary);
+
+ if (!ctx->part_seen_content_type ||
+ (part->flags & MESSAGE_PART_FLAG_IS_MIME) == 0) {
+@@ -1081,11 +1096,8 @@ message_parser_init_int(struct istream *input,
+ enum message_parser_flags flags)
+ {
+ struct message_parser_ctx *ctx;
+- pool_t pool;
+
+- pool = pool_alloconly_create("Message Parser", 1024);
+- ctx = p_new(pool, struct message_parser_ctx, 1);
+- ctx->parser_pool = pool;
++ ctx = i_new(struct message_parser_ctx, 1);
+ ctx->hdr_flags = hdr_flags;
+ ctx->flags = flags;
+ ctx->input = input;
+@@ -1105,7 +1117,7 @@ message_parser_init(pool_t part_pool, struct istream *input,
+ ctx->parts = ctx->part = p_new(part_pool, struct message_part, 1);
+ ctx->next_part = &ctx->part->children;
+ ctx->parse_next_block = parse_next_header_init;
+- p_array_init(&ctx->next_part_stack, ctx->parser_pool, 4);
++ i_array_init(&ctx->next_part_stack, 4);
+ return ctx;
+ }
+
+@@ -1146,8 +1158,12 @@ int message_parser_deinit_from_parts(struct message_parser_ctx **_ctx,
+
+ if (ctx->hdr_parser_ctx != NULL)
+ message_parse_header_deinit(&ctx->hdr_parser_ctx);
++ boundary_remove_until(ctx, NULL);
+ i_stream_unref(&ctx->input);
+- pool_unref(&ctx->parser_pool);
++ if (array_is_created(&ctx->next_part_stack))
++ array_free(&ctx->next_part_stack);
++ i_free(ctx->last_boundary);
++ i_free(ctx);
+ i_assert(ret < 0 || *parts_r != NULL);
+ return ret;
+ }
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0010-lib-mail-message-parser-Support-limiting-max-number-.patch b/meta-networking/recipes-support/dovecot/dovecot/0010-lib-mail-message-parser-Support-limiting-max-number-.patch
new file mode 100644
index 0000000000..ae52544665
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0010-lib-mail-message-parser-Support-limiting-max-number-.patch
@@ -0,0 +1,188 @@
+From df9e0d358ef86e3342525dcdefcf79dc2d749a30 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 16:59:40 +0300
+Subject: [PATCH 10/13] lib-mail: message-parser - Support limiting max number
+ of nested MIME parts
+
+The default is to allow 100 nested MIME parts. When the limit is reached,
+the innermost MIME part's body contains all the rest of the inner bodies
+until a parent MIME part is reached.
+---
+ src/lib-mail/message-parser.c | 43 +++++++++++++++++++++++++++++++-------
+ src/lib-mail/test-message-parser.c | 31 +++++++++++++++++++++++++++
+ 2 files changed, 67 insertions(+), 7 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index 8970d8e0e..721615f76 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -13,6 +13,8 @@
+ #define BOUNDARY_STRING_MAX_LEN (70 + 10)
+ #define BOUNDARY_END_MAX_LEN (BOUNDARY_STRING_MAX_LEN + 2 + 2)
+
++#define MESSAGE_PARSER_DEFAULT_MAX_NESTED_MIME_PARTS 100
++
+ struct message_boundary {
+ struct message_boundary *next;
+
+@@ -28,9 +30,11 @@ struct message_parser_ctx {
+ struct istream *input;
+ struct message_part *parts, *part;
+ const char *broken_reason;
++ unsigned int nested_parts_count;
+
+ enum message_header_parser_flags hdr_flags;
+ enum message_parser_flags flags;
++ unsigned int max_nested_mime_parts;
+
+ char *last_boundary;
+ struct message_boundary *boundaries;
+@@ -206,6 +210,8 @@ message_part_append(struct message_parser_ctx *ctx)
+ ctx->next_part = &part->children;
+
+ ctx->part = part;
++ ctx->nested_parts_count++;
++ i_assert(ctx->nested_parts_count < ctx->max_nested_mime_parts);
+ }
+
+ static void message_part_finish(struct message_parser_ctx *ctx)
+@@ -213,8 +219,12 @@ static void message_part_finish(struct message_parser_ctx *ctx)
+ struct message_part **const *parent_next_partp;
+ unsigned int count = array_count(&ctx->next_part_stack);
+
++ i_assert(ctx->nested_parts_count > 0);
++ ctx->nested_parts_count--;
++
+ parent_next_partp = array_idx(&ctx->next_part_stack, count-1);
+ array_delete(&ctx->next_part_stack, count-1, 1);
++
+ ctx->next_part = *parent_next_partp;
+
+ message_size_add(&ctx->part->parent->body_size, &ctx->part->body_size);
+@@ -592,6 +602,11 @@ static bool block_is_at_eoh(const struct message_block *block)
+ return FALSE;
+ }
+
++static bool parse_too_many_nested_mime_parts(struct message_parser_ctx *ctx)
++{
++ return ctx->nested_parts_count > ctx->max_nested_mime_parts;
++}
++
+ #define MUTEX_FLAGS \
+ (MESSAGE_PART_FLAG_MESSAGE_RFC822 | MESSAGE_PART_FLAG_MULTIPART)
+
+@@ -616,8 +631,12 @@ static int parse_next_header(struct message_parser_ctx *ctx,
+ "\n--boundary" belongs to us or to a previous boundary.
+ this is a problem if the boundary prefixes are identical,
+ because MIME requires only the prefix to match. */
+- parse_next_body_multipart_init(ctx);
+- ctx->multipart = TRUE;
++ if (!parse_too_many_nested_mime_parts(ctx)) {
++ parse_next_body_multipart_init(ctx);
++ ctx->multipart = TRUE;
++ } else {
++ part->flags &= ~MESSAGE_PART_FLAG_MULTIPART;
++ }
+ }
+
+ /* before parsing the header see if we can find a --boundary from here.
+@@ -721,12 +740,16 @@ static int parse_next_header(struct message_parser_ctx *ctx,
+ i_assert(ctx->last_boundary == NULL);
+ ctx->multipart = FALSE;
+ ctx->parse_next_block = parse_next_body_to_boundary;
+- } else if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822)
++ } else if ((part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) != 0 &&
++ !parse_too_many_nested_mime_parts(ctx)) {
+ ctx->parse_next_block = parse_next_body_message_rfc822_init;
+- else if (ctx->boundaries != NULL)
+- ctx->parse_next_block = parse_next_body_to_boundary;
+- else
+- ctx->parse_next_block = parse_next_body_to_eof;
++ } else {
++ part->flags &= ~MESSAGE_PART_FLAG_MESSAGE_RFC822;
++ if (ctx->boundaries != NULL)
++ ctx->parse_next_block = parse_next_body_to_boundary;
++ else
++ ctx->parse_next_block = parse_next_body_to_eof;
++ }
+
+ ctx->want_count = 1;
+
+@@ -1100,6 +1123,8 @@ message_parser_init_int(struct istream *input,
+ ctx = i_new(struct message_parser_ctx, 1);
+ ctx->hdr_flags = hdr_flags;
+ ctx->flags = flags;
++ ctx->max_nested_mime_parts =
++ MESSAGE_PARSER_DEFAULT_MAX_NESTED_MIME_PARTS;
+ ctx->input = input;
+ i_stream_ref(input);
+ return ctx;
+@@ -1159,6 +1184,10 @@ int message_parser_deinit_from_parts(struct message_parser_ctx **_ctx,
+ if (ctx->hdr_parser_ctx != NULL)
+ message_parse_header_deinit(&ctx->hdr_parser_ctx);
+ boundary_remove_until(ctx, NULL);
++ /* caller might have stopped the parsing early */
++ i_assert(ctx->nested_parts_count == 0 ||
++ i_stream_have_bytes_left(ctx->input));
++
+ i_stream_unref(&ctx->input);
+ if (array_is_created(&ctx->next_part_stack))
+ array_free(&ctx->next_part_stack);
+diff --git a/src/lib-mail/test-message-parser.c b/src/lib-mail/test-message-parser.c
+index 94aa3eb7c..481d05942 100644
+--- a/src/lib-mail/test-message-parser.c
++++ b/src/lib-mail/test-message-parser.c
+@@ -166,6 +166,36 @@ static void test_message_parser_small_blocks(void)
+ test_end();
+ }
+
++static void test_message_parser_stop_early(void)
++{
++ struct message_parser_ctx *parser;
++ struct istream *input;
++ struct message_part *parts;
++ struct message_block block;
++ unsigned int i;
++ pool_t pool;
++ int ret;
++
++ test_begin("message parser stop early");
++ pool = pool_alloconly_create("message parser", 10240);
++ input = test_istream_create(test_msg);
++
++ test_istream_set_allow_eof(input, FALSE);
++ for (i = 1; i <= TEST_MSG_LEN+1; i++) {
++ i_stream_seek(input, 0);
++ test_istream_set_size(input, i);
++ parser = message_parser_init(pool, input, 0, 0);
++ while ((ret = message_parser_parse_next_block(parser,
++ &block)) > 0) ;
++ test_assert(ret == 0);
++ message_parser_deinit(&parser, &parts);
++ }
++
++ i_stream_unref(&input);
++ pool_unref(&pool);
++ test_end();
++}
++
+ static void test_message_parser_truncated_mime_headers(void)
+ {
+ static const char input_msg[] =
+@@ -740,6 +770,7 @@ int main(void)
+ {
+ static void (*test_functions[])(void) = {
+ test_message_parser_small_blocks,
++ test_message_parser_stop_early,
+ test_message_parser_truncated_mime_headers,
+ test_message_parser_truncated_mime_headers2,
+ test_message_parser_truncated_mime_headers3,
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0011-lib-mail-message-parser-Support-limiting-max-number-.patch b/meta-networking/recipes-support/dovecot/dovecot/0011-lib-mail-message-parser-Support-limiting-max-number-.patch
new file mode 100644
index 0000000000..52848bf3a7
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0011-lib-mail-message-parser-Support-limiting-max-number-.patch
@@ -0,0 +1,87 @@
+From d7bba401dd234802bcdb55ff27dfb99bffdab804 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 23 Apr 2020 17:09:33 +0300
+Subject: [PATCH 11/13] lib-mail: message-parser - Support limiting max number
+ of MIME parts
+
+The default is to allow 10000 MIME parts. When it's reached, no more
+MIME boundary lines will be recognized, so the rest of the mail belongs
+to the last added MIME part.
+---
+ src/lib-mail/message-parser.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index 721615f76..646307802 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -14,6 +14,7 @@
+ #define BOUNDARY_END_MAX_LEN (BOUNDARY_STRING_MAX_LEN + 2 + 2)
+
+ #define MESSAGE_PARSER_DEFAULT_MAX_NESTED_MIME_PARTS 100
++#define MESSAGE_PARSER_DEFAULT_MAX_TOTAL_MIME_PARTS 10000
+
+ struct message_boundary {
+ struct message_boundary *next;
+@@ -31,10 +32,12 @@ struct message_parser_ctx {
+ struct message_part *parts, *part;
+ const char *broken_reason;
+ unsigned int nested_parts_count;
++ unsigned int total_parts_count;
+
+ enum message_header_parser_flags hdr_flags;
+ enum message_parser_flags flags;
+ unsigned int max_nested_mime_parts;
++ unsigned int max_total_mime_parts;
+
+ char *last_boundary;
+ struct message_boundary *boundaries;
+@@ -211,7 +214,9 @@ message_part_append(struct message_parser_ctx *ctx)
+
+ ctx->part = part;
+ ctx->nested_parts_count++;
++ ctx->total_parts_count++;
+ i_assert(ctx->nested_parts_count < ctx->max_nested_mime_parts);
++ i_assert(ctx->total_parts_count <= ctx->max_total_mime_parts);
+ }
+
+ static void message_part_finish(struct message_parser_ctx *ctx)
+@@ -296,6 +301,12 @@ boundary_line_find(struct message_parser_ctx *ctx,
+ return -1;
+ }
+
++ if (ctx->total_parts_count >= ctx->max_total_mime_parts) {
++ /* can't add any more MIME parts. just stop trying to find
++ more boundaries. */
++ return -1;
++ }
++
+ /* need to find the end of line */
+ data += 2;
+ size -= 2;
+@@ -1125,6 +1136,8 @@ message_parser_init_int(struct istream *input,
+ ctx->flags = flags;
+ ctx->max_nested_mime_parts =
+ MESSAGE_PARSER_DEFAULT_MAX_NESTED_MIME_PARTS;
++ ctx->max_total_mime_parts =
++ MESSAGE_PARSER_DEFAULT_MAX_TOTAL_MIME_PARTS;
+ ctx->input = input;
+ i_stream_ref(input);
+ return ctx;
+@@ -1142,6 +1155,7 @@ message_parser_init(pool_t part_pool, struct istream *input,
+ ctx->parts = ctx->part = p_new(part_pool, struct message_part, 1);
+ ctx->next_part = &ctx->part->children;
+ ctx->parse_next_block = parse_next_header_init;
++ ctx->total_parts_count = 1;
+ i_array_init(&ctx->next_part_stack, 4);
+ return ctx;
+ }
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0012-lib-mail-Fix-handling-trailing-in-MIME-boundaries.patch b/meta-networking/recipes-support/dovecot/dovecot/0012-lib-mail-Fix-handling-trailing-in-MIME-boundaries.patch
new file mode 100644
index 0000000000..a81177d2ba
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0012-lib-mail-Fix-handling-trailing-in-MIME-boundaries.patch
@@ -0,0 +1,133 @@
+From 0c9d56b41b992a868f299e05677a67c4d0495523 Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Thu, 2 Jul 2020 17:31:19 +0300
+Subject: [PATCH 12/13] lib-mail: Fix handling trailing "--" in MIME boundaries
+
+Broken by 5b8ec27fae941d06516c30476dcf4820c6d200ab
+---
+ src/lib-mail/message-parser.c | 14 ++++++++----
+ src/lib-mail/test-message-parser.c | 46 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 56 insertions(+), 4 deletions(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index 646307802..175d4b488 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -75,7 +75,7 @@ static int preparsed_parse_next_header_init(struct message_parser_ctx *ctx,
+
+ static struct message_boundary *
+ boundary_find(struct message_boundary *boundaries,
+- const unsigned char *data, size_t len)
++ const unsigned char *data, size_t len, bool trailing_dashes)
+ {
+ struct message_boundary *best = NULL;
+
+@@ -89,7 +89,11 @@ boundary_find(struct message_boundary *boundaries,
+ memcmp(boundaries->boundary, data, boundaries->len) == 0 &&
+ (best == NULL || best->len < boundaries->len)) {
+ best = boundaries;
+- if (best->len == len) {
++ /* If we see "foo--", it could either mean that there
++ is a boundary named "foo" that ends now or there's
++ a boundary "foo--" which continues. */
++ if (best->len == len ||
++ (best->len == len-2 && trailing_dashes)) {
+ /* This is exactly the wanted boundary. There
+ can't be a better one. */
+ break;
+@@ -319,6 +323,7 @@ boundary_line_find(struct message_parser_ctx *ctx,
+ return 0;
+ }
+ size_t find_size = size;
++ bool trailing_dashes = FALSE;
+
+ if (lf_pos != NULL) {
+ find_size = lf_pos - data;
+@@ -326,11 +331,12 @@ boundary_line_find(struct message_parser_ctx *ctx,
+ find_size--;
+ if (find_size > 2 && data[find_size-1] == '-' &&
+ data[find_size-2] == '-')
+- find_size -= 2;
++ trailing_dashes = TRUE;
+ } else if (find_size > BOUNDARY_END_MAX_LEN)
+ find_size = BOUNDARY_END_MAX_LEN;
+
+- *boundary_r = boundary_find(ctx->boundaries, data, find_size);
++ *boundary_r = boundary_find(ctx->boundaries, data, find_size,
++ trailing_dashes);
+ if (*boundary_r == NULL)
+ return -1;
+
+diff --git a/src/lib-mail/test-message-parser.c b/src/lib-mail/test-message-parser.c
+index 481d05942..113454ea0 100644
+--- a/src/lib-mail/test-message-parser.c
++++ b/src/lib-mail/test-message-parser.c
+@@ -510,6 +510,51 @@ static const char input_msg[] =
+ test_end();
+ }
+
++static void test_message_parser_trailing_dashes(void)
++{
++static const char input_msg[] =
++"Content-Type: multipart/mixed; boundary=\"a--\"\n"
++"\n"
++"--a--\n"
++"Content-Type: multipart/mixed; boundary=\"a----\"\n"
++"\n"
++"--a----\n"
++"Content-Type: text/plain\n"
++"\n"
++"body\n"
++"--a------\n"
++"Content-Type: text/html\n"
++"\n"
++"body2\n"
++"--a----";
++ struct message_parser_ctx *parser;
++ struct istream *input;
++ struct message_part *parts;
++ struct message_block block;
++ pool_t pool;
++ int ret;
++
++ test_begin("message parser trailing dashes");
++ pool = pool_alloconly_create("message parser", 10240);
++ input = test_istream_create(input_msg);
++
++ parser = message_parser_init(pool, input, 0, 0);
++ while ((ret = message_parser_parse_next_block(parser, &block)) > 0) ;
++ test_assert(ret < 0);
++ message_parser_deinit(&parser, &parts);
++
++ test_assert(parts->children_count == 2);
++ test_assert(parts->children->next == NULL);
++ test_assert(parts->children->children_count == 1);
++ test_assert(parts->children->children->next == NULL);
++ test_assert(parts->children->children->children_count == 0);
++
++ test_parsed_parts(input, parts);
++ i_stream_unref(&input);
++ pool_unref(&pool);
++ test_end();
++}
++
+ static void test_message_parser_continuing_mime_boundary(void)
+ {
+ static const char input_msg[] =
+@@ -777,6 +822,7 @@ int main(void)
+ test_message_parser_empty_multipart,
+ test_message_parser_duplicate_mime_boundary,
+ test_message_parser_garbage_suffix_mime_boundary,
++ test_message_parser_trailing_dashes,
+ test_message_parser_continuing_mime_boundary,
+ test_message_parser_continuing_truncated_mime_boundary,
+ test_message_parser_long_mime_boundary,
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/0013-lib-mail-Fix-parse_too_many_nested_mime_parts.patch b/meta-networking/recipes-support/dovecot/dovecot/0013-lib-mail-Fix-parse_too_many_nested_mime_parts.patch
new file mode 100644
index 0000000000..97068345fb
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/0013-lib-mail-Fix-parse_too_many_nested_mime_parts.patch
@@ -0,0 +1,32 @@
+From f77a2b6c3ffe2ea96f4a4b05ec38dc9d53266ecb Mon Sep 17 00:00:00 2001
+From: Timo Sirainen <timo.sirainen@...>
+Date: Wed, 27 May 2020 11:35:55 +0300
+Subject: [PATCH 13/13] lib-mail: Fix parse_too_many_nested_mime_parts()
+
+This was originally correct, until it was "optimized" wrong and got merged.
+---
+ src/lib-mail/message-parser.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c
+index 175d4b488..5b11772ff 100644
+--- a/src/lib-mail/message-parser.c
++++ b/src/lib-mail/message-parser.c
+@@ -621,7 +621,7 @@ static bool block_is_at_eoh(const struct message_block *block)
+
+ static bool parse_too_many_nested_mime_parts(struct message_parser_ctx *ctx)
+ {
+- return ctx->nested_parts_count > ctx->max_nested_mime_parts;
++ return ctx->nested_parts_count+1 >= ctx->max_nested_mime_parts;
+ }
+
+ #define MUTEX_FLAGS \
+--
+2.11.0
+
diff --git a/meta-networking/recipes-support/dovecot/dovecot/buffer_free_fix.patch b/meta-networking/recipes-support/dovecot/dovecot/buffer_free_fix.patch
new file mode 100644
index 0000000000..44f6564f89
--- /dev/null
+++ b/meta-networking/recipes-support/dovecot/dovecot/buffer_free_fix.patch
@@ -0,0 +1,27 @@
+From 1a6ff0beebf0ab0c71081eaff1d5d7fd26015a94 Mon Sep 17 00:00:00 2001
+From: Josef 'Jeff' Sipek <jeff.sipek@...>
+Date: Tue, 19 Sep 2017 13:26:57 +0300
+Subject: [PATCH] lib: buffer_free(NULL) should be a no-op
+
+---
+ src/lib/buffer.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+Signed-off-by: Sana Kazi <Sana.Kazi@...>
+
+CVE: CVE-2020-12100
+Upstream-Status: Backport [http://archive.ubuntu.com/ubuntu/pool/main/d/dovecot/dovecot_2.2.33.2-1ubuntu4.7.debian.tar.xz]
+Comment: No change in any hunk
+
+--- a/src/lib/buffer.c
++++ b/src/lib/buffer.c
+@@ -148,6 +148,9 @@ void buffer_free(buffer_t **_buf)
+ {
+ struct real_buffer *buf = (struct real_buffer *)*_buf;
+
++ if (buf == NULL)
++ return;
++
+ *_buf = NULL;
+ if (buf->alloced)
+ p_free(buf->pool, buf->w_buffer);
diff --git a/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb b/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
index e21a94ad64..407604c819 100644
--- a/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
+++ b/meta-networking/recipes-support/dovecot/dovecot_2.2.36.4.bb
@@ -10,6 +10,20 @@ SRC_URI = "http://dovecot.org/releases/2.2/dovecot-${PV}.tar.gz \
file://dovecot.service \
file://dovecot.socket \
file://0001-doveadm-Fix-parallel-build.patch \
+ file://0001-lib-mail-message-parser-Add-a-message_part_finish-he.patch \
+ file://0002-lib-mail-message-parser-Change-message_part_append-t.patch \
+ file://0003-lib-mail-message-parser-Optimize-updating-children_c.patch \
+ file://0004-lib-mail-message-parser-Optimize-appending-new-part-.patch \
+ file://0005-lib-mail-message-parser-Minor-code-cleanup-to-findin.patch \
+ file://0006-lib-mail-message-parser-Truncate-excessively-long-MI.patch \
+ file://0007-lib-mail-message-parser-Optimize-boundary-lookups-wh.patch \
+ file://0008-lib-mail-message-parser-Add-boundary_remove_until-he.patch \
+ file://0009-lib-mail-message-parser-Don-t-use-memory-pool-for-pa.patch \
+ file://0010-lib-mail-message-parser-Support-limiting-max-number-.patch \
+ file://0011-lib-mail-message-parser-Support-limiting-max-number-.patch \
+ file://0012-lib-mail-Fix-handling-trailing-in-MIME-boundaries.patch \
+ file://0013-lib-mail-Fix-parse_too_many_nested_mime_parts.patch \
+ file://buffer_free_fix.patch \
"

SRC_URI[md5sum] = "66c4d71858b214afee5b390ee602dee2"
--
2.17.1


[PATCH] libid3tag: add from oe-core

Alexander Kanavin
 

Signed-off-by: Alexander Kanavin <alex@...>
---
.../0001-Fix-gperf-3.1-incompatibility.patch | 40 +++++++++++++++++
.../libid3tag/libid3tag/10_utf16.patch | 34 +++++++++++++++
.../libid3tag/libid3tag/addpkgconfig.patch | 43 +++++++++++++++++++
.../libid3tag/libid3tag/cflags_filter.patch | 19 ++++++++
.../libid3tag/obsolete_automake_macros.patch | 15 +++++++
.../libid3tag/unknown-encoding.patch | 39 +++++++++++++++++
.../libid3tag/libid3tag_0.15.1b.bb | 28 ++++++++++++
7 files changed, 218 insertions(+)
create mode 100644 meta-oe/recipes-multimedia/libid3tag/libid3tag/0001-Fix-gperf-3.1-incompatibility.patch
create mode 100644 meta-oe/recipes-multimedia/libid3tag/libid3tag/10_utf16.patch
create mode 100644 meta-oe/recipes-multimedia/libid3tag/libid3tag/addpkgconfig.patch
create mode 100644 meta-oe/recipes-multimedia/libid3tag/libid3tag/cflags_filter.patch
create mode 100644 meta-oe/recipes-multimedia/libid3tag/libid3tag/obsolete_automake_macros.patch
create mode 100644 meta-oe/recipes-multimedia/libid3tag/libid3tag/unknown-encoding.patch
create mode 100644 meta-oe/recipes-multimedia/libid3tag/libid3tag_0.15.1b.bb

diff --git a/meta-oe/recipes-multimedia/libid3tag/libid3tag/0001-Fix-gperf-3.1-incompatibility.patch b/meta-oe/recipes-multimedia/libid3tag/libid3tag/0001-Fix-gperf-3.1-incompatibility.patch
new file mode 100644
index 000000000..54f49f6f2
--- /dev/null
+++ b/meta-oe/recipes-multimedia/libid3tag/libid3tag/0001-Fix-gperf-3.1-incompatibility.patch
@@ -0,0 +1,40 @@
+From 91fcf66b9182c75cd2b96d88991d5a1c6307d4b4 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@...>
+Date: Wed, 2 Aug 2017 16:27:52 +0300
+Subject: [PATCH] Fix gperf 3.1 incompatibility.
+
+Upstream-Status: Pending
+Signed-off-by: Alexander Kanavin <alex.kanavin@...>
+---
+ compat.h | 2 +-
+ frametype.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/compat.h b/compat.h
+index 8af71ec..b3d80d9 100644
+--- a/compat.h
++++ b/compat.h
+@@ -34,7 +34,7 @@ struct id3_compat {
+ };
+
+ struct id3_compat const *id3_compat_lookup(register char const *,
+- register unsigned int);
++ register size_t);
+
+ int id3_compat_fixup(struct id3_tag *);
+
+diff --git a/frametype.h b/frametype.h
+index dd064b2..b5b7593 100644
+--- a/frametype.h
++++ b/frametype.h
+@@ -37,6 +37,6 @@ extern struct id3_frametype const id3_frametype_unknown;
+ extern struct id3_frametype const id3_frametype_obsolete;
+
+ struct id3_frametype const *id3_frametype_lookup(register char const *,
+- register unsigned int);
++ register size_t);
+
+ # endif
+--
+2.13.2
+
diff --git a/meta-oe/recipes-multimedia/libid3tag/libid3tag/10_utf16.patch b/meta-oe/recipes-multimedia/libid3tag/libid3tag/10_utf16.patch
new file mode 100644
index 000000000..10e089018
--- /dev/null
+++ b/meta-oe/recipes-multimedia/libid3tag/libid3tag/10_utf16.patch
@@ -0,0 +1,34 @@
+libid3tag: patch for CVE-2004-2779
+
+The patch comes from
+https://sources.debian.org/patches/libid3tag/0.15.1b-13/10_utf16.dpatch
+
+Upstream-Status: Pending
+
+CVE: CVE-2004-2779
+CVE: CVE-2017-11551
+
+Signed-off-by: Changqing Li <changqing.li@...>
+
+diff -urNad libid3tag-0.15.1b/utf16.c /tmp/dpep.tKvO7a/libid3tag-0.15.1b/utf16.c
+--- libid3tag-0.15.1b/utf16.c 2006-01-13 15:26:29.000000000 +0100
++++ /tmp/dpep.tKvO7a/libid3tag-0.15.1b/utf16.c 2006-01-13 15:27:19.000000000 +0100
+@@ -282,5 +282,18 @@
+
+ free(utf16);
+
++ if (end == *ptr && length % 2 != 0)
++ {
++ /* We were called with a bogus length. It should always
++ * be an even number. We can deal with this in a few ways:
++ * - Always give an error.
++ * - Try and parse as much as we can and
++ * - return an error if we're called again when we
++ * already tried to parse everything we can.
++ * - tell that we parsed it, which is what we do here.
++ */
++ (*ptr)++;
++ }
++
+ return ucs4;
+ }
diff --git a/meta-oe/recipes-multimedia/libid3tag/libid3tag/addpkgconfig.patch b/meta-oe/recipes-multimedia/libid3tag/libid3tag/addpkgconfig.patch
new file mode 100644
index 000000000..38d40c363
--- /dev/null
+++ b/meta-oe/recipes-multimedia/libid3tag/libid3tag/addpkgconfig.patch
@@ -0,0 +1,43 @@
+Upstream-Status: Inappropriate [configuration]
+
+Index: libid3tag-0.15.1b/Makefile.am
+===================================================================
+--- libid3tag-0.15.1b.orig/Makefile.am 2009-07-29 09:29:20.000000000 +0100
++++ libid3tag-0.15.1b/Makefile.am 2009-07-29 09:29:47.000000000 +0100
+@@ -27,6 +27,9 @@
+ lib_LTLIBRARIES = libid3tag.la
+ include_HEADERS = id3tag.h
+
++pkgconfigdir = $(libdir)/pkgconfig
++pkgconfig_DATA = id3tag.pc
++
+ ## From the libtool documentation on library versioning:
+ ##
+ ## CURRENT
+Index: libid3tag-0.15.1b/configure.ac
+===================================================================
+--- libid3tag-0.15.1b.orig/configure.ac 2009-07-29 09:27:15.000000000 +0100
++++ libid3tag-0.15.1b/configure.ac 2009-07-29 09:27:45.000000000 +0100
+@@ -201,5 +201,5 @@
+ dnl AC_SUBST(LTLIBOBJS)
+
+ AC_CONFIG_FILES([Makefile msvc++/Makefile \
+- libid3tag.list])
++ libid3tag.list id3tag.pc])
+ AC_OUTPUT
+Index: libid3tag-0.15.1b/id3tag.pc.in
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ libid3tag-0.15.1b/id3tag.pc.in 2009-07-29 09:29:10.000000000 +0100
+@@ -0,0 +1,11 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: id3tag
++Description: ID3 tag reading library
++Requires:
++Version: @VERSION@
++Libs: -L${libdir} -lid3tag -lz
++Cflags: -I${includedir}
diff --git a/meta-oe/recipes-multimedia/libid3tag/libid3tag/cflags_filter.patch b/meta-oe/recipes-multimedia/libid3tag/libid3tag/cflags_filter.patch
new file mode 100644
index 000000000..1895748d1
--- /dev/null
+++ b/meta-oe/recipes-multimedia/libid3tag/libid3tag/cflags_filter.patch
@@ -0,0 +1,19 @@
+configure contains CFLAGS filtering code which was removing our prefix-map
+flags. We need those to generate reproducible binaries. Allow them through.
+
+Upstream-Status: Pending
+Signed-off-by: Richard Purdie <richard.purdie@...>
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -99,6 +99,10 @@ do
+ -mno-cygwin)
+ shift
+ ;;
++ -fmacro-prefix-map*|-fdebug-prefix-map*|-ffile-prefix-map*)
++ CFLAGS="$CFLAGS $1"
++ shift
++ ;;
+ -m*)
+ arch="$arch $1"
+ shift
diff --git a/meta-oe/recipes-multimedia/libid3tag/libid3tag/obsolete_automake_macros.patch b/meta-oe/recipes-multimedia/libid3tag/libid3tag/obsolete_automake_macros.patch
new file mode 100644
index 000000000..2845fb1d3
--- /dev/null
+++ b/meta-oe/recipes-multimedia/libid3tag/libid3tag/obsolete_automake_macros.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Submitted [https://sourceforge.net/tracker/?func=detail&aid=3599280&group_id=12349&atid=112349]
+
+Signed-off-by: Marko Lindqvist <cazfi74@...>
+diff -Nurd libid3tag-0.15.1b/configure.ac libid3tag-0.15.1b/configure.ac
+--- libid3tag-0.15.1b/configure.ac 2004-01-24 01:22:46.000000000 +0200
++++ libid3tag-0.15.1b/configure.ac 2013-01-03 06:41:02.734835014 +0200
+@@ -28,7 +28,7 @@
+
+-AM_INIT_AUTOMAKE
++AM_INIT_AUTOMAKE([foreign])
+
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+
+ dnl System type.
diff --git a/meta-oe/recipes-multimedia/libid3tag/libid3tag/unknown-encoding.patch b/meta-oe/recipes-multimedia/libid3tag/libid3tag/unknown-encoding.patch
new file mode 100644
index 000000000..f0867b5f0
--- /dev/null
+++ b/meta-oe/recipes-multimedia/libid3tag/libid3tag/unknown-encoding.patch
@@ -0,0 +1,39 @@
+In case of an unknown/invalid encoding, id3_parse_string() will
+return NULL, but the return value wasn't checked resulting
+in segfault in id3_ucs4_length(). This is the only place
+the return value wasn't checked.
+
+Patch taken from Debian:
+https://sources.debian.org/patches/libid3tag/0.15.1b-14/11_unknown_encoding.dpatch/
+
+CVE: CVE-2017-11550
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@...>
+
+diff -urNad libid3tag-0.15.1b~/compat.gperf libid3tag-0.15.1b/compat.gperf
+--- libid3tag-0.15.1b~/compat.gperf 2004-01-23 09:41:32.000000000 +0000
++++ libid3tag-0.15.1b/compat.gperf 2007-01-14 14:36:53.000000000 +0000
+@@ -236,6 +236,10 @@
+
+ encoding = id3_parse_uint(&data, 1);
+ string = id3_parse_string(&data, end - data, encoding, 0);
++ if (!string)
++ {
++ continue;
++ }
+
+ if (id3_ucs4_length(string) < 4) {
+ free(string);
+diff -urNad libid3tag-0.15.1b~/parse.c libid3tag-0.15.1b/parse.c
+--- libid3tag-0.15.1b~/parse.c 2004-01-23 09:41:32.000000000 +0000
++++ libid3tag-0.15.1b/parse.c 2007-01-14 14:37:34.000000000 +0000
+@@ -165,6 +165,9 @@
+ case ID3_FIELD_TEXTENCODING_UTF_8:
+ ucs4 = id3_utf8_deserialize(ptr, length);
+ break;
++ default:
++ /* FIXME: Unknown encoding! Print warning? */
++ return NULL;
+ }
+
+ if (ucs4 && !full) {
diff --git a/meta-oe/recipes-multimedia/libid3tag/libid3tag_0.15.1b.bb b/meta-oe/recipes-multimedia/libid3tag/libid3tag_0.15.1b.bb
new file mode 100644
index 000000000..80581765a
--- /dev/null
+++ b/meta-oe/recipes-multimedia/libid3tag/libid3tag_0.15.1b.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Library for interacting with ID3 tags in MP3 files"
+HOMEPAGE = "http://sourceforge.net/projects/mad/"
+BUGTRACKER = "http://sourceforge.net/tracker/?group_id=12349&atid=112349"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
+ file://COPYRIGHT;md5=5e6279efb87c26c6e5e7a68317a6a87a \
+ file://version.h;beginline=1;endline=8;md5=86ac68b67f054b7afde9e149bbc3fe63"
+SECTION = "libs"
+DEPENDS = "zlib gperf-native"
+PR = "r7"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/mad/libid3tag-${PV}.tar.gz \
+ file://addpkgconfig.patch \
+ file://obsolete_automake_macros.patch \
+ file://0001-Fix-gperf-3.1-incompatibility.patch \
+ file://10_utf16.patch \
+ file://unknown-encoding.patch \
+ file://cflags_filter.patch \
+ "
+UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/mad/files/libid3tag/"
+UPSTREAM_CHECK_REGEX = "/projects/mad/files/libid3tag/(?P<pver>.*)/$"
+
+SRC_URI[md5sum] = "e5808ad997ba32c498803822078748c3"
+SRC_URI[sha256sum] = "63da4f6e7997278f8a3fef4c6a372d342f705051d1eeb6a46a86b03610e26151"
+
+S = "${WORKDIR}/libid3tag-${PV}"
+
+inherit autotools pkgconfig
--
2.20.1