Date   

Re: [kirkstone 06/31] tiff: fix CVE-2022-2953

Shubham Kulkarni
 

Hi Zheng,

Can you please clear my confusion, if possible.

Thanks,
Shubham

On Mon, Nov 7, 2022 at 7:49 PM Steve Sakoman <steve@...> wrote:
Hello Zheng,

Could you respond to Shubham's question on your patch?

Thanks,

Steve

On Sun, Nov 6, 2022 at 11:10 PM Shubham Kulkarni <skulkarni@...> wrote:
>
> Hello, I am new to this community and trying to understand the CVE patch fixing process. Kindly correct me if I am wrong with my understanding.
>
> So, this patch is fixing the code present in the file tools/tiffcrop.c . I can see this patch is having combined changes from following commits:
>
> 1] https://gitlab.com/libtiff/libtiff/-/commit/e319508 - tiffcrop: Fix issue #330 and some more from 320 to 349
> 2] https://gitlab.com/libtiff/libtiff/-/commit/8fe3735  - According to Richard Nolde #401 (comment 877637400)
> 3] https://gitlab.com/libtiff/libtiff/-/commit/bad48e9 - tiffcrop -S option: Make decision simpler.
>
> Debian website for this CVE (https://security-tracker.debian.org/tracker/CVE-2022-2953) suggests commits "2]" & "3]" as a fix. And both "2]" & "3]" fixes the code introduced by commit "1]". So, can we say that the vulnerability was introduced by commit "1]" , and solved by "2]" & "3]" ?
>
> If yes, then as per my understanding, there is no need of fixing, as vulnerability itself is not present in current code and it's Not Affected by the CVE. But this patch is introducing the vulnerability ("1]") and on top of it, fixing the same ("2]" & "3]"). Is it required Or can we just say that this version of code/tiff package is not affected by this CVE?
> Please rectify my understanding.
>
> Thanks in Advance,
> Shubham
>
>
> On Fri, Nov 4, 2022 at 8:31 AM Steve Sakoman <steve@...> wrote:
>>
>> From: Zheng Qiu <zheng.qiu@...>
>>
>> While this does not happen with the tiff 4.3.0 release, it does happen with
>> the series of patches we have, so backport the two simple changes that
>> restrict the tiffcrop options to avoid the vulnerability.
>>
>> CVE-2022-2953.patch was taken from upstream, and a small typo was fixed
>> for the CVE number. The other patch is included in tiff 4.4.0 but not
>> 4.3.0, so add it as well.
>>
>> Signed-off-by: Randy MacLeod <randy.macleod@...>
>> Signed-off-by: Zheng Qiu <zheng.qiu@...>
>> Signed-off-by: Steve Sakoman <steve@...>
>> ---
>>  ...ue-330-and-some-more-from-320-to-349.patch | 609 ++++++++++++++++++
>>  .../libtiff/tiff/CVE-2022-2953.patch          |  87 +++
>>  meta/recipes-multimedia/libtiff/tiff_4.3.0.bb |   2 +
>>  3 files changed, 698 insertions(+)
>>  create mode 100644 meta/recipes-multimedia/libtiff/tiff/0001-tiffcrop-Fix-issue-330-and-some-more-from-320-to-349.patch
>>  create mode 100644 meta/recipes-multimedia/libtiff/tiff/CVE-2022-2953.patch
>>
>> diff --git a/meta/recipes-multimedia/libtiff/tiff/0001-tiffcrop-Fix-issue-330-and-some-more-from-320-to-349.patch b/meta/recipes-multimedia/libtiff/tiff/0001-tiffcrop-Fix-issue-330-and-some-more-from-320-to-349.patch
>> new file mode 100644
>> index 0000000000..07acf5eb90
>> --- /dev/null
>> +++ b/meta/recipes-multimedia/libtiff/tiff/0001-tiffcrop-Fix-issue-330-and-some-more-from-320-to-349.patch
>> @@ -0,0 +1,609 @@
>> +From e319508023580e2f70e6e626f745b5b2a1707313 Mon Sep 17 00:00:00 2001
>> +From: Su Laus <sulau@...>
>> +Date: Tue, 10 May 2022 20:03:17 +0000
>> +Subject: [PATCH] tiffcrop: Fix issue #330 and some more from 320 to 349
>> +Upstream-Status: Backport
>> +Signed-off-by: Zheng Qiu <zheng.qiu@...>
>> +---
>> + tools/tiffcrop.c | 282 +++++++++++++++++++++++++++++++++++------------
>> + 1 file changed, 210 insertions(+), 72 deletions(-)
>> +
>> +diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
>> +index 77cf6ed1..791ec5e7 100644
>> +--- a/tools/tiffcrop.c
>> ++++ b/tools/tiffcrop.c
>> +@@ -63,20 +63,24 @@
>> +  *                units when sectioning image into columns x rows
>> +  *                using the -S cols:rows option.
>> +  * -X #           Horizontal dimension of region to extract expressed in current
>> +- *                units
>> ++ *                units, relative to the specified origin reference 'edge' left (default for X) or right.
>> +  * -Y #           Vertical dimension of region to extract expressed in current
>> +- *                units
>> ++ *                units, relative to the specified origin reference 'edge' top (default for Y) or bottom.
>> +  * -O orient      Orientation for output image, portrait, landscape, auto
>> +  * -P page        Page size for output image segments, eg letter, legal, tabloid,
>> +  *                etc.
>> +  * -S cols:rows   Divide the image into equal sized segments using cols across
>> +  *                and rows down
>> +- * -E t|l|r|b     Edge to use as origin
>> ++ * -E t|l|r|b     Edge to use as origin (i.e. 'side' of the image not 'corner')
>> ++ *                  top    = width from left, zones from top to bottom (default)
>> ++ *                  bottom = width from left, zones from bottom to top
>> ++ *                  left   = zones from left to right, length from top
>> ++ *                  right  = zones from right to left, length from top
>> +  * -m #,#,#,#     Margins from edges for selection: top, left, bottom, right
>> +  *                (commas separated)
>> +  * -Z #:#,#:#     Zones of the image designated as zone X of Y,
>> +  *                eg 1:3 would be first of three equal portions measured
>> +- *                from reference edge
>> ++ *                from reference edge (i.e. 'side' not corner)
>> +  * -N odd|even|#,#-#,#|last
>> +  *                Select sequences and/or ranges of images within file
>> +  *                to process. The words odd or even may be used to specify
>> +@@ -103,10 +107,13 @@
>> +  *                selects which functions dump data, with higher numbers selecting
>> +  *                lower level, scanline level routines. Debug reports a limited set
>> +  *                of messages to monitor progress without enabling dump logs.
>> ++ *
>> ++ * Note:    The (-X|-Y), -Z and -z options are mutually exclusive.
>> ++ *          In no case should the options be applied to a given selection successively.
>> +  */
>> +
>> +-static   char tiffcrop_version_id[] = "2.4.1";
>> +-static   char tiffcrop_rev_date[] = "03-03-2010";
>> ++static   char tiffcrop_version_id[] = "2.5";
>> ++static   char tiffcrop_rev_date[] = "02-09-2022";
>> +
>> + #include "tif_config.h"
>> + #include "libport.h"
>> +@@ -774,6 +781,9 @@ static const char usage_info[] =
>> + "             The four debug/dump options are independent, though it makes little sense to\n"
>> + "             specify a dump file without specifying a detail level.\n"
>> + "\n"
>> ++"Note:        The (-X|-Y), -Z and -z options are mutually exclusive.\n"
>> ++"             In no case should the options be applied to a given selection successively.\n"
>> ++"\n"
>> + ;
>> +
>> + /* This function could be modified to pass starting sample offset
>> +@@ -2121,6 +2131,15 @@ void  process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
>> +               /*NOTREACHED*/
>> +       }
>> +     }
>> ++    /*-- Check for not allowed combinations (e.g. -X, -Y and -Z and -z are mutually exclusive) --*/
>> ++    char XY, Z, R;
>> ++    XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH));
>> ++    Z = (crop_data->crop_mode & CROP_ZONES);
>> ++    R = (crop_data->crop_mode & CROP_REGIONS);
>> ++    if ((XY && Z) || (XY && R) || (Z && R)) {
>> ++        TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z and -z are mutually exclusive.->Exit");
>> ++        exit(EXIT_FAILURE);
>> ++    }
>> +   }  /* end process_command_opts */
>> +
>> + /* Start a new output file if one has not been previously opened or
>> +@@ -2746,7 +2765,7 @@ extractContigSamplesBytes (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                            tsample_t count, uint32_t start, uint32_t end)
>> +   {
>> +   int i, bytes_per_sample, sindex;
>> +-  uint32_t col, dst_rowsize, bit_offset;
>> ++  uint32_t col, dst_rowsize, bit_offset, numcols;
>> +   uint32_t src_byte /*, src_bit */;
>> +   uint8_t *src = in;
>> +   uint8_t *dst = out;
>> +@@ -2757,6 +2776,10 @@ extractContigSamplesBytes (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     return (1);
>> +     }
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamplesBytes",
>> +@@ -2769,6 +2792,9 @@ extractContigSamplesBytes (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> +
>> +   dst_rowsize = (bps * (end - start) * count) / 8;
>> +
>> +@@ -2812,7 +2838,7 @@ extractContigSamples8bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                            tsample_t count, uint32_t start, uint32_t end)
>> +   {
>> +   int    ready_bits = 0, sindex = 0;
>> +-  uint32_t col, src_byte, src_bit, bit_offset;
>> ++  uint32_t col, src_byte, src_bit, bit_offset, numcols;
>> +   uint8_t  maskbits = 0, matchbits = 0;
>> +   uint8_t  buff1 = 0, buff2 = 0;
>> +   uint8_t *src = in;
>> +@@ -2824,6 +2850,10 @@ extractContigSamples8bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     return (1);
>> +     }
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamples8bits",
>> +@@ -2836,7 +2866,10 @@ extractContigSamples8bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> +-
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> ++
>> +   ready_bits = 0;
>> +   maskbits =  (uint8_t)-1 >> (8 - bps);
>> +   buff1 = buff2 = 0;
>> +@@ -2889,7 +2922,7 @@ extractContigSamples16bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                             tsample_t count, uint32_t start, uint32_t end)
>> +   {
>> +   int    ready_bits = 0, sindex = 0;
>> +-  uint32_t col, src_byte, src_bit, bit_offset;
>> ++  uint32_t col, src_byte, src_bit, bit_offset, numcols;
>> +   uint16_t maskbits = 0, matchbits = 0;
>> +   uint16_t buff1 = 0, buff2 = 0;
>> +   uint8_t  bytebuff = 0;
>> +@@ -2902,6 +2935,10 @@ extractContigSamples16bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     return (1);
>> +     }
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamples16bits",
>> +@@ -2914,6 +2951,9 @@ extractContigSamples16bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> +
>> +   ready_bits = 0;
>> +   maskbits = (uint16_t)-1 >> (16 - bps);
>> +@@ -2978,7 +3018,7 @@ extractContigSamples24bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                             tsample_t count, uint32_t start, uint32_t end)
>> +   {
>> +   int    ready_bits = 0, sindex = 0;
>> +-  uint32_t col, src_byte, src_bit, bit_offset;
>> ++  uint32_t col, src_byte, src_bit, bit_offset, numcols;
>> +   uint32_t maskbits = 0, matchbits = 0;
>> +   uint32_t buff1 = 0, buff2 = 0;
>> +   uint8_t  bytebuff1 = 0, bytebuff2 = 0;
>> +@@ -2991,6 +3031,10 @@ extractContigSamples24bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     return (1);
>> +     }
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamples24bits",
>> +@@ -3003,6 +3047,9 @@ extractContigSamples24bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> +
>> +   ready_bits = 0;
>> +   maskbits =  (uint32_t)-1 >> (32 - bps);
>> +@@ -3087,7 +3134,7 @@ extractContigSamples32bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                             tsample_t count, uint32_t start, uint32_t end)
>> +   {
>> +   int    ready_bits = 0, sindex = 0 /*, shift_width = 0 */;
>> +-  uint32_t col, src_byte, src_bit, bit_offset;
>> ++  uint32_t col, src_byte, src_bit, bit_offset, numcols;
>> +   uint32_t longbuff1 = 0, longbuff2 = 0;
>> +   uint64_t maskbits = 0, matchbits = 0;
>> +   uint64_t buff1 = 0, buff2 = 0, buff3 = 0;
>> +@@ -3102,6 +3149,10 @@ extractContigSamples32bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     }
>> +
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamples32bits",
>> +@@ -3114,6 +3165,9 @@ extractContigSamples32bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> +
>> +   /* shift_width = ((bps + 7) / 8) + 1; */
>> +   ready_bits = 0;
>> +@@ -3193,7 +3247,7 @@ extractContigSamplesShifted8bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                                   int shift)
>> +   {
>> +   int    ready_bits = 0, sindex = 0;
>> +-  uint32_t col, src_byte, src_bit, bit_offset;
>> ++  uint32_t col, src_byte, src_bit, bit_offset, numcols;
>> +   uint8_t  maskbits = 0, matchbits = 0;
>> +   uint8_t  buff1 = 0, buff2 = 0;
>> +   uint8_t *src = in;
>> +@@ -3205,6 +3259,10 @@ extractContigSamplesShifted8bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     return (1);
>> +     }
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamplesShifted8bits",
>> +@@ -3217,6 +3275,9 @@ extractContigSamplesShifted8bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> +
>> +   ready_bits = shift;
>> +   maskbits =  (uint8_t)-1 >> (8 - bps);
>> +@@ -3273,7 +3334,7 @@ extractContigSamplesShifted16bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                                    int shift)
>> +   {
>> +   int    ready_bits = 0, sindex = 0;
>> +-  uint32_t col, src_byte, src_bit, bit_offset;
>> ++  uint32_t col, src_byte, src_bit, bit_offset, numcols;
>> +   uint16_t maskbits = 0, matchbits = 0;
>> +   uint16_t buff1 = 0, buff2 = 0;
>> +   uint8_t  bytebuff = 0;
>> +@@ -3286,6 +3347,10 @@ extractContigSamplesShifted16bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     return (1);
>> +     }
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamplesShifted16bits",
>> +@@ -3298,6 +3363,9 @@ extractContigSamplesShifted16bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> +
>> +   ready_bits = shift;
>> +   maskbits = (uint16_t)-1 >> (16 - bps);
>> +@@ -3363,7 +3431,7 @@ extractContigSamplesShifted24bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                                    int shift)
>> +   {
>> +   int    ready_bits = 0, sindex = 0;
>> +-  uint32_t col, src_byte, src_bit, bit_offset;
>> ++  uint32_t col, src_byte, src_bit, bit_offset, numcols;
>> +   uint32_t maskbits = 0, matchbits = 0;
>> +   uint32_t buff1 = 0, buff2 = 0;
>> +   uint8_t  bytebuff1 = 0, bytebuff2 = 0;
>> +@@ -3376,6 +3444,16 @@ extractContigSamplesShifted24bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     return (1);
>> +     }
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  /*--- Remark, which is true for all those functions extractCongigSamplesXXX() --
>> ++  *  The mitigation of the start/end test does not allways make sense, because the function is often called with e.g.:
>> ++  *  start = 31; end = 32; cols = 32  to extract the last column in a 32x32 sample image.
>> ++  *  If then, a worng parameter (e.g. cols = 10) is provided, the mitigated settings would be start=0; end=1.
>> ++  *  Therefore, an error message and no copy action might be the better reaction to wrong parameter configurations.
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamplesShifted24bits",
>> +@@ -3388,6 +3466,9 @@ extractContigSamplesShifted24bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> +
>> +   ready_bits = shift;
>> +   maskbits =  (uint32_t)-1 >> (32 - bps);
>> +@@ -3449,7 +3530,7 @@ extractContigSamplesShifted24bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     buff2 = (buff2 << 8);
>> +     bytebuff2 = bytebuff1;
>> +     ready_bits -= 8;
>> +-    }
>> ++  }
>> +
>> +   return (0);
>> +   } /* end extractContigSamplesShifted24bits */
>> +@@ -3461,7 +3542,7 @@ extractContigSamplesShifted32bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                                    int shift)
>> +   {
>> +   int    ready_bits = 0, sindex = 0 /*, shift_width = 0 */;
>> +-  uint32_t col, src_byte, src_bit, bit_offset;
>> ++  uint32_t col, src_byte, src_bit, bit_offset, numcols;
>> +   uint32_t longbuff1 = 0, longbuff2 = 0;
>> +   uint64_t maskbits = 0, matchbits = 0;
>> +   uint64_t buff1 = 0, buff2 = 0, buff3 = 0;
>> +@@ -3476,6 +3557,10 @@ extractContigSamplesShifted32bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +     }
>> +
>> +
>> ++  /* Number of extracted columns shall be kept as (end-start + 1). Otherwise buffer-overflow might occur.
>> ++   * 'start' and 'col' count from 0 to (cols-1)  but 'end' is to be set one after the index of the last column to be copied!
>> ++   */
>> ++  numcols = abs(end - start);
>> +   if ((start > end) || (start > cols))
>> +     {
>> +     TIFFError ("extractContigSamplesShifted32bits",
>> +@@ -3488,6 +3573,9 @@ extractContigSamplesShifted32bits (uint8_t *in, uint8_t *out, uint32_t cols,
>> +                "Invalid end column value %"PRIu32" ignored", end);
>> +     end = cols;
>> +     }
>> ++  if (abs(end - start) > numcols) {
>> ++      end = start + numcols;
>> ++  }
>> +
>> +   /* shift_width = ((bps + 7) / 8) + 1; */
>> +   ready_bits = shift;
>> +@@ -5429,7 +5517,7 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
>> +   {
>> +   struct offset offsets;
>> +   int    i;
>> +-  int32_t  test;
>> ++  uint32_t uaux;
>> +   uint32_t seg, total, need_buff = 0;
>> +   uint32_t buffsize;
>> +   uint32_t zwidth, zlength;
>> +@@ -5510,8 +5598,13 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
>> +     seg = crop->zonelist[j].position;
>> +     total = crop->zonelist[j].total;
>> +
>> +-    /* check for not allowed zone cases like 0:0; 4:3; etc. and skip that input */
>> ++    /* check for not allowed zone cases like 0:0; 4:3; or negative ones etc. and skip that input */
>> ++    if (crop->zonelist[j].position < 0 || crop->zonelist[j].total < 0) {
>> ++        TIFFError("getCropOffsets", "Negative crop zone values %d:%d are not allowed, thus skipped.", crop->zonelist[j].position, crop->zonelist[j].total);
>> ++        continue;
>> ++    }
>> +     if (seg == 0 || total == 0 || seg > total) {
>> ++        TIFFError("getCropOffsets", "Crop zone %d:%d is out of specification, thus skipped.", seg, total);
>> +         continue;
>> +     }
>> +
>> +@@ -5524,17 +5617,23 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
>> +
>> +            crop->regionlist[i].x1 = offsets.startx +
>> +                                   (uint32_t)(offsets.crop_width * 1.0 * (seg - 1) / total);
>> +-           test = (int32_t)offsets.startx +
>> +-                  (int32_t)(offsets.crop_width * 1.0 * seg / total);
>> +-           if (test < 1 )
>> +-             crop->regionlist[i].x2 = 0;
>> +-           else
>> +-           {
>> +-           if (test > (int32_t)(image->width - 1))
>> ++           /* FAULT: IMHO in the old code here, the calculation of x2 was based on wrong assumtions. The whole image was assumed and 'endy' and 'starty' are not respected anymore!*/
>> ++           /* NEW PROPOSED Code: Assumption: offsets are within image with top left corner as origin (0,0) and 'start' <= 'end'. */
>> ++           if (crop->regionlist[i].x1 > offsets.endx) {
>> ++                crop->regionlist[i].x1 = offsets.endx;
>> ++           } else if (crop->regionlist[i].x1 >= image->width) {
>> ++               crop->regionlist[i].x1 = image->width - 1;
>> ++           }
>> ++
>> ++           crop->regionlist[i].x2 = offsets.startx + (uint32_t)(offsets.crop_width * 1.0 * seg / total);
>> ++           if (crop->regionlist[i].x2 > 0) crop->regionlist[i].x2 = crop->regionlist[i].x2 - 1;
>> ++           if (crop->regionlist[i].x2 < crop->regionlist[i].x1) {
>> ++               crop->regionlist[i].x2 = crop->regionlist[i].x1;
>> ++           } else if (crop->regionlist[i].x2 > offsets.endx) {
>> ++               crop->regionlist[i].x2 = offsets.endx;
>> ++           } else if (crop->regionlist[i].x2 >= image->width) {
>> +                crop->regionlist[i].x2 = image->width - 1;
>> +-             else
>> +-             crop->regionlist[i].x2 = test - 1;
>> +-             }
>> ++           }
>> +            zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1  + 1;
>> +
>> +          /* This is passed to extractCropZone or extractCompositeZones */
>> +@@ -5549,22 +5648,27 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
>> +          crop->regionlist[i].x1 = offsets.startx;
>> +            crop->regionlist[i].x2 = offsets.endx;
>> +
>> +-           test = offsets.endy - (uint32_t)(offsets.crop_length * 1.0 * seg / total);
>> +-           if (test < 1 )
>> +-           crop->regionlist[i].y1 = 0;
>> +-           else
>> +-           crop->regionlist[i].y1 = test + 1;
>> ++           /* FAULT: IMHO in the old code here, the calculation of y1/y2 was based on wrong assumtions. The whole image was assumed and 'endy' and 'starty' are not respected anymore!*/
>> ++           /* NEW PROPOSED Code: Assumption: offsets are within image with top left corner as origin (0,0) and 'start' <= 'end'. */
>> ++           uaux = (uint32_t)(offsets.crop_length * 1.0 * seg / total);
>> ++           if (uaux <= offsets.endy + 1) {
>> ++               crop->regionlist[i].y1 = offsets.endy - uaux + 1;
>> ++           } else {
>> ++               crop->regionlist[i].y1 = 0;
>> ++           }
>> ++           if (crop->regionlist[i].y1 < offsets.starty) {
>> ++               crop->regionlist[i].y1 = offsets.starty;
>> ++           }
>> +
>> +-           test = offsets.endy - (offsets.crop_length * 1.0 * (seg - 1) / total);
>> +-           if (test < 1 )
>> +-             crop->regionlist[i].y2 = 0;
>> +-           else
>> +-           {
>> +-             if (test > (int32_t)(image->length - 1))
>> +-               crop->regionlist[i].y2 = image->length - 1;
>> +-             else
>> +-               crop->regionlist[i].y2 = test;
>> +-           }
>> ++           uaux = (uint32_t)(offsets.crop_length * 1.0 * (seg - 1) / total);
>> ++           if (uaux <= offsets.endy) {
>> ++               crop->regionlist[i].y2 = offsets.endy - uaux;
>> ++           } else {
>> ++               crop->regionlist[i].y2 = 0;
>> ++           }
>> ++           if (crop->regionlist[i].y2 < offsets.starty) {
>> ++               crop->regionlist[i].y2 = offsets.starty;
>> ++           }
>> +            zlength = crop->regionlist[i].y2 - crop->regionlist[i].y1 + 1;
>> +
>> +          /* This is passed to extractCropZone or extractCompositeZones */
>> +@@ -5575,32 +5679,42 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
>> +            crop->combined_width = (uint32_t)zwidth;
>> +            break;
>> +       case EDGE_RIGHT: /* zones from right to left, length from top */
>> +-           zlength = offsets.crop_length;
>> +-         crop->regionlist[i].y1 = offsets.starty;
>> +-           crop->regionlist[i].y2 = offsets.endy;
>> +-
>> +-           crop->regionlist[i].x1 = offsets.startx +
>> +-                                  (uint32_t)(offsets.crop_width * (total - seg) * 1.0 / total);
>> +-           test = offsets.startx +
>> +-                (offsets.crop_width * (total - seg + 1) * 1.0 / total);
>> +-           if (test < 1 )
>> +-             crop->regionlist[i].x2 = 0;
>> +-           else
>> +-           {
>> +-           if (test > (int32_t)(image->width - 1))
>> +-               crop->regionlist[i].x2 = image->width - 1;
>> +-             else
>> +-               crop->regionlist[i].x2 = test - 1;
>> +-             }
>> +-           zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1  + 1;
>> ++                zlength = offsets.crop_length;
>> ++                crop->regionlist[i].y1 = offsets.starty;
>> ++                crop->regionlist[i].y2 = offsets.endy;
>> ++
>> ++                crop->regionlist[i].x1 = offsets.startx +
>> ++                        (uint32_t)(offsets.crop_width * (total - seg) * 1.0 / total);
>> ++          /* FAULT: IMHO from here on, the calculation of y2 are based on wrong assumtions. The whole image is assumed and 'endy' and 'starty' are not respected anymore!*/
>> ++          /* NEW PROPOSED Code: Assumption: offsets are within image with top left corner as origin (0,0) and 'start' <= 'end'. */
>> ++          uaux = (uint32_t)(offsets.crop_width * 1.0 * seg / total);
>> ++          if (uaux <= offsets.endx + 1) {
>> ++              crop->regionlist[i].x1 = offsets.endx - uaux + 1;
>> ++          } else {
>> ++              crop->regionlist[i].x1 = 0;
>> ++          }
>> ++          if (crop->regionlist[i].x1 < offsets.startx) {
>> ++              crop->regionlist[i].x1 = offsets.startx;
>> ++          }
>> +
>> +-         /* This is passed to extractCropZone or extractCompositeZones */
>> +-           crop->combined_length = (uint32_t)zlength;
>> +-           if (crop->exp_mode == COMPOSITE_IMAGES)
>> +-             crop->combined_width += (uint32_t)zwidth;
>> +-           else
>> +-             crop->combined_width = (uint32_t)zwidth;
>> +-           break;
>> ++          uaux = (uint32_t)(offsets.crop_width * 1.0 * (seg - 1) / total);
>> ++          if (uaux <= offsets.endx) {
>> ++              crop->regionlist[i].x2 = offsets.endx - uaux;
>> ++          } else {
>> ++              crop->regionlist[i].x2 = 0;
>> ++          }
>> ++          if (crop->regionlist[i].x2 < offsets.startx) {
>> ++              crop->regionlist[i].x2 = offsets.startx;
>> ++          }
>> ++          zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1 + 1;
>> ++
>> ++                /* This is passed to extractCropZone or extractCompositeZones */
>> ++                crop->combined_length = (uint32_t)zlength;
>> ++                if (crop->exp_mode == COMPOSITE_IMAGES)
>> ++                        crop->combined_width += (uint32_t)zwidth;
>> ++                else
>> ++                        crop->combined_width = (uint32_t)zwidth;
>> ++                break;
>> +       case EDGE_TOP: /* width from left, zones from top to bottom */
>> +       default:
>> +            zwidth = offsets.crop_width;
>> +@@ -5608,6 +5722,14 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
>> +            crop->regionlist[i].x2 = offsets.endx;
>> +
>> +            crop->regionlist[i].y1 = offsets.starty + (uint32_t)(offsets.crop_length * 1.0 * (seg - 1) / total);
>> ++           if (crop->regionlist[i].y1 > offsets.endy) {
>> ++               crop->regionlist[i].y1 = offsets.endy;
>> ++           } else if (crop->regionlist[i].y1 >= image->length) {
>> ++               crop->regionlist[i].y1 = image->length - 1;
>> ++           }
>> ++
>> ++           /* FAULT: IMHO from here on, the calculation of y2 are based on wrong assumtions. The whole image is assumed and 'endy' and 'starty' are not respected anymore!*/
>> ++           /* OLD Code:
>> +            test = offsets.starty + (uint32_t)(offsets.crop_length * 1.0 * seg / total);
>> +            if (test < 1 )
>> +              crop->regionlist[i].y2 = 0;
>> +@@ -5618,6 +5740,18 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
>> +              else
>> +              crop->regionlist[i].y2 = test - 1;
>> +            }
>> ++           */
>> ++                 /* NEW PROPOSED Code: Assumption: offsets are within image with top left corner as origin (0,0) and 'start' <= 'end'. */
>> ++                 crop->regionlist[i].y2 = offsets.starty + (uint32_t)(offsets.crop_length * 1.0 * seg / total);
>> ++           if (crop->regionlist[i].y2 > 0)crop->regionlist[i].y2 = crop->regionlist[i].y2 - 1;
>> ++                 if (crop->regionlist[i].y2 < crop->regionlist[i].y1) {
>> ++                         crop->regionlist[i].y2 = crop->regionlist[i].y1;
>> ++                 } else if (crop->regionlist[i].y2 > offsets.endy) {
>> ++                         crop->regionlist[i].y2 = offsets.endy;
>> ++                 } else if (crop->regionlist[i].y2 >= image->length) {
>> ++                         crop->regionlist[i].y2 = image->length - 1;
>> ++                 }
>> ++
>> +            zlength = crop->regionlist[i].y2 - crop->regionlist[i].y1 + 1;
>> +
>> +          /* This is passed to extractCropZone or extractCompositeZones */
>> +@@ -7551,7 +7685,8 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
>> +     total_width = total_length = 0;
>> +     for (i = 0; i < crop->selections; i++)
>> +       {
>> +-      cropsize = crop->bufftotal;
>> ++
>> ++        cropsize = crop->bufftotal;
>> +       crop_buff = seg_buffs[i].buffer;
>> +       if (!crop_buff)
>> +         crop_buff = (unsigned char *)limitMalloc(cropsize);
>> +@@ -7640,6 +7775,9 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
>> +
>> +       if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */
>> +         {
>> ++          /* rotateImage() changes image->width, ->length, ->xres and ->yres, what it schouldn't do here, when more than one section is processed.
>> ++           * ToDo: Therefore rotateImage() and its usage has to be reworked (e.g. like mirrorImage()) !!
>> ++           */
>> +       if (rotateImage(crop->rotation, image, &crop->regionlist[i].width,
>> +                       &crop->regionlist[i].length, &crop_buff))
>> +           {
>> +@@ -7655,8 +7793,8 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
>> +         seg_buffs[i].size = (((crop->regionlist[i].width * image->bps + 7 ) / 8)
>> +                                * image->spp) * crop->regionlist[i].length;
>> +         }
>> +-      }
>> +-    }
>> ++      }  /* for crop->selections loop */
>> ++    }  /* Separated Images (else case) */
>> +   return (0);
>> +   } /* end processCropSelections */
>> +
>> +--
>> +2.33.0
>> +
>> diff --git a/meta/recipes-multimedia/libtiff/tiff/CVE-2022-2953.patch b/meta/recipes-multimedia/libtiff/tiff/CVE-2022-2953.patch
>> new file mode 100644
>> index 0000000000..3a3a915688
>> --- /dev/null
>> +++ b/meta/recipes-multimedia/libtiff/tiff/CVE-2022-2953.patch
>> @@ -0,0 +1,87 @@
>> +CVE: CVE-2022-2953
>> +Upstream-Status: Backport
>> +Signed-off-by: Ross Burton <ross.burton@...>
>> +Signed-off-by: Zheng Qiu <zheng.qiu@...>
>> +
>> +From 8fe3735942ea1d90d8cef843b55b3efe8ab6feaf Mon Sep 17 00:00:00 2001
>> +From: Su_Laus <sulau@...>
>> +Date: Mon, 15 Aug 2022 22:11:03 +0200
>> +Subject: [PATCH] =?UTF-8?q?According=20to=20Richard=20Nolde=20https://gitl?=
>> + =?UTF-8?q?ab.com/libtiff/libtiff/-/issues/401#note=5F877637400=20the=20ti?=
>> + =?UTF-8?q?ffcrop=20option=20=E2=80=9E-S=E2=80=9C=20is=20also=20mutually?=
>> + =?UTF-8?q?=20exclusive=20to=20the=20other=20crop=20options=20(-X|-Y),=20-?=
>> + =?UTF-8?q?Z=20and=20-z.?=
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +This is now checked and ends tiffcrop if those arguments are not mutually exclusive.
>> +
>> +This MR will fix the following tiffcrop issues: #349, #414, #422, #423, #424
>> +---
>> + tools/tiffcrop.c | 31 ++++++++++++++++---------------
>> + 1 file changed, 16 insertions(+), 15 deletions(-)
>> +
>> +diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
>> +index 90286a5e..c3b758ec 100644
>> +--- a/tools/tiffcrop.c
>> ++++ b/tools/tiffcrop.c
>> +@@ -173,12 +173,12 @@ static   char tiffcrop_rev_date[] = "02-09-2022";
>> + #define ROTATECW_270 32
>> + #define ROTATE_ANY (ROTATECW_90 | ROTATECW_180 | ROTATECW_270)
>> +
>> +-#define CROP_NONE     0
>> +-#define CROP_MARGINS  1
>> +-#define CROP_WIDTH    2
>> +-#define CROP_LENGTH   4
>> +-#define CROP_ZONES    8
>> +-#define CROP_REGIONS 16
>> ++#define CROP_NONE     0     /* "-S" -> Page_MODE_ROWSCOLS and page->rows/->cols != 0 */
>> ++#define CROP_MARGINS  1     /* "-m" */
>> ++#define CROP_WIDTH    2     /* "-X" */
>> ++#define CROP_LENGTH   4     /* "-Y" */
>> ++#define CROP_ZONES    8     /* "-Z" */
>> ++#define CROP_REGIONS 16     /* "-z" */
>> + #define CROP_ROTATE  32
>> + #define CROP_MIRROR  64
>> + #define CROP_INVERT 128
>> +@@ -316,7 +316,7 @@ struct crop_mask {
>> + #define PAGE_MODE_RESOLUTION   1
>> + #define PAGE_MODE_PAPERSIZE    2
>> + #define PAGE_MODE_MARGINS      4
>> +-#define PAGE_MODE_ROWSCOLS     8
>> ++#define PAGE_MODE_ROWSCOLS     8    /* for -S option */
>> +
>> + #define INVERT_DATA_ONLY      10
>> + #define INVERT_DATA_AND_TAG   11
>> +@@ -781,7 +781,7 @@ static const char usage_info[] =
>> + "             The four debug/dump options are independent, though it makes little sense to\n"
>> + "             specify a dump file without specifying a detail level.\n"
>> + "\n"
>> +-"Note:        The (-X|-Y), -Z and -z options are mutually exclusive.\n"
>> ++"Note:        The (-X|-Y), -Z, -z and -S options are mutually exclusive.\n"
>> + "             In no case should the options be applied to a given selection successively.\n"
>> + "\n"
>> + ;
>> +@@ -2131,13 +2131,14 @@ void  process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
>> +               /*NOTREACHED*/
>> +       }
>> +     }
>> +-    /*-- Check for not allowed combinations (e.g. -X, -Y and -Z and -z are mutually exclusive) --*/
>> +-    char XY, Z, R;
>> ++    /*-- Check for not allowed combinations (e.g. -X, -Y and -Z, -z and -S are mutually exclusive) --*/
>> ++    char XY, Z, R, S;
>> +     XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH));
>> +     Z = (crop_data->crop_mode & CROP_ZONES);
>> +     R = (crop_data->crop_mode & CROP_REGIONS);
>> +-    if ((XY && Z) || (XY && R) || (Z && R)) {
>> +-        TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z and -z are mutually exclusive.->Exit");
>> ++    S = (page->mode & PAGE_MODE_ROWSCOLS);
>> ++    if ((XY && Z) || (XY && R) || (XY && S) || (Z && R) || (Z && S) || (R && S)) {
>> ++        TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->Exit");
>> +         exit(EXIT_FAILURE);
>> +     }
>> +   }  /* end process_command_opts */
>> +--
>> +2.34.1
>> +
>> diff --git a/meta/recipes-multimedia/libtiff/tiff_4.3.0.bb b/meta/recipes-multimedia/libtiff/tiff_4.3.0.bb
>> index f84057c46b..29a2c38d8e 100644
>> --- a/meta/recipes-multimedia/libtiff/tiff_4.3.0.bb
>> +++ b/meta/recipes-multimedia/libtiff/tiff_4.3.0.bb
>> @@ -25,6 +25,8 @@ SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
>>             file://CVE-2022-2869.patch \
>>             file://CVE-2022-2867.patch \
>>             file://b258ed69a485a9cfb299d9f060eb2a46c54e5903.patch \
>> +           file://0001-tiffcrop-Fix-issue-330-and-some-more-from-320-to-349.patch \
>> +           file://CVE-2022-2953.patch \
>>             "
>>
>>  SRC_URI[sha256sum] = "0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8"
>> --
>> 2.25.1
>>
>>
>>
>>


Re: [RFC PATCH 2/3] kbd: Disable 64 bit time with 32 bit glibc

Ola x Nilsson
 

Doing the rince and repeat thing, yes.

Some of us may not have the luxury to wait for glibc to reach
'eventually'. Whether OpenEmbedded should carry this option and how are
other discussions. I'm open to carrying this as a plugin layer.

For what it's worth I would prefer if glibc at least had a configuration
option to force 64-bit only.

/Ola

On Tue, Nov 08 2022, Alexander Kanavin wrote:

Thanks. But: face, meet palm.

"If _TIME_BITS is undefined, the bit size of time_t is architecture
dependent. Currently it defaults to 64 bits on most architectures.
Although it defaults to 32 bits on some traditional architectures
(i686, ARM), this is planned to change and applications should not
rely on this. "

No one needs to know or care about this, they should just set it to 64
for all targets, break all the badly written userspace and move on.

Anyway, rather than add exceptions all over the core layers, I'd
suggest that you set it to 64, 'bitbake world' with all of meta-oe,
then send fixes upstream for everything that breaks. Rinse, repeat.
Then when the 'planned to change' actually happens we should be ready
for it.

Alex




On Tue, 8 Nov 2022 at 18:58, Ola x Nilsson <ola.x.nilsson@...> wrote:


And here is a link to the documentation for the _TIME_BITS Feature Test
Macro
https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-_005fTIME_005fBITS

The docs for _FILE_OFFSET_BITS is just above.

/Ola

On Tue, Nov 08 2022, Ola x Nilsson wrote:

Sorry, that link did not explain the -D_USE_TIME_BITS=64 flag.

I was sure I had read official docs of this somewhere but now I can only
find https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#Detailed_implementation

/Ola

On Tue, Nov 08 2022, Ola x Nilsson wrote:

As far as I can tell from glibc's documentation, this is how you are
supposed to do it. glibc chose to always support both 32 and 64 bit
APIs for time and file offset and make the normal int size the default.
musl chose to switch to 64bit altogether.

https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html

/Ola

On Tue, Nov 08 2022, Alexander Kanavin wrote:

I suppose what I want to say is - perhaps this should be discussed
with upstreams first? Things should 'just work' without having to set
some magic flags in an external configuration.

Alex

On Tue, 8 Nov 2022 at 13:18, Alexander Kanavin via
lists.openembedded.org <alex.kanavin=gmail.com@...>
wrote:

Is this a recommendation somewhere official?

Alex

On Tue 8. Nov 2022 at 13.04, Niko Mauno <niko.mauno@...> wrote:

My understanding wrt. Y2038 and 32-bit glibc hosts was such that it
makes sense to set said compiler flags globally to ensure user space
wide Y2038 compliance. So I encountered this compiler error while
building poky reference images with additional effective

TARGET_CPPFLAGS += "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"

declaration in meta/conf/distro/include/tclibc-glibc.inc.

-Niko

On 8.11.2022 13.50, Alexander Kanavin wrote:
So you need to set -D_TIME_BITS=64
-D_FILE_OFFSET_BITS=64 to get some error? But why set that, shouldn’t
the defaults work?

Alex

On Tue 8. Nov 2022 at 12.48, Niko Mauno <niko.mauno@...
<mailto:niko.mauno@...>> wrote:

I have not studied the issue, but in order to reproduce this error I
add
'MACHINE = "qemuarm"' to local.conf then issue 'bitbake kbd' against
current master while TARGET_CPPFLAGS value is set to "-D_TIME_BITS=64
-D_FILE_OFFSET_BITS=64".

-Niko

On 8.11.2022 11.14, Alexander Kanavin wrote:
> We do build for 32 bit arm targets, so is this seen only in specific
> circumstances? What are they?
>
> Alex
>
> On Tue, 8 Nov 2022 at 01:09, Niko Mauno via
lists.openembedded.org
<http://lists.openembedded.org/
> <niko.mauno=vaisala.com@...
<mailto:vaisala.com@...>> wrote:
>>
>> For now add exemption in order to avoid following failure during
>> do_compile()
>>
>> |
.../build/tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/kbd/2.5.1-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/12.2.0/ld:.libs/libtswrap.ver:2:
syntax error in VERSION script
>> | collect2: error: ld returned 1 exit status
>>
>> Signed-off-by: Niko Mauno <niko.mauno@...
<mailto:niko.mauno@...>>
>> ---
>> meta/recipes-core/kbd/kbd_2.5.1.bb
<http://kbd_2.5.1.bb/
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/recipes-core/kbd/kbd_2.5.1.bb
<http://kbd_2.5.1.bb/
>> index aa3ab6e121..b623aecd36 100644
>> --- a/meta/recipes-core/kbd/kbd_2.5.1.bb
<http://kbd_2.5.1.bb/
>> +++ b/meta/recipes-core/kbd/kbd_2.5.1.bb
<http://kbd_2.5.1.bb/
>> @@ -18,6 +18,9 @@ SRC_URI =
"${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
>>
>> SRC_URI[sha256sum] =
"ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683"
>>
>> +# Compiling 64 bit time for 32 bit host is broken
>> +GLIBC_64BIT_TIME_CPPFLAGS = ""
>> +
>> PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam',
d)} \
>> "
>>
>> --
>> 2.36.1
>>
>>
>>
>>


[4. ATT00001.txt --- text/plain; ATT00001.txt]...
[4. ATT00001.txt --- text/plain; ATT00001.txt]...


Re: [PATCH v3] libc-test: add libc testsuite for musl

Chase Qi
 

Hi Alexandre,

On Wed, 9 Nov 2022 at 03:50, Alexandre Belloni
<alexandre.belloni@...> wrote:

Hello,

This fails with:
The following recipes do not have a maintainer assigned to them. Please add an entry to meta/conf/distro/include/maintainers.inc file.
libc-test (/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/recipes-core/musl/libc-test_git.bb)
Thanks for pointing this out. I have sent v4. I added myself as the
maintainer of the recipe. I am fine to change it to any of the oe-core
core maintainers if that makes more sense.

- Chase

On 08/11/2022 03:42:33+0000, Chase Qi wrote:
libc-test is a collection of unit test to measure the correctness and
robustness of a C/POSIX standard library implementation. It is developed
as part of the musl project.

Signed-off-by: Chase Qi <chase.qi@...>
---
.../distro/include/ptest-packagelists.inc | 1 +
meta/recipes-core/musl/libc-test/run-ptest | 28 ++++++++++
meta/recipes-core/musl/libc-test_git.bb | 51 +++++++++++++++++++
3 files changed, 80 insertions(+)
create mode 100644 meta/recipes-core/musl/libc-test/run-ptest
create mode 100644 meta/recipes-core/musl/libc-test_git.bb

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 32b0e5297a..3c9ff43bd9 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -105,6 +105,7 @@ PTESTS_SLOW = "\

PTESTS_SLOW:remove:riscv64 = "valgrind-ptest"
PTESTS_PROBLEMS:append:riscv64 = "valgrind-ptest"
+PTESTS_SLOW:append:libc-musl = " libc-test-ptest"

# ruby-ptest \ # Timeout
# lz4-ptest \ # Needs a rewrite
diff --git a/meta/recipes-core/musl/libc-test/run-ptest b/meta/recipes-core/musl/libc-test/run-ptest
new file mode 100644
index 0000000000..0b4b687dec
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test/run-ptest
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+cd /opt/libc-test
+make cleanall
+make run || true
+
+echo ""
+echo "--- ptest result ---"
+# libc-test runs tests by module(e.g. src/api) and generates sub-module test
+# report(e.g. src/api/REPORT) first. After all tests finish, it generates the
+# consolidated report file src/REPORT.
+report="/opt/libc-test/src/REPORT"
+if ! [ -f "${report}" ]; then
+ echo "${report} not found!"
+ echo "FAIL: libc-test"
+ exit 1
+# libc-test prints error on failure and prints nothing on success.
+elif grep -q '^FAIL src.*\.exe.*' "${report}"; then
+ # Print test failure in ptest format.
+ # e.g. "FAIL src/api/main.exe [status 1]" -> "FAIL: api_main"
+ grep '^FAIL src.*\.exe.*' "${report}" \
+ | sed 's|^FAIL src/|FAIL: |;s|/|_|;s|\.exe.*\]||'
+ exit 1
+else
+ echo "PASS: libc-test"
+fi
diff --git a/meta/recipes-core/musl/libc-test_git.bb b/meta/recipes-core/musl/libc-test_git.bb
new file mode 100644
index 0000000000..b5bfc6e34c
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test_git.bb
@@ -0,0 +1,51 @@
+SUMMARY = "Musl libc unit tests"
+HOMEPAGE = "https://wiki.musl-libc.org/libc-test.html"
+DESCRIPTION = "libc-test is a collection of unit tests to measure the \
+correctness and robustness of a C/POSIX standard library implementation. It is \
+developed as part of the musl project."
+SECTION = "tests"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=43ed1245085be90dc934288117d55a3b"
+
+inherit ptest
+
+SRCREV = "18e28496adee3d84fefdda6efcb9c5b8996a2398"
+SRC_URI = " \
+ git://repo.or.cz/libc-test;branch=master \
+ file://run-ptest \
+"
+
+PV = "0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# libc-test 'make' or 'make run' command is designed to build and run tests. It
+# reports both build and test failures. The commands should be run on target.
+do_compile() {
+ :
+}
+
+RDEPENDS:${PN} = " \
+ bash \
+ grep \
+ musl \
+ packagegroup-core-buildessential \
+"
+
+RDEPENDS:${PN}-ptest = " \
+ ${PN} \
+ sed \
+"
+
+install_path = "/opt/${PN}"
+FILES:${PN} += "${install_path}/*"
+
+do_install () {
+ install -d ${D}${install_path}/
+ cp ${S}/Makefile ${D}${install_path}
+ cp ${S}/config.mak.def ${D}${install_path}/config.mak
+ cp -r ${S}/src ${D}${install_path}
+}
+
+COMPATIBLE_HOST = "null"
+COMPATIBLE_HOST:libc-musl = "(.*)"
--
2.25.1



--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


[PATCH v4] libc-test: add libc testsuite for musl

Chase Qi
 

libc-test is a collection of unit test to measure the correctness and
robustness of a C/POSIX standard library implementation. It is developed
as part of the musl project.

Signed-off-by: Chase Qi <chase.qi@...>
---
meta/conf/distro/include/maintainers.inc | 1 +
.../distro/include/ptest-packagelists.inc | 1 +
meta/recipes-core/musl/libc-test/run-ptest | 28 ++++++++++
meta/recipes-core/musl/libc-test_git.bb | 51 +++++++++++++++++++
4 files changed, 81 insertions(+)
create mode 100644 meta/recipes-core/musl/libc-test/run-ptest
create mode 100644 meta/recipes-core/musl/libc-test_git.bb

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 57319cd8f5..5b7ce77c3c 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -306,6 +306,7 @@ RECIPE_MAINTAINER:pn-libarchive = "Otavio Salvador <otavio.salvador@...
RECIPE_MAINTAINER:pn-libassuan = "Unassigned <unassigned@...>"
RECIPE_MAINTAINER:pn-libatomic-ops = "Anuj Mittal <anuj.mittal@...>"
RECIPE_MAINTAINER:pn-libbsd = "Yi Zhao <yi.zhao@...>"
+RECIPE_MAINTAINER:pn-libc-test = "Chase Qi <chase.qi@...>"
RECIPE_MAINTAINER:pn-libcap = "Yi Zhao <yi.zhao@...>"
RECIPE_MAINTAINER:pn-libcap-ng = "Yi Zhao <yi.zhao@...>"
RECIPE_MAINTAINER:pn-libcap-ng-python = "Yi Zhao <yi.zhao@...>"
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 32b0e5297a..3c9ff43bd9 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -105,6 +105,7 @@ PTESTS_SLOW = "\

PTESTS_SLOW:remove:riscv64 = "valgrind-ptest"
PTESTS_PROBLEMS:append:riscv64 = "valgrind-ptest"
+PTESTS_SLOW:append:libc-musl = " libc-test-ptest"

# ruby-ptest \ # Timeout
# lz4-ptest \ # Needs a rewrite
diff --git a/meta/recipes-core/musl/libc-test/run-ptest b/meta/recipes-core/musl/libc-test/run-ptest
new file mode 100644
index 0000000000..0b4b687dec
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test/run-ptest
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+cd /opt/libc-test
+make cleanall
+make run || true
+
+echo ""
+echo "--- ptest result ---"
+# libc-test runs tests by module(e.g. src/api) and generates sub-module test
+# report(e.g. src/api/REPORT) first. After all tests finish, it generates the
+# consolidated report file src/REPORT.
+report="/opt/libc-test/src/REPORT"
+if ! [ -f "${report}" ]; then
+ echo "${report} not found!"
+ echo "FAIL: libc-test"
+ exit 1
+# libc-test prints error on failure and prints nothing on success.
+elif grep -q '^FAIL src.*\.exe.*' "${report}"; then
+ # Print test failure in ptest format.
+ # e.g. "FAIL src/api/main.exe [status 1]" -> "FAIL: api_main"
+ grep '^FAIL src.*\.exe.*' "${report}" \
+ | sed 's|^FAIL src/|FAIL: |;s|/|_|;s|\.exe.*\]||'
+ exit 1
+else
+ echo "PASS: libc-test"
+fi
diff --git a/meta/recipes-core/musl/libc-test_git.bb b/meta/recipes-core/musl/libc-test_git.bb
new file mode 100644
index 0000000000..b5bfc6e34c
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test_git.bb
@@ -0,0 +1,51 @@
+SUMMARY = "Musl libc unit tests"
+HOMEPAGE = "https://wiki.musl-libc.org/libc-test.html"
+DESCRIPTION = "libc-test is a collection of unit tests to measure the \
+correctness and robustness of a C/POSIX standard library implementation. It is \
+developed as part of the musl project."
+SECTION = "tests"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=43ed1245085be90dc934288117d55a3b"
+
+inherit ptest
+
+SRCREV = "18e28496adee3d84fefdda6efcb9c5b8996a2398"
+SRC_URI = " \
+ git://repo.or.cz/libc-test;branch=master \
+ file://run-ptest \
+"
+
+PV = "0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# libc-test 'make' or 'make run' command is designed to build and run tests. It
+# reports both build and test failures. The commands should be run on target.
+do_compile() {
+ :
+}
+
+RDEPENDS:${PN} = " \
+ bash \
+ grep \
+ musl \
+ packagegroup-core-buildessential \
+"
+
+RDEPENDS:${PN}-ptest = " \
+ ${PN} \
+ sed \
+"
+
+install_path = "/opt/${PN}"
+FILES:${PN} += "${install_path}/*"
+
+do_install () {
+ install -d ${D}${install_path}/
+ cp ${S}/Makefile ${D}${install_path}
+ cp ${S}/config.mak.def ${D}${install_path}/config.mak
+ cp -r ${S}/src ${D}${install_path}
+}
+
+COMPATIBLE_HOST = "null"
+COMPATIBLE_HOST:libc-musl = "(.*)"
--
2.25.1


Re: [RFC PATCH 1/3] Try to ensure 64 bit time on 32 bit glibcful hosts

Niko Mauno
 

On related note, in this RFC series I was basing on reference set in https://github.com/lmajewski/meta-y2038/blob/master/conf/distro/y2038.inc#L8 where the author has opted to use TARGET_CPPFLAGS.

-Niko

On 11/8/22 12:51, Ola x Nilsson wrote:
I'm working on the same thing, but I put GLIBC_64BIT_TIME_CPPFLAGS in
TARGET_CC_ARCH instead to make sure they applied everywhere.
I'd be interested to hear what others think is the best place to put
these flags.
I'm also looking at QA tests to make sure that no application or shared
object is still using 32bit time or file functions from glibc.
/Ola
On Tue, Nov 08 2022, Niko Mauno via lists.openembedded.org wrote:

Add default C Preprocessor flags that ensure Y2038 compatible 64 bit
time on 32 bit host applications when glibc is used. Prerequisites
are glibc version 2.34 or newer and Linux kernel version 5.1 or newer.

Example of impact on 32 bit 'qemuarm' machine running
core-image-minimal. Before this change:

root@qemuarm:~# /bin/busybox date
Sun Nov 6 06:09:39 UTC 2022
root@qemuarm:~# /sbin/hwclock.util-linux -w
root@qemuarm:~# /sbin/hwclock.util-linux
2022-11-06 06:09:49.994249+00:00
root@qemuarm:~# /bin/busybox date -s 2040-01-01
date: invalid date '2040-01-01'
root@qemuarm:~# /bin/date.coreutils -s 2040-01-01
Sun Jan 1 00:00:00 UTC 2040
root@qemuarm:~# /sbin/hwclock.util-linux -w
root@qemuarm:~# /sbin/hwclock.util-linux
1931-03-04 06:26:23.000000+00:00
root@qemuarm:~#

After this change:

root@qemuarm:~# /bin/busybox date
Sun Nov 6 06:02:20 UTC 2022
root@qemuarm:~# /sbin/hwclock.util-linux -w
root@qemuarm:~# /sbin/hwclock.util-linux
2022-11-06 06:02:27.989730+00:00
root@qemuarm:~# /bin/busybox date -s 2040-01-01
Sun Jan 1 00:00:00 UTC 2040
root@qemuarm:~# /sbin/hwclock.util-linux -w
root@qemuarm:~# /sbin/hwclock.util-linux
2040-01-01 00:00:20.992954+00:00
root@qemuarm:~#

From here on, the adding of new flags can be disabled on recipe or
global level by resetting the value of associated variable containing
the CPPFLAGS specific for 64 bit time

GLIBC_64BIT_TIME_CPPFLAGS = ""

which can be useful e.g. when working around failure to compile a
component due to lack of 64 bit time support on 32 bit build in the
component's source code.

Signed-off-by: Niko Mauno <niko.mauno@...>
---
meta/conf/distro/include/tclibc-glibc.inc | 3 +++
meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb | 2 ++
meta/recipes-devtools/pseudo/pseudo_git.bb | 2 ++
3 files changed, 7 insertions(+)

diff --git a/meta/conf/distro/include/tclibc-glibc.inc b/meta/conf/distro/include/tclibc-glibc.inc
index f48d16939e..95770298e9 100644
--- a/meta/conf/distro/include/tclibc-glibc.inc
+++ b/meta/conf/distro/include/tclibc-glibc.inc
@@ -17,6 +17,9 @@ PREFERRED_PROVIDER_virtual/crypt ?= "libxcrypt"
CXXFLAGS += "-fvisibility-inlines-hidden"
+GLIBC_64BIT_TIME_CPPFLAGS = "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
+TARGET_CPPFLAGS += "${GLIBC_64BIT_TIME_CPPFLAGS}"
+
LIBC_DEPENDENCIES = "\
glibc \
glibc-dbg \
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
index 8bda2ccad6..b3fafa0ea4 100644
--- a/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
@@ -5,3 +5,5 @@ require gcc-sanitizers.inc
# sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
ARM_INSTRUCTION_SET:armv4 = "arm"
ARM_INSTRUCTION_SET:armv5 = "arm"
+
+GLIBC_64BIT_TIME_CPPFLAGS = ""
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index c34580b4ff..7734d0fbb0 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -19,3 +19,5 @@ PV = "1.9.0+git${SRCPV}"
# error: use of undeclared identifier '_STAT_VER'
COMPATIBLE_HOST:libc-musl = 'null'
+
+GLIBC_64BIT_TIME_CPPFLAGS = ""


Re: [PATCH 46/48] python3: use the standard shell version of python3-config

Khem Raj
 

I am seeing a bunch of failures perhaps related but not sure

https://errors.yoctoproject.org/Errors/Build/154610/

On Tue, Nov 8, 2022 at 2:59 PM Richard Purdie
<richard.purdie@...> wrote:

On Mon, 2022-11-07 at 15:55 +0100, Alexander Kanavin wrote:

+SYSROOT_PREPROCESS_FUNCS:append:class-target = " provide_target_config_script"
+SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " provide_target_config_script"
+
+provide_target_config_script() {
+ install -d ${SYSROOT_DESTDIR}${bindir}/
+ install ${D}/${bindir}/python3-config ${SYSROOT_DESTDIR}${bindir}/
+ install ${D}/${bindir}/python${PYTHON_MAJMIN}-config ${SYSROOT_DESTDIR}${bindir}/
+}
+
+
SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
SSTATE_HASHEQUIV_FILEMAP = " \
populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${TMPDIR} \
This made me wonder if we shouldn't have a better way of handling this.
I was wondering if we should have a sysroot_stage_file function (like
sysroot_stage_dir) and then we could do something like:

sysroot_stage_all:append() {
sysroot_stage_file ${D}/${bindir}/python3-config ${SYSROOT_DESTDIR}/${bindir}/python3-config
}

Note that the sysroot code plays with hardlinks for efficiency, I
appreciate one file doesn't really matter though.

I was hoping we could have just added to SYSROOT_DIRS but that does
only handle dirs, not files.

Cheers,

Richard



[PATCH] mesa: fix runpath with native llvm-config in target sysroot

Maxime Roussin-Bélanger
 

From: Maxime Roussin-Bélanger <maxime.roussinbelanger@...>

llvm-config is copied from native to target sysroot, it shouldn't be
allowed to use target shared libraries when it loads.

Remove all runpath so it uses shared library from host system since
native llvm-config is compiled with hosttools compiler.

Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@...>
---
meta/recipes-graphics/mesa/mesa.inc | 1 +
1 file changed, 1 insertion(+)

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 67cfb4f6c1..abc2c3f4c4 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -61,6 +61,7 @@ do_configure:prepend () {
if [ -e ${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE} ]; then
cp ${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE} ${STAGING_BINDIR}
cp ${STAGING_BINDIR_NATIVE}/llvm-config ${STAGING_BINDIR}
+ chrpath -d ${STAGING_BINDIR}/llvm-config
fi
}

--
2.36.0


[langdale 00/34] Pull request (cover letter only)

Steve Sakoman
 

The following changes since commit 48f9f92c547fac35ff398180a32a5b0829cd9fff:

openssl: Upgrade 3.0.5 -> 3.0.7 (2022-11-03 04:25:37 -1000)

are available in the Git repository at:

https://git.openembedded.org/openembedded-core-contrib stable/langdale-next
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=stable/langdale-next

Adrian Freihofer (1):
buildconf: compare abspath

Alexander Kanavin (2):
rust-target-config: match riscv target names with what rust expects
rust: install rustfmt for riscv32 as well

Bruce Ashfield (3):
linux-yocto/5.15: update to v5.15.72
linux-yocto/5.19: update to v5.19.14
kern-tools: fix relative path processing

Christian Eggers (1):
linux-firmware: split rtl8761 firmware

Claus Stovgaard (1):
gstreamer1.0-libav: fix errors with ffmpeg 5.x

Etienne Cordonnier (1):
mirrors.bbclass: use shallow tarball for binutils-native

Jose Quaresma (1):
kernel-yocto: improve fatal error messages of symbol_why.py

Keiya Nobuta (1):
create-spdx: Remove ";name=..." for downloadLocation

Luca Boccassi (1):
systemd: add systemd-creds and systemd-cryptenroll to
systemd-extra-utils

Markus Volk (1):
mesa: update 22.2.0 -> 22.2.2

Martin Jansa (2):
vulkan-samples: add lfs=0 to SRC_URI to avoid git smudge errors in
do_unpack
externalsrc.bbclass: fix git repo detection

Mingli Yu (1):
grub: disable build on armv7ve/a with hardfp

Peter Kjellerstedt (1):
externalsrc.bbclass: Remove a trailing slash from ${B}

Ross Burton (2):
zlib: do out-of-tree builds
zlib: upgrade 1.2.12 -> 1.2.13

Sean Anderson (3):
uboot-sign: Fix using wrong KEY_REQ_ARGS
kernel: Clear SYSROOT_DIRS instead of replacing sysroot_stage_all
kernel-fitimage: Use KERNEL_OUTPUT_DIR where appropriate

Sergei Zhmylev (1):
wic: honor the SOURCE_DATE_EPOCH in case of updated fstab

Thomas Perrot (1):
xserver-xorg: move some recommended dependencies in required

Tim Orling (1):
vim: upgrade 9.0.0614 -> 9.0.0820

Vincent Davis Jr (1):
linux-firmware: package amdgpu firmware

wangmy (8):
libcap: upgrade 2.65 -> 2.66
libical: upgrade 3.0.14 -> 3.0.15
numactl: upgrade 2.0.15 -> 2.0.16
wpebackend-fdo: upgrade 1.12.1 -> 1.14.0
libksba: upgrade 1.6.0 -> 1.6.2
libsdl2: upgrade 2.24.0 -> 2.24.1
lttng-ust: upgrade 2.13.4 -> 2.13.5
lighttpd: upgrade 1.4.66 -> 1.4.67

meta/classes-global/mirrors.bbclass | 1 +
meta/classes-recipe/kernel-fitimage.bbclass | 16 ++--
meta/classes-recipe/kernel-yocto.bbclass | 10 +--
meta/classes-recipe/kernel.bbclass | 4 +-
.../classes-recipe/rust-target-config.bbclass | 40 ++++++---
meta/classes-recipe/uboot-sign.bbclass | 2 +-
meta/classes/create-spdx.bbclass | 1 +
meta/classes/externalsrc.bbclass | 6 +-
meta/lib/bblayers/buildconf.py | 2 +-
meta/lib/oe/rust.py | 2 +
meta/recipes-bsp/grub/grub2.inc | 4 +-
meta/recipes-core/systemd/systemd_251.4.bb | 2 +
...t-inputs-provided-to-the-CRC-functio.patch | 54 ------------
...etting-a-gzip-header-extra-field-wit.patch | 38 --------
...processing-bug-that-dereferences-NUL.patch | 36 --------
meta/recipes-core/zlib/zlib/cc.patch | 27 ------
.../zlib/zlib/ldflags-tests.patch | 45 ----------
.../zlib/{zlib_1.2.12.bb => zlib_1.2.13.bb} | 12 ++-
meta/recipes-devtools/rust/rust_1.63.0.bb | 1 -
.../lighttpd/lighttpd/CVE-2022-41556.patch | 31 -------
...{lighttpd_1.4.66.bb => lighttpd_1.4.67.bb} | 3 +-
...d-in-native-OE-builds-by-not-looking.patch | 6 +-
.../{libsdl2_2.24.0.bb => libsdl2_2.24.1.bb} | 2 +-
.../{mesa-gl_22.2.0.bb => mesa-gl_22.2.2.bb} | 0
meta/recipes-graphics/mesa/mesa.inc | 4 +-
.../mesa/{mesa_22.2.0.bb => mesa_22.2.2.bb} | 0
.../vulkan/vulkan-samples_git.bb | 2 +-
.../xorg-xserver/xserver-xorg.inc | 6 +-
.../kern-tools/kern-tools-native_git.bb | 2 +-
.../linux-firmware/linux-firmware_20220913.bb | 18 ++++
.../linux/linux-yocto-rt_5.15.bb | 6 +-
.../linux/linux-yocto-rt_5.19.bb | 6 +-
.../linux/linux-yocto-tiny_5.15.bb | 6 +-
.../linux/linux-yocto-tiny_5.19.bb | 6 +-
meta/recipes-kernel/linux/linux-yocto_5.15.bb | 26 +++---
meta/recipes-kernel/linux/linux-yocto_5.19.bb | 26 +++---
...ttng-ust_2.13.4.bb => lttng-ust_2.13.5.bb} | 2 +-
...r-APNG-encoder-property-registration.patch | 86 +++++++++++++++++++
.../gstreamer/gstreamer1.0-libav_1.20.3.bb | 4 +-
...fdo_1.12.1.bb => wpebackend-fdo_1.14.0.bb} | 2 +-
...-Raise-the-size-of-arrays-containing.patch | 2 +-
.../libcap/{libcap_2.65.bb => libcap_2.66.bb} | 2 +-
.../{libical_3.0.14.bb => libical_3.0.15.bb} | 2 +-
.../{libksba_1.6.0.bb => libksba_1.6.2.bb} | 2 +-
meta/recipes-support/numactl/numactl_git.bb | 4 +-
meta/recipes-support/vim/vim.inc | 4 +-
scripts/lib/wic/partition.py | 7 +-
scripts/lib/wic/plugins/imager/direct.py | 3 +
scripts/lib/wic/plugins/source/rootfs.py | 2 +-
49 files changed, 236 insertions(+), 339 deletions(-)
delete mode 100644 meta/recipes-core/zlib/zlib/0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch
delete mode 100644 meta/recipes-core/zlib/zlib/0001-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch
delete mode 100644 meta/recipes-core/zlib/zlib/0001-Fix-extra-field-processing-bug-that-dereferences-NUL.patch
delete mode 100644 meta/recipes-core/zlib/zlib/cc.patch
delete mode 100644 meta/recipes-core/zlib/zlib/ldflags-tests.patch
rename meta/recipes-core/zlib/{zlib_1.2.12.bb => zlib_1.2.13.bb} (68%)
delete mode 100644 meta/recipes-extended/lighttpd/lighttpd/CVE-2022-41556.patch
rename meta/recipes-extended/lighttpd/{lighttpd_1.4.66.bb => lighttpd_1.4.67.bb} (96%)
rename meta/recipes-graphics/libsdl2/{libsdl2_2.24.0.bb => libsdl2_2.24.1.bb} (97%)
rename meta/recipes-graphics/mesa/{mesa-gl_22.2.0.bb => mesa-gl_22.2.2.bb} (100%)
rename meta/recipes-graphics/mesa/{mesa_22.2.0.bb => mesa_22.2.2.bb} (100%)
rename meta/recipes-kernel/lttng/{lttng-ust_2.13.4.bb => lttng-ust_2.13.5.bb} (95%)
create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-libav-Fix-for-APNG-encoder-property-registration.patch
rename meta/recipes-sato/webkit/{wpebackend-fdo_1.12.1.bb => wpebackend-fdo_1.14.0.bb} (90%)
rename meta/recipes-support/libcap/{libcap_2.65.bb => libcap_2.66.bb} (96%)
rename meta/recipes-support/libical/{libical_3.0.14.bb => libical_3.0.15.bb} (96%)
rename meta/recipes-support/libksba/{libksba_1.6.0.bb => libksba_1.6.2.bb} (94%)

--
2.25.1


[dunfell 0/8] Pull request (cover letter only)

Steve Sakoman
 

The following changes since commit 54bbfe94ae4514386c572564bf221edfdbb2ce38:

selftest: skip virgl test on all Alma Linux (2022-10-21 06:28:52 -1000)

are available in the Git repository at:

https://git.openembedded.org/openembedded-core-contrib stable/dunfell-next
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=stable/dunfell-next

Alexander Kanavin (1):
tzdata: update to 2022d

Bartosz Golaszewski (1):
bluez5: add dbus to RDEPENDS

Daniel McGregor (1):
coreutils: add openssl PACKAGECONFIG

Frank de Brabander (1):
cve-update-db-native: add timeout to urlopen() calls

Hitendra Prajapati (2):
golang: CVE-2022-2880 ReverseProxy should not forward unparseable
query parameters
libX11: CVE-2022-3554 Fix memory leak

Ranjitsinh Rathod (1):
expat: Fix CVE-2022-43680 for expat

Teoh Jay Shen (1):
vim: Upgrade 9.0.0598 -> 9.0.0614

meta/recipes-connectivity/bluez5/bluez5.inc | 1 +
meta/recipes-core/coreutils/coreutils_8.31.bb | 1 +
.../expat/expat/CVE-2022-43680.patch | 33 ++++
meta/recipes-core/expat/expat_2.2.9.bb | 1 +
.../recipes-core/meta/cve-update-db-native.bb | 9 +-
meta/recipes-devtools/go/go-1.14.inc | 1 +
.../go/go-1.14/CVE-2022-2880.patch | 164 ++++++++++++++++++
meta/recipes-extended/timezone/timezone.inc | 6 +-
.../xorg-lib/libx11/CVE-2022-3554.patch | 58 +++++++
.../recipes-graphics/xorg-lib/libx11_1.6.9.bb | 1 +
meta/recipes-support/vim/vim.inc | 4 +-
11 files changed, 272 insertions(+), 7 deletions(-)
create mode 100644 meta/recipes-core/expat/expat/CVE-2022-43680.patch
create mode 100644 meta/recipes-devtools/go/go-1.14/CVE-2022-2880.patch
create mode 100644 meta/recipes-graphics/xorg-lib/libx11/CVE-2022-3554.patch

--
2.25.1


[kirkstone][PATCH] lttng-tools: Upgrade 2.13.4 -> 2.13.8

Xiangyu Chen
 

From: Xiangyu Chen <xiangyu.chen@...>

Signed-off-by: Xiangyu Chen <xiangyu.chen@...>
---
.../{lttng-tools_2.13.4.bb => lttng-tools_2.13.8.bb} | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
rename meta/recipes-kernel/lttng/{lttng-tools_2.13.4.bb => lttng-tools_2.13.8.bb} (90%)

diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.13.4.bb b/meta/recipes-kernel/lttng/lttng-tools_2.13.8.bb
similarity index 90%
rename from meta/recipes-kernel/lttng/lttng-tools_2.13.4.bb
rename to meta/recipes-kernel/lttng/lttng-tools_2.13.8.bb
index 0ea4da05ce..a814eb79f9 100644
--- a/meta/recipes-kernel/lttng/lttng-tools_2.13.4.bb
+++ b/meta/recipes-kernel/lttng/lttng-tools_2.13.8.bb
@@ -39,7 +39,7 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
file://disable-tests.patch \
"

-SRC_URI[sha256sum] = "565f3102410a53d484f4c8ff517978f1dc59f67f9d16f872f4357f3ca12200f6"
+SRC_URI[sha256sum] = "b1e959579b260790930b20f3c7aa7cefb8a40e0de80d4a777c2bf78c6b353dc1"

inherit autotools ptest pkgconfig useradd python3-dir manpages systemd

@@ -113,7 +113,7 @@ do_install_ptest () {
for f in $(find "${B}/tests/$d" -maxdepth 1 -executable -type f -printf '%P ') ; do
cp ${B}/tests/$d/$f ${D}${PTEST_PATH}/tests/`dirname $d`/$f
case $f in
- *.so|userspace-probe-elf-binary)
+ *.so|userspace-probe-elf-*)
install -d ${D}${PTEST_PATH}/tests/$d/
ln -s ../$f ${D}${PTEST_PATH}/tests/$d/$f
# Remove any rpath/runpath to pass QA check.
@@ -124,6 +124,7 @@ do_install_ptest () {
done

chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary
+ chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary
chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libbar.so
chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libfoo.so

@@ -185,4 +186,10 @@ do_install_ptest () {
INHIBIT_PACKAGE_STRIP_FILES = "\
${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary \
${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary \
+ ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary \
+ ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/.libs/userspace-probe-elf-cxx-binary \
+ ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/gen-syscall-events \
+ ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/.libs/gen-syscall-events \
+ ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack \
+ ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/.libs/gen-syscall-events-callstack \
"
--
2.34.1


[PATCH v3] systemd: Fix 252 release build on musl

Khem Raj
 

Signed-off-by: Khem Raj <raj.khem@...>
Cc: Luca Boccassi <luca.boccassi@...>
---
v2: Replace the utmp patch with an upstream backport
v3: Drop unrelated recipe changes

.../0001-Adjust-for-musl-headers.patch | 84 +---------
....c-Use-net-if.h-for-getting-IFF_LOOP.patch | 27 +++
...trerror-is-assumed-to-be-GNU-specifi.patch | 42 +++++
...-test-utmp.c-only-if-UTMP-is-enabled.patch | 44 +++++
.../0002-Add-sys-stat.h-for-S_IFDIR.patch | 4 +-
...k-parse_printf_format-implementation.patch | 22 +--
...missing.h-check-for-missing-strndupa.patch | 158 ++----------------
...OB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch | 29 ++--
...10-Use-uintmax_t-for-handling-rlim_t.patch | 14 +-
...T_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | 14 +-
...patible-basename-for-non-glibc-syste.patch | 8 +-
...uffering-when-writing-to-oom_score_a.patch | 4 +-
...compliant-strerror_r-from-GNU-specif.patch | 22 ++-
...-not-disable-buffer-in-writing-files.patch | 100 ++++-------
.../systemd/0026-Handle-missing-gshadow.patch | 14 +-
meta/recipes-core/systemd/systemd_252.bb | 5 +-
16 files changed, 218 insertions(+), 373 deletions(-)
create mode 100644 meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
create mode 100644 meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
create mode 100644 meta/recipes-core/systemd/systemd/0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch

diff --git a/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
index bce1ca4563..6496280dda 100644
--- a/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
+++ b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
@@ -47,8 +47,6 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/udev/udev-builtin-net_id.c | 2 +-
37 files changed, 44 insertions(+), 42 deletions(-)

-diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
-index b346a50d78..7884d4c1cd 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -5,7 +5,7 @@
@@ -60,8 +58,6 @@ index b346a50d78..7884d4c1cd 100644
#include <linux/if_infiniband.h>

#include "sd-dhcp6-client.h"
-diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
-index 8ff0eb1360..7e06b8d57d 100644
--- a/src/network/netdev/bareudp.c
+++ b/src/network/netdev/bareudp.c
@@ -2,7 +2,7 @@
@@ -73,8 +69,6 @@ index 8ff0eb1360..7e06b8d57d 100644

#include "bareudp.h"
#include "netlink-util.h"
-diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
-index 15f3aee3a6..ec76428436 100644
--- a/src/network/netdev/batadv.c
+++ b/src/network/netdev/batadv.c
@@ -3,7 +3,7 @@
@@ -86,8 +80,6 @@ index 15f3aee3a6..ec76428436 100644

#include "batadv.h"
#include "fileio.h"
-diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
-index 5d94aa1d68..4e379a326d 100644
--- a/src/network/netdev/bond.c
+++ b/src/network/netdev/bond.c
@@ -1,7 +1,7 @@
@@ -99,8 +91,6 @@ index 5d94aa1d68..4e379a326d 100644

#include "alloc-util.h"
#include "bond.h"
-diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
-index b974f2ae0a..9a5f18d556 100644
--- a/src/network/netdev/bridge.c
+++ b/src/network/netdev/bridge.c
@@ -2,7 +2,7 @@
@@ -112,8 +102,6 @@ index b974f2ae0a..9a5f18d556 100644
#include <linux/if_bridge.h>

#include "bridge.h"
-diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
-index 00df1d2787..77b506b422 100644
--- a/src/network/netdev/dummy.c
+++ b/src/network/netdev/dummy.c
@@ -1,6 +1,6 @@
@@ -124,8 +112,6 @@ index 00df1d2787..77b506b422 100644

#include "dummy.h"

-diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
-index 224c17e979..fb79cc13f6 100644
--- a/src/network/netdev/geneve.c
+++ b/src/network/netdev/geneve.c
@@ -2,7 +2,7 @@
@@ -137,8 +123,6 @@ index 224c17e979..fb79cc13f6 100644

#include "alloc-util.h"
#include "conf-parser.h"
-diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
-index d7ff44cb9e..e037629ae4 100644
--- a/src/network/netdev/ifb.c
+++ b/src/network/netdev/ifb.c
@@ -1,7 +1,7 @@
@@ -150,8 +134,6 @@ index d7ff44cb9e..e037629ae4 100644

#include "ifb.h"

-diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
-index e0ff9e8c62..ab085c1f6d 100644
--- a/src/network/netdev/ipoib.c
+++ b/src/network/netdev/ipoib.c
@@ -1,6 +1,6 @@
@@ -162,8 +144,6 @@ index e0ff9e8c62..ab085c1f6d 100644
#include <linux/if_link.h>

#include "ipoib.h"
-diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
-index d15766cd7b..60728b4f94 100644
--- a/src/network/netdev/ipvlan.c
+++ b/src/network/netdev/ipvlan.c
@@ -2,7 +2,7 @@
@@ -175,8 +155,6 @@ index d15766cd7b..60728b4f94 100644

#include "conf-parser.h"
#include "ipvlan.h"
-diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
-index f1a566a9ca..1f37927a83 100644
--- a/src/network/netdev/macsec.c
+++ b/src/network/netdev/macsec.c
@@ -1,7 +1,7 @@
@@ -188,8 +166,6 @@ index f1a566a9ca..1f37927a83 100644
#include <linux/if_ether.h>
#include <linux/if_macsec.h>
#include <linux/genetlink.h>
-diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
-index c41be6e78f..ee2660c5bf 100644
--- a/src/network/netdev/macvlan.c
+++ b/src/network/netdev/macvlan.c
@@ -2,7 +2,7 @@
@@ -201,8 +177,6 @@ index c41be6e78f..ee2660c5bf 100644

#include "conf-parser.h"
#include "macvlan.h"
-diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
-index 8e7fe11c18..701ab2bd69 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -2,7 +2,7 @@
@@ -214,8 +188,6 @@ index 8e7fe11c18..701ab2bd69 100644
#include <unistd.h>

#include "alloc-util.h"
-diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
-index 15d5c132f9..a3ffa48b15 100644
--- a/src/network/netdev/netdevsim.c
+++ b/src/network/netdev/netdevsim.c
@@ -1,6 +1,6 @@
@@ -226,8 +198,6 @@ index 15d5c132f9..a3ffa48b15 100644

#include "netdevsim.h"

-diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
-index ff372092e6..eef66811f4 100644
--- a/src/network/netdev/nlmon.c
+++ b/src/network/netdev/nlmon.c
@@ -1,6 +1,6 @@
@@ -238,8 +208,6 @@ index ff372092e6..eef66811f4 100644

#include "nlmon.h"

-diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
-index 97e534fe99..0302c1cb94 100644
--- a/src/network/netdev/tunnel.c
+++ b/src/network/netdev/tunnel.c
@@ -2,7 +2,7 @@
@@ -251,8 +219,6 @@ index 97e534fe99..0302c1cb94 100644
#include <linux/if_tunnel.h>
#include <linux/ip.h>
#include <linux/ip6_tunnel.h>
-diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
-index 380547ee1e..137c1adf8a 100644
--- a/src/network/netdev/vcan.c
+++ b/src/network/netdev/vcan.c
@@ -1,6 +1,6 @@
@@ -263,8 +229,6 @@ index 380547ee1e..137c1adf8a 100644

#include "vcan.h"

-diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
-index c946e81fc0..d1a6be73f9 100644
--- a/src/network/netdev/veth.c
+++ b/src/network/netdev/veth.c
@@ -3,7 +3,7 @@
@@ -276,8 +240,6 @@ index c946e81fc0..d1a6be73f9 100644
#include <linux/veth.h>

#include "netlink-util.h"
-diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
-index af3e77963e..efa4b0a164 100644
--- a/src/network/netdev/vlan.c
+++ b/src/network/netdev/vlan.c
@@ -2,7 +2,7 @@
@@ -289,8 +251,6 @@ index af3e77963e..efa4b0a164 100644
#include <linux/if_vlan.h>

#include "parse-util.h"
-diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
-index b1b6707441..1c6d1982e1 100644
--- a/src/network/netdev/vrf.c
+++ b/src/network/netdev/vrf.c
@@ -2,7 +2,7 @@
@@ -302,8 +262,6 @@ index b1b6707441..1c6d1982e1 100644

#include "vrf.h"

-diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
-index a0ba048eb1..875f2e5901 100644
--- a/src/network/netdev/vxcan.c
+++ b/src/network/netdev/vxcan.c
@@ -1,7 +1,7 @@
@@ -315,8 +273,6 @@ index a0ba048eb1..875f2e5901 100644

#include "vxcan.h"

-diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
-index 30b0855598..a065158801 100644
--- a/src/network/netdev/vxlan.c
+++ b/src/network/netdev/vxlan.c
@@ -2,7 +2,7 @@
@@ -328,8 +284,6 @@ index 30b0855598..a065158801 100644

#include "conf-parser.h"
#include "alloc-util.h"
-diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
-index 88f668753a..5fc753384b 100644
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -6,7 +6,7 @@
@@ -341,8 +295,6 @@ index 88f668753a..5fc753384b 100644
#include <linux/ipv6_route.h>

#include "sd-resolve.h"
-diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
-index ef5e735b2b..419afd75f2 100644
--- a/src/network/netdev/xfrm.c
+++ b/src/network/netdev/xfrm.c
@@ -1,6 +1,6 @@
@@ -353,8 +305,6 @@ index ef5e735b2b..419afd75f2 100644

#include "missing_network.h"
#include "xfrm.h"
-diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
-index 10025a97ae..a0239ea83a 100644
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -1,7 +1,5 @@
@@ -374,8 +324,6 @@ index 10025a97ae..a0239ea83a 100644

#define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U

-diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
-index 7996960bd1..e870b9ba26 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -1,7 +1,8 @@
@@ -387,9 +335,7 @@ index 7996960bd1..e870b9ba26 100644
+#include <net/if.h>

#include "bus-error.h"
- #include "dhcp-identifier.h"
-diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c
-index 7be9713d46..e830fcd575 100644
+ #include "bus-locator.h"
--- a/src/network/networkd-dhcp-prefix-delegation.c
+++ b/src/network/networkd-dhcp-prefix-delegation.c
@@ -1,7 +1,5 @@
@@ -409,8 +355,6 @@ index 7be9713d46..e830fcd575 100644
bool link_dhcp_pd_is_enabled(Link *link) {
assert(link);

-diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
-index 9acfd17d49..3108289602 100644
--- a/src/network/networkd-dhcp-server.c
+++ b/src/network/networkd-dhcp-server.c
@@ -1,7 +1,7 @@
@@ -422,8 +366,6 @@ index 9acfd17d49..3108289602 100644
#include <linux/if.h>

#include "sd-dhcp-server.h"
-diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
-index cb9c428ae9..a35d58f3f1 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -3,7 +3,7 @@
@@ -435,21 +377,17 @@ index cb9c428ae9..a35d58f3f1 100644

#include "alloc-util.h"
#include "dhcp-client-internal.h"
-diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
-index dc09171afe..5b93ef3dd4 100644
--- a/src/network/networkd-ipv6ll.c
+++ b/src/network/networkd-ipv6ll.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-
+
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
-
+
#include "in-addr-util.h"
#include "networkd-address.h"
-diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
-index 63679505f7..825ea76ff2 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -3,7 +3,7 @@
@@ -461,8 +399,6 @@ index 63679505f7..825ea76ff2 100644
#include <linux/if_link.h>
#include <linux/netdevice.h>
#include <sys/socket.h>
-diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
-index efe407fedb..46a086cdf5 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -6,7 +6,7 @@
@@ -471,11 +407,9 @@ index efe407fedb..46a086cdf5 100644
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
-
+
#include "sd-ndisc.h"
-
-diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
-index 934fed3b7f..fdb89313dd 100644
+
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1,9 +1,5 @@
@@ -499,8 +433,6 @@ index 934fed3b7f..fdb89313dd 100644
int route_new(Route **ret) {
_cleanup_(route_freep) Route *route = NULL;

-diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
-index e00cc1e589..e392c7e1a2 100644
--- a/src/network/networkd-setlink.c
+++ b/src/network/networkd-setlink.c
@@ -2,7 +2,7 @@
@@ -512,8 +444,6 @@ index e00cc1e589..e392c7e1a2 100644
#include <linux/if_bridge.h>

#include "missing_network.h"
-diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
-index cf20b6dba5..c3a46dda11 100644
--- a/src/shared/linux/ethtool.h
+++ b/src/shared/linux/ethtool.h
@@ -16,7 +16,8 @@
@@ -526,8 +456,6 @@ index cf20b6dba5..c3a46dda11 100644

#ifndef __KERNEL__
#include <limits.h> /* for INT_MAX */
-diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
-index f56c5646c1..5af28ff119 100644
--- a/src/shared/netif-util.c
+++ b/src/shared/netif-util.c
@@ -1,7 +1,7 @@
@@ -539,8 +467,6 @@ index f56c5646c1..5af28ff119 100644

#include "arphrd-util.h"
#include "device-util.h"
-diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
-index f2ea2a7cd5..fe60a0744d 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -18,7 +18,7 @@
diff --git a/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch b/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
new file mode 100644
index 0000000000..835bb21be7
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
@@ -0,0 +1,27 @@
+From 4a464ea4aaed5184a70b2e1ac77e4a955443d067 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Tue, 8 Nov 2022 12:21:35 -0800
+Subject: [PATCH] networkd-ipv4acd.c: Use net/if.h for getting IFF_LOOPBACK definition
+
+This helps in avoiding compiling errors on musl. Definition of
+IFF_LOOPBACK is the reason for including linux/if_arp.h, this however
+could be obtained from net/if.h glibc header equally and makes it
+portable as well.
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/25304]
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/network/networkd-ipv4acd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/network/networkd-ipv4acd.c
++++ b/src/network/networkd-ipv4acd.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++#include <net/if.h> /* IFF_LOOPBACK */
++#include <net/if_arp.h> /* ARPHRD_ETHER */
+
+ #include "sd-dhcp-client.h"
+ #include "sd-ipv4acd.h"
diff --git a/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch b/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
new file mode 100644
index 0000000000..c02d495d31
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
@@ -0,0 +1,42 @@
+From 5b5675913e2dbe6c5acda935b5814a8991829ec5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Tue, 8 Nov 2022 13:31:34 -0800
+Subject: [PATCH 2/2] test-bus-error: strerror() is assumed to be GNU specific version mark it so
+
+Upstream-Status: Inappropriate [Upstream systemd only supports glibc]
+
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/libsystemd/sd-bus/test-bus-error.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/src/libsystemd/sd-bus/test-bus-error.c
++++ b/src/libsystemd/sd-bus/test-bus-error.c
+@@ -99,7 +99,9 @@ TEST(error) {
+ assert_se(!sd_bus_error_is_set(&error));
+ assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY);
+ assert_se(streq(error.name, "System.Error.EBUSY"));
++#ifdef __GLIBC__
+ assert_se(streq(error.message, STRERROR(EBUSY)));
++#endif
+ assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY"));
+ assert_se(sd_bus_error_get_errno(&error) == EBUSY);
+ assert_se(sd_bus_error_is_set(&error));
+--- a/src/test/test-errno-util.c
++++ b/src/test/test-errno-util.c
+@@ -4,7 +4,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tests.h"
+-
++#ifdef __GLIBC__
+ TEST(strerror_not_threadsafe) {
+ /* Just check that strerror really is not thread-safe. */
+ log_info("strerror(%d) → %s", 200, strerror(200));
+@@ -46,5 +46,6 @@ TEST(STRERROR_OR_ELSE) {
+ log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM));
+ log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM));
+ }
++#endif /* __GLIBC__ */
+
+ DEFINE_TEST_MAIN(LOG_INFO);
diff --git a/meta/recipes-core/systemd/systemd/0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch b/meta/recipes-core/systemd/systemd/0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch
new file mode 100644
index 0000000000..df0f1b0131
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch
@@ -0,0 +1,44 @@
+From 41cac2a8b98fc5faebe942c697b17e109822342d Mon Sep 17 00:00:00 2001
+From: Torsten Hilbrich <torsten.hilbrich@...>
+Date: Mon, 7 Nov 2022 08:38:58 +0100
+Subject: [PATCH] test: compile test-utmp.c only if UTMP is enabled
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When compiling with -D utmp=false the compilation fails with:
+
+../../git/systemd/src/test/test-utmp.c: In function ‘test_dump_run_utmp’:
+../../git/systemd/src/test/test-utmp.c:21:9: error: cleanup argument not a function
+ 21 | _unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
+ | ^~~~~~~~
+../../git/systemd/src/test/test-utmp.c:23:17: error: implicit declaration of function ‘utxent_start’ [-Werror=implicit-function-declaration]
+ 23 | utmpx = utxent_start();
+ | ^~~~~~~~~~~~
+
+any many other errors
+
+Add a conditional to compile test-utmp.c only if ENABLE_UTMP is true.
+Upstream-Status: Backport [https://github.com/systemd/systemd/pull/25278]
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/test/meson.build | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/test/meson.build b/src/test/meson.build
+index 86fc1d4fc0..2a4dfe26db 100644
+--- a/src/test/meson.build
++++ b/src/test/meson.build
+@@ -622,7 +622,8 @@ tests += [
+
+ [files('test-journal-importer.c')],
+
+- [files('test-utmp.c')],
++ [files('test-utmp.c'),
++ [], [], [], 'ENABLE_UTMP'],
+
+ [files('test-udev.c'),
+ [libudevd_core,
+--
+2.38.1
+
diff --git a/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
index 58767c7c35..e6abaadfcb 100644
--- a/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
+++ b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
@@ -13,11 +13,9 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/shared/mkdir-label.c | 1 +
1 file changed, 1 insertion(+)

-diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c
-index 5b1ac5d1e0..fa5802b894 100644
--- a/src/shared/mkdir-label.c
+++ b/src/shared/mkdir-label.c
-@@ -6,6 +6,7 @@
+@@ -7,6 +7,7 @@
#include "selinux-util.h"
#include "smack-util.h"
#include "user-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
index 0c85f2bcbe..f9c7ced947 100644
--- a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
+++ b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
@@ -22,11 +22,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
create mode 100644 src/basic/parse-printf-format.c
create mode 100644 src/basic/parse-printf-format.h

-diff --git a/meson.build b/meson.build
-index 36cbfa4893..30b5305b89 100644
--- a/meson.build
+++ b/meson.build
-@@ -694,6 +694,7 @@ endif
+@@ -739,6 +739,7 @@ endif
foreach header : ['crypt.h',
'linux/memfd.h',
'linux/vm_sockets.h',
@@ -34,11 +32,9 @@ index 36cbfa4893..30b5305b89 100644
'sys/auxv.h',
'valgrind/memcheck.h',
'valgrind/valgrind.h',
-diff --git a/src/basic/meson.build b/src/basic/meson.build
-index 9b89fdcdea..0b1ef91016 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
-@@ -336,6 +336,11 @@ endforeach
+@@ -337,6 +337,11 @@ endforeach

basic_sources += generated_gperf_headers

@@ -50,9 +46,6 @@ index 9b89fdcdea..0b1ef91016 100644
############################################################

arch_list = [
-diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
-new file mode 100644
-index 0000000000..49437e5445
--- /dev/null
+++ b/src/basic/parse-printf-format.c
@@ -0,0 +1,273 @@
@@ -329,9 +322,6 @@ index 0000000000..49437e5445
+
+ return last;
+}
-diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
-new file mode 100644
-index 0000000000..47be7522d7
--- /dev/null
+++ b/src/basic/parse-printf-format.h
@@ -0,0 +1,57 @@
@@ -392,8 +382,6 @@ index 0000000000..47be7522d7
+size_t parse_printf_format(const char *fmt, size_t n, int *types);
+
+#endif /* HAVE_PRINTF_H */
-diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
-index 69d7062ec6..f55c5aab2c 100644
--- a/src/basic/stdio-util.h
+++ b/src/basic/stdio-util.h
@@ -1,13 +1,13 @@
@@ -409,10 +397,8 @@ index 69d7062ec6..f55c5aab2c 100644
#include "memory-util.h"
+#include "parse-printf-format.h"

- #define snprintf_ok(buf, len, fmt, ...) \
- ({ \
-diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
-index 1e10ed5524..e6ceba54f9 100644
+ #define snprintf_ok(buf, len, fmt, ...) \
+ ({ \
--- a/src/libsystemd/sd-journal/journal-send.c
+++ b/src/libsystemd/sd-journal/journal-send.c
@@ -2,7 +2,6 @@
diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
index 9e02666698..2c33033e91 100644
--- a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
+++ b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
@@ -72,11 +72,9 @@ Signed-off-by: Luca Boccassi <luca.boccassi@...>
src/udev/udev-rules.c | 1 +
52 files changed, 63 insertions(+)

-diff --git a/meson.build b/meson.build
-index 30b5305b89..0189ef8ce6 100644
--- a/meson.build
+++ b/meson.build
-@@ -512,6 +512,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
+@@ -557,6 +557,7 @@ foreach ident : ['secure_getenv', '__sec
endforeach

foreach ident : [
@@ -84,8 +82,6 @@ index 30b5305b89..0189ef8ce6 100644
['memfd_create', '''#include <sys/mman.h>'''],
['gettid', '''#include <sys/types.h>
#include <unistd.h>'''],
-diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
-index a4e5d77f6c..fc12da4c53 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -20,6 +20,7 @@
@@ -94,10 +90,8 @@ index a4e5d77f6c..fc12da4c53 100644
#include "util.h"
+#include "missing_stdlib.h"

- static int help(void) {
- _cleanup_free_ char *link = NULL;
-diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
-index b03cc70e2e..f4615ffce1 100644
+ #define PCI_CLASS_GRAPHICS_CARD 0x30000
+
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -37,6 +37,7 @@
@@ -108,8 +102,6 @@ index b03cc70e2e..f4615ffce1 100644

static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
_cleanup_free_ char *fs = NULL;
-diff --git a/src/basic/env-util.c b/src/basic/env-util.c
-index 885967e7f3..d0b7dc845e 100644
--- a/src/basic/env-util.c
+++ b/src/basic/env-util.c
@@ -19,6 +19,7 @@
@@ -120,8 +112,6 @@ index 885967e7f3..d0b7dc845e 100644

/* We follow bash for the character set. Different shells have different rules. */
#define VALID_BASH_ENV_NAME_CHARS \
-diff --git a/src/basic/log.c b/src/basic/log.c
-index 12071e2ebd..15254c7bbc 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -36,6 +36,7 @@
@@ -132,8 +122,6 @@ index 12071e2ebd..15254c7bbc 100644

#define SNDBUF_SIZE (8*1024*1024)

-diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h
-index 8c76f93eb2..9068bfb4f0 100644
--- a/src/basic/missing_stdlib.h
+++ b/src/basic/missing_stdlib.h
@@ -11,3 +11,15 @@
@@ -152,8 +140,6 @@ index 8c76f93eb2..9068bfb4f0 100644
+ (char *)memcpy(__new, __old, __len); \
+ })
+#endif
-diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
-index 51a0d74e87..03569f71f8 100644
--- a/src/basic/mkdir.c
+++ b/src/basic/mkdir.c
@@ -15,6 +15,7 @@
@@ -164,8 +150,6 @@ index 51a0d74e87..03569f71f8 100644

int mkdir_safe_internal(
const char *path,
-diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
-index 82a33a6829..d947774b40 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -13,6 +13,7 @@
@@ -176,8 +160,6 @@ index 82a33a6829..d947774b40 100644
#include "mountpoint-util.h"
#include "nulstr-util.h"
#include "parse-util.h"
-diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
-index 2888ab6523..d941afec2d 100644
--- a/src/basic/parse-util.c
+++ b/src/basic/parse-util.c
@@ -18,6 +18,7 @@
@@ -188,8 +170,6 @@ index 2888ab6523..d941afec2d 100644

int parse_boolean(const char *v) {
if (!v)
-diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
-index 6fb8c40e7a..c4b59e8518 100644
--- a/src/basic/path-lookup.c
+++ b/src/basic/path-lookup.c
@@ -16,6 +16,7 @@
@@ -200,8 +180,6 @@ index 6fb8c40e7a..c4b59e8518 100644

int xdg_user_runtime_dir(char **ret, const char *suffix) {
const char *e;
-diff --git a/src/basic/percent-util.c b/src/basic/percent-util.c
-index cab9d0eaea..5f6ca258e9 100644
--- a/src/basic/percent-util.c
+++ b/src/basic/percent-util.c
@@ -3,6 +3,7 @@
@@ -212,8 +190,6 @@ index cab9d0eaea..5f6ca258e9 100644

static int parse_parts_value_whole(const char *p, const char *symbol) {
const char *pc, *n;
-diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
-index 410b8a3eb5..f2c4355609 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -15,6 +15,7 @@
@@ -224,8 +200,6 @@ index 410b8a3eb5..f2c4355609 100644

int proc_cmdline(char **ret) {
const char *e;
-diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
-index 65f96abb06..e485a0196b 100644
--- a/src/basic/procfs-util.c
+++ b/src/basic/procfs-util.c
@@ -12,6 +12,7 @@
@@ -236,8 +210,6 @@ index 65f96abb06..e485a0196b 100644

int procfs_get_pid_max(uint64_t *ret) {
_cleanup_free_ char *value = NULL;
-diff --git a/src/basic/time-util.c b/src/basic/time-util.c
-index b659d6905d..020112be24 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -26,6 +26,7 @@
@@ -248,8 +220,6 @@ index b659d6905d..020112be24 100644

static clockid_t map_clock_id(clockid_t c) {

-diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c
-index d9c901d73b..79a035274c 100644
--- a/src/boot/bless-boot.c
+++ b/src/boot/bless-boot.c
@@ -22,6 +22,7 @@
@@ -260,8 +230,6 @@ index d9c901d73b..79a035274c 100644

static char **arg_path = NULL;

-diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
-index f0d8759e85..b4c1053e64 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -21,6 +21,7 @@
@@ -272,8 +240,6 @@ index f0d8759e85..b4c1053e64 100644
#include "socket-util.h"

BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
-diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
-index 5c499e5d06..e7ab1bb9a5 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -44,6 +44,7 @@
@@ -284,8 +250,6 @@ index 5c499e5d06..e7ab1bb9a5 100644

BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
-diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c
-index 32a2ec0ff9..36be2511e4 100644
--- a/src/core/dbus-util.c
+++ b/src/core/dbus-util.c
@@ -9,6 +9,7 @@
@@ -296,11 +260,9 @@ index 32a2ec0ff9..36be2511e4 100644

int bus_property_get_triggered_unit(
sd_bus *bus,
-diff --git a/src/core/execute.c b/src/core/execute.c
-index 2762b10287..a8aeec7f6e 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
-@@ -103,6 +103,7 @@
+@@ -104,6 +104,7 @@
#include "unit-serialize.h"
#include "user-util.h"
#include "utmp-wtmp.h"
@@ -308,8 +270,6 @@ index 2762b10287..a8aeec7f6e 100644

#define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
#define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
-diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
-index f4488dd692..1d331a7ee2 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -11,6 +11,7 @@
@@ -320,8 +280,6 @@ index f4488dd692..1d331a7ee2 100644

#if HAVE_KMOD
#include "module-util.h"
-diff --git a/src/core/service.c b/src/core/service.c
-index 9f7af9dffb..3ec5e30c8b 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -42,6 +42,7 @@
@@ -331,9 +289,7 @@ index 9f7af9dffb..3ec5e30c8b 100644
+#include "missing_stdlib.h"

#define service_spawn(...) service_spawn_internal(__func__, __VA_ARGS__)
-
-diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c
-index c6e201ecf2..ab034475e2 100644
+
--- a/src/coredump/coredump-vacuum.c
+++ b/src/coredump/coredump-vacuum.c
@@ -17,6 +17,7 @@
@@ -344,11 +300,9 @@ index c6e201ecf2..ab034475e2 100644

#define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
#define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
-diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
-index 9b32383a76..f8d3397a06 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
-@@ -29,6 +29,7 @@
+@@ -32,6 +32,7 @@
#include "util.h"
#include "virt.h"
#include "volatile-util.h"
@@ -356,8 +310,6 @@ index 9b32383a76..f8d3397a06 100644

typedef enum MountPointFlags {
MOUNT_NOAUTO = 1 << 0,
-diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
-index 3e3646e45f..6a8fc60f6d 100644
--- a/src/journal-remote/journal-remote-main.c
+++ b/src/journal-remote/journal-remote-main.c
@@ -24,6 +24,7 @@
@@ -368,11 +320,9 @@ index 3e3646e45f..6a8fc60f6d 100644

#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
-diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
-index cff34fd585..a5003e47e9 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
-@@ -74,6 +74,7 @@
+@@ -70,6 +70,7 @@
#include "unit-name.h"
#include "user-util.h"
#include "varlink.h"
@@ -380,20 +330,16 @@ index cff34fd585..a5003e47e9 100644

#define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
#define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
-diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
-index 96529b422b..ddb5e9c698 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
-@@ -20,6 +20,7 @@
+@@ -19,6 +19,7 @@
#include "strv.h"
#include "time-util.h"
#include "utf8.h"
+#include "missing_stdlib.h"

static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
-
-diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
-index 909dfe4d3a..254b7ce866 100644
+ static int message_parse_fields(sd_bus_message *m);
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -11,6 +11,7 @@
@@ -404,8 +350,6 @@ index 909dfe4d3a..254b7ce866 100644

static int node_vtable_get_userdata(
sd_bus *bus,
-diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
-index 14951ccb33..b7f86ca501 100644
--- a/src/libsystemd/sd-bus/bus-socket.c
+++ b/src/libsystemd/sd-bus/bus-socket.c
@@ -28,6 +28,7 @@
@@ -416,11 +360,9 @@ index 14951ccb33..b7f86ca501 100644

#define SNDBUF_SIZE (8*1024*1024)

-diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
-index 9e1d29cc1d..8c3165f0ce 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
-@@ -43,6 +43,7 @@
+@@ -44,6 +44,7 @@
#include "string-util.h"
#include "strv.h"
#include "user-util.h"
@@ -428,8 +370,6 @@ index 9e1d29cc1d..8c3165f0ce 100644

#define log_debug_bus_message(m) \
do { \
-diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c
-index 317653bedc..d028216c48 100644
--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
@@ -14,6 +14,7 @@
@@ -440,8 +380,6 @@ index 317653bedc..d028216c48 100644

#define MAX_SIZE (2*1024*1024)

-diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
-index 7a6cc4aca3..b7f7cd65c5 100644
--- a/src/libsystemd/sd-journal/sd-journal.c
+++ b/src/libsystemd/sd-journal/sd-journal.c
@@ -41,6 +41,7 @@
@@ -452,23 +390,9 @@ index 7a6cc4aca3..b7f7cd65c5 100644

#define JOURNAL_FILES_MAX 7168

-diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
-index 10d2ed7aec..4fbe3f6b4a 100644
---- a/src/locale/keymap-util.c
-+++ b/src/locale/keymap-util.c
-@@ -24,6 +24,7 @@
- #include "string-util.h"
- #include "strv.h"
- #include "tmpfile-util.h"
-+#include "missing_stdlib.h"
-
- static bool startswith_comma(const char *s, const char *prefix) {
- s = startswith(s, prefix);
-diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
-index 5bd7efc3e8..282899601e 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
-@@ -31,6 +31,7 @@
+@@ -32,6 +32,7 @@
#include "locale-util.h"
#include "login-util.h"
#include "macro.h"
@@ -476,8 +400,6 @@ index 5bd7efc3e8..282899601e 100644
#include "pam-util.h"
#include "parse-util.h"
#include "path-util.h"
-diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c
-index 063ad08d80..f9823a433b 100644
--- a/src/network/generator/network-generator.c
+++ b/src/network/generator/network-generator.c
@@ -13,6 +13,7 @@
@@ -488,8 +410,6 @@ index 063ad08d80..f9823a433b 100644

/*
# .network
-diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c
-index 1f58bf3ed4..8457a3b0e3 100644
--- a/src/nspawn/nspawn-settings.c
+++ b/src/nspawn/nspawn-settings.c
@@ -17,6 +17,7 @@
@@ -500,8 +420,6 @@ index 1f58bf3ed4..8457a3b0e3 100644

Settings *settings_new(void) {
Settings *s;
-diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
-index c64e79bdff..eda26b0b9a 100644
--- a/src/nss-mymachines/nss-mymachines.c
+++ b/src/nss-mymachines/nss-mymachines.c
@@ -21,6 +21,7 @@
@@ -512,8 +430,6 @@ index c64e79bdff..eda26b0b9a 100644

static void setup_logging_once(void) {
static pthread_once_t once = PTHREAD_ONCE_INIT;
-diff --git a/src/portable/portable.c b/src/portable/portable.c
-index 0e6461ba93..54148d5924 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -39,6 +39,7 @@
@@ -524,20 +440,16 @@ index 0e6461ba93..54148d5924 100644

/* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was
* dropped there by the portable service logic and b) for which image it was dropped there. */
-diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
-index 5b3ceeff36..d36d1d57ae 100644
--- a/src/resolve/resolvectl.c
+++ b/src/resolve/resolvectl.c
-@@ -43,6 +43,7 @@
- #include "utf8.h"
+@@ -46,6 +46,7 @@
+ #include "varlink.h"
#include "verb-log-control.h"
#include "verbs.h"
+#include "missing_stdlib.h"

static int arg_family = AF_UNSPEC;
static int arg_ifindex = 0;
-diff --git a/src/shared/bus-get-properties.c b/src/shared/bus-get-properties.c
-index 8b4f66b22e..5926e4c61b 100644
--- a/src/shared/bus-get-properties.c
+++ b/src/shared/bus-get-properties.c
@@ -4,6 +4,7 @@
@@ -548,11 +460,9 @@ index 8b4f66b22e..5926e4c61b 100644

int bus_property_get_bool(
sd_bus *bus,
-diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c
-index 87c0334fec..402ab3493b 100644
--- a/src/shared/bus-unit-procs.c
+++ b/src/shared/bus-unit-procs.c
-@@ -10,6 +10,7 @@
+@@ -11,6 +11,7 @@
#include "sort-util.h"
#include "string-util.h"
#include "terminal-util.h"
@@ -560,8 +470,6 @@ index 87c0334fec..402ab3493b 100644

struct CGroupInfo {
char *cgroup_path;
-diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
-index dcce530c99..faf5a5bda0 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -49,6 +49,7 @@
@@ -572,8 +480,6 @@ index dcce530c99..faf5a5bda0 100644

int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
assert(message);
-diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
-index 4a2b7684bc..ee6d687c58 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -21,6 +21,7 @@
@@ -583,12 +489,10 @@ index 4a2b7684bc..ee6d687c58 100644
+#include "missing_stdlib.h"

static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
- sd_event *e = userdata;
-diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
-index f54b187a1b..299758c7e4 100644
+ sd_event *e = ASSERT_PTR(userdata);
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
-@@ -17,6 +17,7 @@
+@@ -18,6 +18,7 @@
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
@@ -596,8 +500,6 @@ index f54b187a1b..299758c7e4 100644

int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
const char *n;
-diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
-index c6caf9330a..ebe33bd44a 100644
--- a/src/shared/journal-importer.c
+++ b/src/shared/journal-importer.c
@@ -15,6 +15,7 @@
@@ -608,8 +510,6 @@ index c6caf9330a..ebe33bd44a 100644

enum {
IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
-diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
-index cf83eb6bca..e672a003a3 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -42,6 +42,7 @@
@@ -620,8 +520,6 @@ index cf83eb6bca..e672a003a3 100644

/* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
#define PRINT_LINE_THRESHOLD 3
-diff --git a/src/shared/pager.c b/src/shared/pager.c
-index f75ef62d2d..530001a821 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -26,6 +26,7 @@
@@ -632,20 +530,6 @@ index f75ef62d2d..530001a821 100644

static pid_t pager_pid = 0;

-diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c
-index 1b4396a34c..c2f72b185f 100644
---- a/src/shared/uid-range.c
-+++ b/src/shared/uid-range.c
-@@ -14,6 +14,7 @@
- #include "stat-util.h"
- #include "uid-range.h"
- #include "user-util.h"
-+#include "missing_stdlib.h"
-
- static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
- assert(range);
-diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
-index 7e9ab19666..56f619e54e 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -26,6 +26,7 @@
@@ -656,8 +540,6 @@ index 7e9ab19666..56f619e54e 100644

#define BUFFER_SIZE (256 * 1024)

-diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
-index cc9a7cb838..a679614a47 100644
--- a/src/test/test-hexdecoct.c
+++ b/src/test/test-hexdecoct.c
@@ -7,6 +7,7 @@
@@ -668,8 +550,6 @@ index cc9a7cb838..a679614a47 100644
#include "tests.h"

TEST(hexchar) {
-diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
-index ae92e45205..1e6f3205cb 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -22,6 +22,7 @@
@@ -680,11 +560,9 @@ index ae92e45205..1e6f3205cb 100644

_printf_(2,3)
static void path_prepend(char **path, const char *fmt, ...) {
-diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
-index a60e4f294c..571c43765b 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
-@@ -35,6 +35,7 @@
+@@ -34,6 +34,7 @@
#include "udev-util.h"
#include "udev-watch.h"
#include "user-util.h"
@@ -692,8 +570,6 @@ index a60e4f294c..571c43765b 100644

typedef struct Spawn {
sd_device *device;
-diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
-index 1a384d6b38..0089833e3f 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -34,6 +34,7 @@
diff --git a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
index eeaaac1b9a..2a5770c515 100644
--- a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
+++ b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
@@ -23,8 +23,6 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/tmpfiles/tmpfiles.c | 10 ++++++++++
3 files changed, 38 insertions(+)

-diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
-index e026b29478..815e56ef68 100644
--- a/src/basic/glob-util.c
+++ b/src/basic/glob-util.c
@@ -12,6 +12,12 @@
@@ -48,7 +46,7 @@ index e026b29478..815e56ef68 100644
/* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
assert(!(flags & GLOB_ALTDIRFUNC));

-@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
+@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag
pglob->gl_lstat = lstat;
if (!pglob->gl_stat)
pglob->gl_stat = stat;
@@ -63,13 +61,11 @@ index e026b29478..815e56ef68 100644
if (k == GLOB_NOMATCH)
return -ENOENT;
if (k == GLOB_NOSPACE)
-diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
-index ec8b74f48f..d99a6095df 100644
--- a/src/test/test-glob-util.c
+++ b/src/test/test-glob-util.c
-@@ -13,6 +13,12 @@
- #include "tests.h"
- #include "tmpfile-util.h"
+@@ -34,6 +34,12 @@ TEST(glob_first) {
+ assert_se(first == NULL);
+ }

+/* Don't fail if the standard library
+ * doesn't provide brace expansion */
@@ -80,7 +76,7 @@ index ec8b74f48f..d99a6095df 100644
TEST(glob_exists) {
char name[] = "/tmp/test-glob_exists.XXXXXX";
int fd = -1;
-@@ -40,11 +46,13 @@ TEST(glob_no_dot) {
+@@ -61,11 +67,13 @@ TEST(glob_no_dot) {
const char *fn;

_cleanup_globfree_ glob_t g = {
@@ -94,7 +90,7 @@ index ec8b74f48f..d99a6095df 100644
};

int r;
-@@ -52,11 +60,19 @@ TEST(glob_no_dot) {
+@@ -73,11 +81,19 @@ TEST(glob_no_dot) {
assert_se(mkdtemp(template));

fn = strjoina(template, "/*");
@@ -114,13 +110,11 @@ index ec8b74f48f..d99a6095df 100644
assert_se(r == GLOB_NOMATCH);

(void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
-diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
-index fcab51c208..fdef1807ae 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
-@@ -67,6 +67,12 @@
- #include "umask-util.h"
+@@ -71,6 +71,12 @@
#include "user-util.h"
+ #include "virt.h"

+/* Don't fail if the standard library
+ * doesn't provide brace expansion */
@@ -131,7 +125,7 @@ index fcab51c208..fdef1807ae 100644
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
* them in the file system. This is intended to be used to create
* properly owned directories beneath /tmp, /var/tmp, /run, which are
-@@ -1934,7 +1940,9 @@ finish:
+@@ -2174,7 +2180,9 @@ finish:

static int glob_item(Item *i, action_t action) {
_cleanup_globfree_ glob_t g = {
@@ -140,8 +134,8 @@ index fcab51c208..fdef1807ae 100644
+#endif
};
int r = 0, k;
-
-@@ -1953,7 +1961,9 @@ static int glob_item(Item *i, action_t action) {
+
+@@ -2194,7 +2202,9 @@ static int glob_item(Item *i, action_t a

static int glob_item_recursively(Item *i, fdaction_t action) {
_cleanup_globfree_ glob_t g = {
@@ -150,3 +144,4 @@ index fcab51c208..fdef1807ae 100644
+#endif
};
int r = 0, k;
+
diff --git a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
index 3a47d09e8a..aac4ad49d7 100644
--- a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
+++ b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
@@ -27,11 +27,9 @@ Signed-off-by: Chen Qi <Qi.Chen@...>
src/core/execute.c | 4 ++--
3 files changed, 9 insertions(+), 15 deletions(-)

-diff --git a/src/basic/format-util.h b/src/basic/format-util.h
-index 8719df3e29..9becc96066 100644
--- a/src/basic/format-util.h
+++ b/src/basic/format-util.h
-@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32
# error Unknown timex member size
#endif

@@ -46,11 +44,9 @@ index 8719df3e29..9becc96066 100644

#if SIZEOF_DEV_T == 8
# define DEV_FMT "%" PRIu64
-diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
-index 33dfde9d6c..e018fd81fd 100644
--- a/src/basic/rlimit-util.c
+++ b/src/basic/rlimit-util.c
-@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, cons
fixed.rlim_max == highest.rlim_max)
return 0;

@@ -59,7 +55,7 @@ index 33dfde9d6c..e018fd81fd 100644

return RET_NERRNO(setrlimit(resource, &fixed));
}
-@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *r
if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
r = free_and_strdup(&s, "infinity");
else if (rl->rlim_cur >= RLIM_INFINITY)
@@ -86,11 +82,9 @@ index 33dfde9d6c..e018fd81fd 100644

return 1;
}
-diff --git a/src/core/execute.c b/src/core/execute.c
-index fccfb9268c..90f00e10a5 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
-@@ -5633,9 +5633,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+@@ -5869,9 +5869,9 @@ void exec_context_dump(const ExecContext
for (unsigned i = 0; i < RLIM_NLIMITS; i++)
if (c->rlimit[i]) {
fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
diff --git a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
index e1a2512ec3..6367adce07 100644
--- a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
+++ b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
@@ -31,11 +31,9 @@ Signed-off-by: Andre McCurdy <armccurdy@...>
src/shared/base-filesystem.c | 6 +++---
2 files changed, 23 insertions(+), 4 deletions(-)

-diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
-index 0bbb3f6298..3dc494dbfb 100644
--- a/src/basic/fs-util.h
+++ b/src/basic/fs-util.h
-@@ -46,8 +46,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
+@@ -47,8 +47,27 @@ int futimens_opath(int fd, const struct
int fd_warn_permissions(const char *path, int fd);
int stat_warn_permissions(const char *path, const struct stat *st);

@@ -63,12 +61,10 @@ index 0bbb3f6298..3dc494dbfb 100644
+ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0))

int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
- int touch(const char *path);
-diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
-index 6dacc1d20a..909a6818f6 100644
+
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
-@@ -131,7 +131,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -131,7 +131,7 @@ int base_filesystem_create(const char *r
return log_error_errno(errno, "Failed to open root file system: %m");

for (size_t i = 0; i < ELEMENTSOF(table); i++) {
@@ -77,7 +73,7 @@ index 6dacc1d20a..909a6818f6 100644
continue;

if (table[i].target) {
-@@ -139,7 +139,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -139,7 +139,7 @@ int base_filesystem_create(const char *r

/* check if one of the targets exists */
NULSTR_FOREACH(s, table[i].target) {
@@ -86,7 +82,7 @@ index 6dacc1d20a..909a6818f6 100644
continue;

/* check if a specific file exists at the target path */
-@@ -150,7 +150,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -150,7 +150,7 @@ int base_filesystem_create(const char *r
if (!p)
return log_oom();

diff --git a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
index 7b22d6214f..3228f1716b 100644
--- a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
+++ b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
@@ -14,13 +14,11 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/machine/machine-dbus.c | 5 +++++
1 file changed, 5 insertions(+)

-diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
-index 8f11afd65b..a2b57deb7a 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
-@@ -10,6 +10,11 @@
- #include <libgen.h>
- #undef basename
+@@ -4,6 +4,11 @@
+ #include <sys/mount.h>
+ #include <sys/wait.h>

+#if !defined(__GLIBC__)
+#include <string.h>
diff --git a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
index e5e592a837..da56d8b4b6 100644
--- a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
@@ -24,11 +24,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/basic/process-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

-diff --git a/src/basic/process-util.c b/src/basic/process-util.c
-index 6980e0c4f6..45ec26ea45 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
-@@ -1460,7 +1460,7 @@ int set_oom_score_adjust(int value) {
+@@ -1466,7 +1466,7 @@ int set_oom_score_adjust(int value) {
xsprintf(t, "%i", value);

return write_string_file("/proc/self/oom_score_adj", t,
diff --git a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
index c563982607..7533fde1e1 100644
--- a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
+++ b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
@@ -24,11 +24,9 @@ Signed-off-by: Chen Qi <Qi.Chen@...>
src/libsystemd/sd-journal/journal-send.c | 5 +++++
2 files changed, 10 insertions(+)

-diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
-index bdfa145ab7..61928f4bf3 100644
--- a/src/libsystemd/sd-bus/bus-error.c
+++ b/src/libsystemd/sd-bus/bus-error.c
-@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_er
return;

errno = 0;
@@ -41,11 +39,23 @@ index bdfa145ab7..61928f4bf3 100644
if (errno == ERANGE || strlen(x) >= k - 1) {
free(m);
k *= 2;
-diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
-index e6ceba54f9..285ebbc9ef 100644
+@@ -594,8 +599,12 @@ const char* _bus_error_message(const sd_
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
--- a/src/libsystemd/sd-journal/journal-send.c
+++ b/src/libsystemd/sd-journal/journal-send.c
-@@ -370,7 +370,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+@@ -381,7 +381,12 @@ static int fill_iovec_perror_and_send(co
char* j;

errno = 0;
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
index 00131de7d0..f76085e3af 100644
--- a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
+++ b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
@@ -43,11 +43,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/vconsole/vconsole-setup.c | 2 +-
21 files changed, 39 insertions(+), 40 deletions(-)

-diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
-index f4615ffce1..07cb8ed669 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
-@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *controller, const char *path) {
+@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *c
if (r < 0)
return r;

@@ -56,7 +54,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -805,7 +805,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
+@@ -805,7 +805,7 @@ int cg_install_release_agent(const char

sc = strstrip(contents);
if (isempty(sc)) {
@@ -65,7 +63,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;
} else if (!path_equal(sc, agent))
-@@ -823,7 +823,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
+@@ -823,7 +823,7 @@ int cg_install_release_agent(const char

sc = strstrip(contents);
if (streq(sc, "0")) {
@@ -74,7 +72,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const char *controller) {
+@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const cha
if (r < 0)
return r;

@@ -83,7 +81,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const char *controller) {
+@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const cha
if (r < 0)
return r;

@@ -92,7 +90,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -1730,7 +1730,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
+@@ -1730,7 +1730,7 @@ int cg_set_attribute(const char *control
if (r < 0)
return r;

@@ -101,11 +99,9 @@ index f4615ffce1..07cb8ed669 100644
}

int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
-diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c
-index b9120a5ed0..78e460b75f 100644
--- a/src/basic/namespace-util.c
+++ b/src/basic/namespace-util.c
-@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
+@@ -220,12 +220,12 @@ int userns_acquire(const char *uid_map,
freeze();

xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
@@ -120,11 +116,9 @@ index b9120a5ed0..78e460b75f 100644
if (r < 0)
return log_error_errno(r, "Failed to write GID map: %m");

-diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
-index e485a0196b..8bff210356 100644
--- a/src/basic/procfs-util.c
+++ b/src/basic/procfs-util.c
-@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
+@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi
* decrease it, as threads-max is the much more relevant sysctl. */
if (limit > pid_max-1) {
sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
@@ -140,11 +134,9 @@ index e485a0196b..8bff210356 100644
if (r < 0) {
uint64_t threads_max;

-diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c
-index b66a6622ae..8d1c93008a 100644
--- a/src/basic/sysctl-util.c
+++ b/src/basic/sysctl-util.c
-@@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) {
+@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c

log_debug("Setting '%s' to '%s'", p, value);

@@ -153,8 +145,6 @@ index b66a6622ae..8d1c93008a 100644
}

int sysctl_writef(const char *property, const char *format, ...) {
-diff --git a/src/basic/util.c b/src/basic/util.c
-index d7ef382737..31c35118d1 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -168,7 +168,7 @@ void disable_coredumps(void) {
@@ -166,8 +156,6 @@ index d7ef382737..31c35118d1 100644
if (r < 0)
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
}
-diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
-index 18231c2618..6c598d55c8 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -29,7 +29,7 @@ static bool arg_unregister = false;
@@ -179,7 +167,7 @@ index 18231c2618..6c598d55c8 100644
}

static int apply_rule(const char *filename, unsigned line, const char *rule) {
-@@ -59,7 +59,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) {
+@@ -59,7 +59,7 @@ static int apply_rule(const char *filena
if (r >= 0)
log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename);

@@ -197,11 +185,9 @@ index 18231c2618..6c598d55c8 100644
if (r < 0)
log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
else
-diff --git a/src/core/cgroup.c b/src/core/cgroup.c
-index 9282b1ff20..7781e0f8eb 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
-@@ -4182,7 +4182,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
+@@ -4191,7 +4191,7 @@ int unit_cgroup_freezer_action(Unit *u,
else
u->freezer_state = FREEZER_THAWING;

@@ -210,11 +196,9 @@ index 9282b1ff20..7781e0f8eb 100644
if (r < 0)
return r;

-diff --git a/src/core/main.c b/src/core/main.c
-index 409b84a006..b1631e57ce 100644
--- a/src/core/main.c
+++ b/src/core/main.c
-@@ -1374,7 +1374,7 @@ static int bump_unix_max_dgram_qlen(void) {
+@@ -1403,7 +1403,7 @@ static int bump_unix_max_dgram_qlen(void
if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
return 0;

@@ -223,7 +207,7 @@ index 409b84a006..b1631e57ce 100644
"%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
if (r < 0)
return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
-@@ -1646,7 +1646,7 @@ static void initialize_core_pattern(bool skip_setup) {
+@@ -1675,7 +1675,7 @@ static void initialize_core_pattern(bool
if (getpid_cached() != 1)
return;

@@ -232,11 +216,9 @@ index 409b84a006..b1631e57ce 100644
if (r < 0)
log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
arg_early_core_pattern);
-diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
-index f88cb80834..68055fb64a 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
-@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy) {
+@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy)
}

#if HAVE_SMACK_RUN_LABEL
@@ -258,8 +240,6 @@ index f88cb80834..68055fb64a 100644
if (r < 0)
log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
#endif
-diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
-index 1c7d9179d8..3ae78ee580 100644
--- a/src/hibernate-resume/hibernate-resume.c
+++ b/src/hibernate-resume/hibernate-resume.c
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
@@ -271,24 +251,20 @@ index 1c7d9179d8..3ae78ee580 100644
if (r < 0) {
log_error_errno(r, "Failed to write '" DEVNUM_FORMAT_STR "' to /sys/power/resume: %m", DEVNUM_FORMAT_VAL(st.st_rdev));
return EXIT_FAILURE;
-diff --git a/src/home/homework.c b/src/home/homework.c
-index 0014a7f598..ec3e9caa1c 100644
--- a/src/home/homework.c
+++ b/src/home/homework.c
@@ -278,7 +278,7 @@ static void drop_caches_now(void) {
- * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not
- * more. */
+ * for details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but
+ * not more. */

- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0);
if (r < 0)
log_warning_errno(r, "Failed to drop caches, ignoring: %m");
else
-diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
-index aaf951ced8..45a9d70f0d 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
-@@ -2215,7 +2215,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
+@@ -2439,7 +2439,7 @@ _public_ int sd_device_set_sysattr_value
if (!value)
return -ENOMEM;

@@ -297,11 +273,9 @@ index aaf951ced8..45a9d70f0d 100644
if (r < 0) {
/* On failure, clear cache entry, as we do not know how it fails. */
device_remove_cached_sysattr_value(device, sysattr);
-diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
-index 9e6379ae7b..546a03a7f5 100644
--- a/src/nspawn/nspawn-cgroup.c
+++ b/src/nspawn/nspawn-cgroup.c
-@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
+@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified
fn = strjoina(tree, cgroup, "/cgroup.procs");

sprintf(pid_string, PID_FMT, pid);
@@ -310,11 +284,9 @@ index 9e6379ae7b..546a03a7f5 100644
if (r < 0) {
log_error_errno(r, "Failed to move process: %m");
goto finish;
-diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
-index c5fd978395..fefe8a21e5 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
-@@ -2759,7 +2759,7 @@ static int reset_audit_loginuid(void) {
+@@ -2762,7 +2762,7 @@ static int reset_audit_loginuid(void) {
if (streq(p, "4294967295"))
return 0;

@@ -341,8 +313,6 @@ index c5fd978395..fefe8a21e5 100644
if (r < 0)
return log_error_errno(r, "Failed to write GID map: %m");

-diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
-index 724d7f27d9..dd725cff92 100644
--- a/src/shared/binfmt-util.c
+++ b/src/shared/binfmt-util.c
@@ -26,7 +26,7 @@ int disable_binfmt(void) {
@@ -354,11 +324,9 @@ index 724d7f27d9..dd725cff92 100644
if (r < 0)
return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");

-diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
-index a1fabc73c1..c5c8fc417e 100644
--- a/src/shared/cgroup-setup.c
+++ b/src/shared/cgroup-setup.c
-@@ -344,7 +344,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
+@@ -350,7 +350,7 @@ int cg_attach(const char *controller, co

xsprintf(c, PID_FMT "\n", pid);

@@ -367,7 +335,7 @@ index a1fabc73c1..c5c8fc417e 100644
if (r == -EOPNOTSUPP && cg_is_threaded(controller, path) > 0)
/* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
return -EUCLEAN;
-@@ -879,7 +879,7 @@ int cg_enable_everywhere(
+@@ -887,7 +887,7 @@ int cg_enable_everywhere(
return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
}

@@ -376,22 +344,18 @@ index a1fabc73c1..c5c8fc417e 100644
if (r < 0) {
log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
-diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c
-index a0b648bf79..13f921390d 100644
--- a/src/shared/coredump-util.c
+++ b/src/shared/coredump-util.c
-@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value) {
+@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value)
sprintf(t, "0x%"PRIx64, value);

return write_string_file("/proc/self/coredump_filter", t,
- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
}
-diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
-index 0df1778cb2..3b9a0c934e 100644
--- a/src/shared/smack-util.c
+++ b/src/shared/smack-util.c
-@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
+@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const
return 0;

p = procfs_file_alloca(pid, "attr/current");
@@ -400,11 +364,9 @@ index 0df1778cb2..3b9a0c934e 100644
if (r < 0)
return r;

-diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
-index 7064f3a905..8f2a7d9da2 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
-@@ -46,7 +46,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+@@ -50,7 +50,7 @@ static int write_hibernate_location_info
assert(hibernate_location->swap);

xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
@@ -413,7 +375,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (r < 0)
return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
hibernate_location->swap->device, resume_str);
-@@ -73,7 +73,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+@@ -77,7 +77,7 @@ static int write_hibernate_location_info
}

xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
@@ -422,7 +384,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (r < 0)
return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
hibernate_location->swap->device, offset_str);
-@@ -89,7 +89,7 @@ static int write_mode(char **modes) {
+@@ -93,7 +93,7 @@ static int write_mode(char **modes) {
STRV_FOREACH(mode, modes) {
int k;

@@ -431,7 +393,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (k >= 0)
return 0;

-@@ -110,7 +110,7 @@ static int write_state(FILE **f, char **states) {
+@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **
STRV_FOREACH(state, states) {
int k;

@@ -440,11 +402,9 @@ index 7064f3a905..8f2a7d9da2 100644
if (k >= 0)
return 0;
log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
-diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
-index cd858c9cca..0feb9669a0 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
-@@ -2335,7 +2335,6 @@ static int udev_rule_apply_token_to_event(
+@@ -2354,7 +2354,6 @@ static int udev_rule_apply_token_to_even
log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
r = write_string_file(buf, value,
WRITE_STRING_FILE_VERIFY_ON_FAILURE |
@@ -452,11 +412,9 @@ index cd858c9cca..0feb9669a0 100644
WRITE_STRING_FILE_AVOID_NEWLINE |
WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
if (r < 0)
-diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
-index 50930d4af3..5efd5d3728 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
-@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
+@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na
static int toggle_utf8_sysfs(bool utf8) {
int r;

diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
index 2c56838644..45778541c3 100644
--- a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
+++ b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
@@ -17,8 +17,6 @@ Signed-off-by: Luca Boccassi <luca.boccassi@...>
src/shared/userdb.c | 7 ++++++-
3 files changed, 30 insertions(+), 1 deletion(-)

-diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
-index 88b8fc2f8f..a819d41bac 100644
--- a/src/shared/user-record-nss.c
+++ b/src/shared/user-record-nss.c
@@ -331,8 +331,10 @@ int nss_group_to_group_record(
@@ -48,7 +46,7 @@ index 88b8fc2f8f..a819d41bac 100644

r = json_build(&g->json, JSON_BUILD_OBJECT(
JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
-@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct grou
assert(ret_sgrp);
assert(ret_buffer);

@@ -56,7 +54,7 @@ index 88b8fc2f8f..a819d41bac 100644
for (;;) {
_cleanup_free_ char *buf = NULL;
struct sgrp sgrp, *result;
-@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct grou
buflen *= 2;
buf = mfree(buf);
}
@@ -122,8 +120,6 @@ index 88b8fc2f8f..a819d41bac 100644
if (r < 0)
return r;

-diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h
-index 22ab04d6ee..4e52e7a911 100644
--- a/src/shared/user-record-nss.h
+++ b/src/shared/user-record-nss.h
@@ -2,7 +2,11 @@
@@ -138,11 +134,9 @@ index 22ab04d6ee..4e52e7a911 100644
#include <pwd.h>
#include <shadow.h>

-diff --git a/src/shared/userdb.c b/src/shared/userdb.c
-index 0eddd382e6..d506b8e263 100644
--- a/src/shared/userdb.c
+++ b/src/shared/userdb.c
-@@ -1046,13 +1046,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+@@ -1044,13 +1044,15 @@ int groupdb_iterator_get(UserDBIterator
if (gr) {
_cleanup_free_ char *buffer = NULL;
bool incomplete = false;
@@ -159,7 +153,7 @@ index 0eddd382e6..d506b8e263 100644
if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
r = nss_sgrp_for_group(gr, &sgrp, &buffer);
if (r < 0) {
-@@ -1065,6 +1067,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+@@ -1063,6 +1065,9 @@ int groupdb_iterator_get(UserDBIterator
}

r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
diff --git a/meta/recipes-core/systemd/systemd_252.bb b/meta/recipes-core/systemd/systemd_252.bb
index 3ce95ad257..00355ef9ec 100644
--- a/meta/recipes-core/systemd/systemd_252.bb
+++ b/meta/recipes-core/systemd/systemd_252.bb
@@ -25,6 +25,8 @@ SRC_URI += " \
file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
file://0003-implment-systemd-sysv-install-for-OE.patch \
file://0001-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
+ file://0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch \
+ file://0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch \
"

# patches needed by musl
@@ -49,6 +51,7 @@ SRC_URI_MUSL = "\
file://0001-pass-correct-parameters-to-getdents64.patch \
file://0002-Add-sys-stat.h-for-S_IFDIR.patch \
file://0001-Adjust-for-musl-headers.patch \
+ file://0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
"

PAM_PLUGINS = " \
@@ -109,7 +112,7 @@ PACKAGECONFIG:remove:libc-musl = " \
# https://github.com/seccomp/libseccomp/issues/347
PACKAGECONFIG:remove:mipsarch = "seccomp"

-CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 "
+TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE"

# Some of the dependencies are weak-style recommends - if not available at runtime,
# systemd won't fail but the library-related feature will be skipped with a warning.
--
2.38.1


Re: [PATCH v2] systemd: Fix 252 release build on musl

Khem Raj
 

On Tue, Nov 8, 2022 at 2:39 PM Richard Purdie
<richard.purdie@...> wrote:

On Tue, 2022-11-08 at 13:55 -0800, Khem Raj wrote:
Signed-off-by: Khem Raj <raj.khem@...>
Cc: Luca Boccassi <luca.boccassi@...>
---
v2: Replace the utmp patch with an upstream backport

.../0001-Adjust-for-musl-headers.patch | 84 +---------
....c-Use-net-if.h-for-getting-IFF_LOOP.patch | 27 +++
...trerror-is-assumed-to-be-GNU-specifi.patch | 42 +++++
...-test-utmp.c-only-if-UTMP-is-enabled.patch | 44 +++++
.../0002-Add-sys-stat.h-for-S_IFDIR.patch | 4 +-
...k-parse_printf_format-implementation.patch | 22 +--
...missing.h-check-for-missing-strndupa.patch | 158 ++----------------
...OB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch | 29 ++--
...10-Use-uintmax_t-for-handling-rlim_t.patch | 14 +-
...T_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | 14 +-
...patible-basename-for-non-glibc-syste.patch | 8 +-
...uffering-when-writing-to-oom_score_a.patch | 4 +-
...compliant-strerror_r-from-GNU-specif.patch | 22 ++-
...-not-disable-buffer-in-writing-files.patch | 100 ++++-------
.../systemd/0026-Handle-missing-gshadow.patch | 14 +-
meta/recipes-core/systemd/systemd_252.bb | 5 +-
.../btrfs-tools/btrfs-tools_6.0.bb | 3 +
.../recipes-multimedia/alsa/alsa-lib_1.2.8.bb | 2 +
Should a systemd fix be patching alsa-lib or btrfs-tools for large file
support? :)
oh I should have separated these changes. Thanks for spotting.


Cheers,

Richard


Re: [PATCH 46/48] python3: use the standard shell version of python3-config

Richard Purdie
 

On Mon, 2022-11-07 at 15:55 +0100, Alexander Kanavin wrote:

+SYSROOT_PREPROCESS_FUNCS:append:class-target = " provide_target_config_script"
+SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " provide_target_config_script"
+
+provide_target_config_script() {
+ install -d ${SYSROOT_DESTDIR}${bindir}/
+ install ${D}/${bindir}/python3-config ${SYSROOT_DESTDIR}${bindir}/
+ install ${D}/${bindir}/python${PYTHON_MAJMIN}-config ${SYSROOT_DESTDIR}${bindir}/
+}
+
+
SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
SSTATE_HASHEQUIV_FILEMAP = " \
populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${TMPDIR} \
This made me wonder if we shouldn't have a better way of handling this.
I was wondering if we should have a sysroot_stage_file function (like
sysroot_stage_dir) and then we could do something like:

sysroot_stage_all:append() {
sysroot_stage_file ${D}/${bindir}/python3-config ${SYSROOT_DESTDIR}/${bindir}/python3-config
}

Note that the sysroot code plays with hardlinks for efficiency, I
appreciate one file doesn't really matter though.

I was hoping we could have just added to SYSROOT_DIRS but that does
only handle dirs, not files.

Cheers,

Richard


Re: [PATCH v2] systemd: Fix 252 release build on musl

Richard Purdie
 

On Tue, 2022-11-08 at 13:55 -0800, Khem Raj wrote:
Signed-off-by: Khem Raj <raj.khem@...>
Cc: Luca Boccassi <luca.boccassi@...>
---
v2: Replace the utmp patch with an upstream backport

.../0001-Adjust-for-musl-headers.patch | 84 +---------
....c-Use-net-if.h-for-getting-IFF_LOOP.patch | 27 +++
...trerror-is-assumed-to-be-GNU-specifi.patch | 42 +++++
...-test-utmp.c-only-if-UTMP-is-enabled.patch | 44 +++++
.../0002-Add-sys-stat.h-for-S_IFDIR.patch | 4 +-
...k-parse_printf_format-implementation.patch | 22 +--
...missing.h-check-for-missing-strndupa.patch | 158 ++----------------
...OB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch | 29 ++--
...10-Use-uintmax_t-for-handling-rlim_t.patch | 14 +-
...T_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | 14 +-
...patible-basename-for-non-glibc-syste.patch | 8 +-
...uffering-when-writing-to-oom_score_a.patch | 4 +-
...compliant-strerror_r-from-GNU-specif.patch | 22 ++-
...-not-disable-buffer-in-writing-files.patch | 100 ++++-------
.../systemd/0026-Handle-missing-gshadow.patch | 14 +-
meta/recipes-core/systemd/systemd_252.bb | 5 +-
.../btrfs-tools/btrfs-tools_6.0.bb | 3 +
.../recipes-multimedia/alsa/alsa-lib_1.2.8.bb | 2 +
Should a systemd fix be patching alsa-lib or btrfs-tools for large file
support? :)

Cheers,

Richard


[PATCH v2] systemd: Fix 252 release build on musl

Khem Raj
 

Signed-off-by: Khem Raj <raj.khem@...>
Cc: Luca Boccassi <luca.boccassi@...>
---
v2: Replace the utmp patch with an upstream backport

.../0001-Adjust-for-musl-headers.patch | 84 +---------
....c-Use-net-if.h-for-getting-IFF_LOOP.patch | 27 +++
...trerror-is-assumed-to-be-GNU-specifi.patch | 42 +++++
...-test-utmp.c-only-if-UTMP-is-enabled.patch | 44 +++++
.../0002-Add-sys-stat.h-for-S_IFDIR.patch | 4 +-
...k-parse_printf_format-implementation.patch | 22 +--
...missing.h-check-for-missing-strndupa.patch | 158 ++----------------
...OB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch | 29 ++--
...10-Use-uintmax_t-for-handling-rlim_t.patch | 14 +-
...T_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | 14 +-
...patible-basename-for-non-glibc-syste.patch | 8 +-
...uffering-when-writing-to-oom_score_a.patch | 4 +-
...compliant-strerror_r-from-GNU-specif.patch | 22 ++-
...-not-disable-buffer-in-writing-files.patch | 100 ++++-------
.../systemd/0026-Handle-missing-gshadow.patch | 14 +-
meta/recipes-core/systemd/systemd_252.bb | 5 +-
.../btrfs-tools/btrfs-tools_6.0.bb | 3 +
.../recipes-multimedia/alsa/alsa-lib_1.2.8.bb | 2 +
18 files changed, 223 insertions(+), 373 deletions(-)
create mode 100644 meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
create mode 100644 meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
create mode 100644 meta/recipes-core/systemd/systemd/0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch

diff --git a/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
index bce1ca4563..6496280dda 100644
--- a/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
+++ b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
@@ -47,8 +47,6 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/udev/udev-builtin-net_id.c | 2 +-
37 files changed, 44 insertions(+), 42 deletions(-)

-diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
-index b346a50d78..7884d4c1cd 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -5,7 +5,7 @@
@@ -60,8 +58,6 @@ index b346a50d78..7884d4c1cd 100644
#include <linux/if_infiniband.h>

#include "sd-dhcp6-client.h"
-diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
-index 8ff0eb1360..7e06b8d57d 100644
--- a/src/network/netdev/bareudp.c
+++ b/src/network/netdev/bareudp.c
@@ -2,7 +2,7 @@
@@ -73,8 +69,6 @@ index 8ff0eb1360..7e06b8d57d 100644

#include "bareudp.h"
#include "netlink-util.h"
-diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
-index 15f3aee3a6..ec76428436 100644
--- a/src/network/netdev/batadv.c
+++ b/src/network/netdev/batadv.c
@@ -3,7 +3,7 @@
@@ -86,8 +80,6 @@ index 15f3aee3a6..ec76428436 100644

#include "batadv.h"
#include "fileio.h"
-diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
-index 5d94aa1d68..4e379a326d 100644
--- a/src/network/netdev/bond.c
+++ b/src/network/netdev/bond.c
@@ -1,7 +1,7 @@
@@ -99,8 +91,6 @@ index 5d94aa1d68..4e379a326d 100644

#include "alloc-util.h"
#include "bond.h"
-diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
-index b974f2ae0a..9a5f18d556 100644
--- a/src/network/netdev/bridge.c
+++ b/src/network/netdev/bridge.c
@@ -2,7 +2,7 @@
@@ -112,8 +102,6 @@ index b974f2ae0a..9a5f18d556 100644
#include <linux/if_bridge.h>

#include "bridge.h"
-diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
-index 00df1d2787..77b506b422 100644
--- a/src/network/netdev/dummy.c
+++ b/src/network/netdev/dummy.c
@@ -1,6 +1,6 @@
@@ -124,8 +112,6 @@ index 00df1d2787..77b506b422 100644

#include "dummy.h"

-diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
-index 224c17e979..fb79cc13f6 100644
--- a/src/network/netdev/geneve.c
+++ b/src/network/netdev/geneve.c
@@ -2,7 +2,7 @@
@@ -137,8 +123,6 @@ index 224c17e979..fb79cc13f6 100644

#include "alloc-util.h"
#include "conf-parser.h"
-diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
-index d7ff44cb9e..e037629ae4 100644
--- a/src/network/netdev/ifb.c
+++ b/src/network/netdev/ifb.c
@@ -1,7 +1,7 @@
@@ -150,8 +134,6 @@ index d7ff44cb9e..e037629ae4 100644

#include "ifb.h"

-diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
-index e0ff9e8c62..ab085c1f6d 100644
--- a/src/network/netdev/ipoib.c
+++ b/src/network/netdev/ipoib.c
@@ -1,6 +1,6 @@
@@ -162,8 +144,6 @@ index e0ff9e8c62..ab085c1f6d 100644
#include <linux/if_link.h>

#include "ipoib.h"
-diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
-index d15766cd7b..60728b4f94 100644
--- a/src/network/netdev/ipvlan.c
+++ b/src/network/netdev/ipvlan.c
@@ -2,7 +2,7 @@
@@ -175,8 +155,6 @@ index d15766cd7b..60728b4f94 100644

#include "conf-parser.h"
#include "ipvlan.h"
-diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
-index f1a566a9ca..1f37927a83 100644
--- a/src/network/netdev/macsec.c
+++ b/src/network/netdev/macsec.c
@@ -1,7 +1,7 @@
@@ -188,8 +166,6 @@ index f1a566a9ca..1f37927a83 100644
#include <linux/if_ether.h>
#include <linux/if_macsec.h>
#include <linux/genetlink.h>
-diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
-index c41be6e78f..ee2660c5bf 100644
--- a/src/network/netdev/macvlan.c
+++ b/src/network/netdev/macvlan.c
@@ -2,7 +2,7 @@
@@ -201,8 +177,6 @@ index c41be6e78f..ee2660c5bf 100644

#include "conf-parser.h"
#include "macvlan.h"
-diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
-index 8e7fe11c18..701ab2bd69 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -2,7 +2,7 @@
@@ -214,8 +188,6 @@ index 8e7fe11c18..701ab2bd69 100644
#include <unistd.h>

#include "alloc-util.h"
-diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
-index 15d5c132f9..a3ffa48b15 100644
--- a/src/network/netdev/netdevsim.c
+++ b/src/network/netdev/netdevsim.c
@@ -1,6 +1,6 @@
@@ -226,8 +198,6 @@ index 15d5c132f9..a3ffa48b15 100644

#include "netdevsim.h"

-diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
-index ff372092e6..eef66811f4 100644
--- a/src/network/netdev/nlmon.c
+++ b/src/network/netdev/nlmon.c
@@ -1,6 +1,6 @@
@@ -238,8 +208,6 @@ index ff372092e6..eef66811f4 100644

#include "nlmon.h"

-diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
-index 97e534fe99..0302c1cb94 100644
--- a/src/network/netdev/tunnel.c
+++ b/src/network/netdev/tunnel.c
@@ -2,7 +2,7 @@
@@ -251,8 +219,6 @@ index 97e534fe99..0302c1cb94 100644
#include <linux/if_tunnel.h>
#include <linux/ip.h>
#include <linux/ip6_tunnel.h>
-diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
-index 380547ee1e..137c1adf8a 100644
--- a/src/network/netdev/vcan.c
+++ b/src/network/netdev/vcan.c
@@ -1,6 +1,6 @@
@@ -263,8 +229,6 @@ index 380547ee1e..137c1adf8a 100644

#include "vcan.h"

-diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
-index c946e81fc0..d1a6be73f9 100644
--- a/src/network/netdev/veth.c
+++ b/src/network/netdev/veth.c
@@ -3,7 +3,7 @@
@@ -276,8 +240,6 @@ index c946e81fc0..d1a6be73f9 100644
#include <linux/veth.h>

#include "netlink-util.h"
-diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
-index af3e77963e..efa4b0a164 100644
--- a/src/network/netdev/vlan.c
+++ b/src/network/netdev/vlan.c
@@ -2,7 +2,7 @@
@@ -289,8 +251,6 @@ index af3e77963e..efa4b0a164 100644
#include <linux/if_vlan.h>

#include "parse-util.h"
-diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
-index b1b6707441..1c6d1982e1 100644
--- a/src/network/netdev/vrf.c
+++ b/src/network/netdev/vrf.c
@@ -2,7 +2,7 @@
@@ -302,8 +262,6 @@ index b1b6707441..1c6d1982e1 100644

#include "vrf.h"

-diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
-index a0ba048eb1..875f2e5901 100644
--- a/src/network/netdev/vxcan.c
+++ b/src/network/netdev/vxcan.c
@@ -1,7 +1,7 @@
@@ -315,8 +273,6 @@ index a0ba048eb1..875f2e5901 100644

#include "vxcan.h"

-diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
-index 30b0855598..a065158801 100644
--- a/src/network/netdev/vxlan.c
+++ b/src/network/netdev/vxlan.c
@@ -2,7 +2,7 @@
@@ -328,8 +284,6 @@ index 30b0855598..a065158801 100644

#include "conf-parser.h"
#include "alloc-util.h"
-diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
-index 88f668753a..5fc753384b 100644
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -6,7 +6,7 @@
@@ -341,8 +295,6 @@ index 88f668753a..5fc753384b 100644
#include <linux/ipv6_route.h>

#include "sd-resolve.h"
-diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
-index ef5e735b2b..419afd75f2 100644
--- a/src/network/netdev/xfrm.c
+++ b/src/network/netdev/xfrm.c
@@ -1,6 +1,6 @@
@@ -353,8 +305,6 @@ index ef5e735b2b..419afd75f2 100644

#include "missing_network.h"
#include "xfrm.h"
-diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
-index 10025a97ae..a0239ea83a 100644
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -1,7 +1,5 @@
@@ -374,8 +324,6 @@ index 10025a97ae..a0239ea83a 100644

#define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U

-diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
-index 7996960bd1..e870b9ba26 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -1,7 +1,8 @@
@@ -387,9 +335,7 @@ index 7996960bd1..e870b9ba26 100644
+#include <net/if.h>

#include "bus-error.h"
- #include "dhcp-identifier.h"
-diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c
-index 7be9713d46..e830fcd575 100644
+ #include "bus-locator.h"
--- a/src/network/networkd-dhcp-prefix-delegation.c
+++ b/src/network/networkd-dhcp-prefix-delegation.c
@@ -1,7 +1,5 @@
@@ -409,8 +355,6 @@ index 7be9713d46..e830fcd575 100644
bool link_dhcp_pd_is_enabled(Link *link) {
assert(link);

-diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
-index 9acfd17d49..3108289602 100644
--- a/src/network/networkd-dhcp-server.c
+++ b/src/network/networkd-dhcp-server.c
@@ -1,7 +1,7 @@
@@ -422,8 +366,6 @@ index 9acfd17d49..3108289602 100644
#include <linux/if.h>

#include "sd-dhcp-server.h"
-diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
-index cb9c428ae9..a35d58f3f1 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -3,7 +3,7 @@
@@ -435,21 +377,17 @@ index cb9c428ae9..a35d58f3f1 100644

#include "alloc-util.h"
#include "dhcp-client-internal.h"
-diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
-index dc09171afe..5b93ef3dd4 100644
--- a/src/network/networkd-ipv6ll.c
+++ b/src/network/networkd-ipv6ll.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-
+
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
-
+
#include "in-addr-util.h"
#include "networkd-address.h"
-diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
-index 63679505f7..825ea76ff2 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -3,7 +3,7 @@
@@ -461,8 +399,6 @@ index 63679505f7..825ea76ff2 100644
#include <linux/if_link.h>
#include <linux/netdevice.h>
#include <sys/socket.h>
-diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
-index efe407fedb..46a086cdf5 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -6,7 +6,7 @@
@@ -471,11 +407,9 @@ index efe407fedb..46a086cdf5 100644
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
-
+
#include "sd-ndisc.h"
-
-diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
-index 934fed3b7f..fdb89313dd 100644
+
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1,9 +1,5 @@
@@ -499,8 +433,6 @@ index 934fed3b7f..fdb89313dd 100644
int route_new(Route **ret) {
_cleanup_(route_freep) Route *route = NULL;

-diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
-index e00cc1e589..e392c7e1a2 100644
--- a/src/network/networkd-setlink.c
+++ b/src/network/networkd-setlink.c
@@ -2,7 +2,7 @@
@@ -512,8 +444,6 @@ index e00cc1e589..e392c7e1a2 100644
#include <linux/if_bridge.h>

#include "missing_network.h"
-diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
-index cf20b6dba5..c3a46dda11 100644
--- a/src/shared/linux/ethtool.h
+++ b/src/shared/linux/ethtool.h
@@ -16,7 +16,8 @@
@@ -526,8 +456,6 @@ index cf20b6dba5..c3a46dda11 100644

#ifndef __KERNEL__
#include <limits.h> /* for INT_MAX */
-diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
-index f56c5646c1..5af28ff119 100644
--- a/src/shared/netif-util.c
+++ b/src/shared/netif-util.c
@@ -1,7 +1,7 @@
@@ -539,8 +467,6 @@ index f56c5646c1..5af28ff119 100644

#include "arphrd-util.h"
#include "device-util.h"
-diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
-index f2ea2a7cd5..fe60a0744d 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -18,7 +18,7 @@
diff --git a/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch b/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
new file mode 100644
index 0000000000..835bb21be7
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
@@ -0,0 +1,27 @@
+From 4a464ea4aaed5184a70b2e1ac77e4a955443d067 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Tue, 8 Nov 2022 12:21:35 -0800
+Subject: [PATCH] networkd-ipv4acd.c: Use net/if.h for getting IFF_LOOPBACK definition
+
+This helps in avoiding compiling errors on musl. Definition of
+IFF_LOOPBACK is the reason for including linux/if_arp.h, this however
+could be obtained from net/if.h glibc header equally and makes it
+portable as well.
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/25304]
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/network/networkd-ipv4acd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/network/networkd-ipv4acd.c
++++ b/src/network/networkd-ipv4acd.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++#include <net/if.h> /* IFF_LOOPBACK */
++#include <net/if_arp.h> /* ARPHRD_ETHER */
+
+ #include "sd-dhcp-client.h"
+ #include "sd-ipv4acd.h"
diff --git a/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch b/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
new file mode 100644
index 0000000000..c02d495d31
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
@@ -0,0 +1,42 @@
+From 5b5675913e2dbe6c5acda935b5814a8991829ec5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Tue, 8 Nov 2022 13:31:34 -0800
+Subject: [PATCH 2/2] test-bus-error: strerror() is assumed to be GNU specific version mark it so
+
+Upstream-Status: Inappropriate [Upstream systemd only supports glibc]
+
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/libsystemd/sd-bus/test-bus-error.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/src/libsystemd/sd-bus/test-bus-error.c
++++ b/src/libsystemd/sd-bus/test-bus-error.c
+@@ -99,7 +99,9 @@ TEST(error) {
+ assert_se(!sd_bus_error_is_set(&error));
+ assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY);
+ assert_se(streq(error.name, "System.Error.EBUSY"));
++#ifdef __GLIBC__
+ assert_se(streq(error.message, STRERROR(EBUSY)));
++#endif
+ assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY"));
+ assert_se(sd_bus_error_get_errno(&error) == EBUSY);
+ assert_se(sd_bus_error_is_set(&error));
+--- a/src/test/test-errno-util.c
++++ b/src/test/test-errno-util.c
+@@ -4,7 +4,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tests.h"
+-
++#ifdef __GLIBC__
+ TEST(strerror_not_threadsafe) {
+ /* Just check that strerror really is not thread-safe. */
+ log_info("strerror(%d) → %s", 200, strerror(200));
+@@ -46,5 +46,6 @@ TEST(STRERROR_OR_ELSE) {
+ log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM));
+ log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM));
+ }
++#endif /* __GLIBC__ */
+
+ DEFINE_TEST_MAIN(LOG_INFO);
diff --git a/meta/recipes-core/systemd/systemd/0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch b/meta/recipes-core/systemd/systemd/0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch
new file mode 100644
index 0000000000..df0f1b0131
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch
@@ -0,0 +1,44 @@
+From 41cac2a8b98fc5faebe942c697b17e109822342d Mon Sep 17 00:00:00 2001
+From: Torsten Hilbrich <torsten.hilbrich@...>
+Date: Mon, 7 Nov 2022 08:38:58 +0100
+Subject: [PATCH] test: compile test-utmp.c only if UTMP is enabled
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When compiling with -D utmp=false the compilation fails with:
+
+../../git/systemd/src/test/test-utmp.c: In function ‘test_dump_run_utmp’:
+../../git/systemd/src/test/test-utmp.c:21:9: error: cleanup argument not a function
+ 21 | _unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
+ | ^~~~~~~~
+../../git/systemd/src/test/test-utmp.c:23:17: error: implicit declaration of function ‘utxent_start’ [-Werror=implicit-function-declaration]
+ 23 | utmpx = utxent_start();
+ | ^~~~~~~~~~~~
+
+any many other errors
+
+Add a conditional to compile test-utmp.c only if ENABLE_UTMP is true.
+Upstream-Status: Backport [https://github.com/systemd/systemd/pull/25278]
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/test/meson.build | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/test/meson.build b/src/test/meson.build
+index 86fc1d4fc0..2a4dfe26db 100644
+--- a/src/test/meson.build
++++ b/src/test/meson.build
+@@ -622,7 +622,8 @@ tests += [
+
+ [files('test-journal-importer.c')],
+
+- [files('test-utmp.c')],
++ [files('test-utmp.c'),
++ [], [], [], 'ENABLE_UTMP'],
+
+ [files('test-udev.c'),
+ [libudevd_core,
+--
+2.38.1
+
diff --git a/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
index 58767c7c35..e6abaadfcb 100644
--- a/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
+++ b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
@@ -13,11 +13,9 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/shared/mkdir-label.c | 1 +
1 file changed, 1 insertion(+)

-diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c
-index 5b1ac5d1e0..fa5802b894 100644
--- a/src/shared/mkdir-label.c
+++ b/src/shared/mkdir-label.c
-@@ -6,6 +6,7 @@
+@@ -7,6 +7,7 @@
#include "selinux-util.h"
#include "smack-util.h"
#include "user-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
index 0c85f2bcbe..f9c7ced947 100644
--- a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
+++ b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
@@ -22,11 +22,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
create mode 100644 src/basic/parse-printf-format.c
create mode 100644 src/basic/parse-printf-format.h

-diff --git a/meson.build b/meson.build
-index 36cbfa4893..30b5305b89 100644
--- a/meson.build
+++ b/meson.build
-@@ -694,6 +694,7 @@ endif
+@@ -739,6 +739,7 @@ endif
foreach header : ['crypt.h',
'linux/memfd.h',
'linux/vm_sockets.h',
@@ -34,11 +32,9 @@ index 36cbfa4893..30b5305b89 100644
'sys/auxv.h',
'valgrind/memcheck.h',
'valgrind/valgrind.h',
-diff --git a/src/basic/meson.build b/src/basic/meson.build
-index 9b89fdcdea..0b1ef91016 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
-@@ -336,6 +336,11 @@ endforeach
+@@ -337,6 +337,11 @@ endforeach

basic_sources += generated_gperf_headers

@@ -50,9 +46,6 @@ index 9b89fdcdea..0b1ef91016 100644
############################################################

arch_list = [
-diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
-new file mode 100644
-index 0000000000..49437e5445
--- /dev/null
+++ b/src/basic/parse-printf-format.c
@@ -0,0 +1,273 @@
@@ -329,9 +322,6 @@ index 0000000000..49437e5445
+
+ return last;
+}
-diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
-new file mode 100644
-index 0000000000..47be7522d7
--- /dev/null
+++ b/src/basic/parse-printf-format.h
@@ -0,0 +1,57 @@
@@ -392,8 +382,6 @@ index 0000000000..47be7522d7
+size_t parse_printf_format(const char *fmt, size_t n, int *types);
+
+#endif /* HAVE_PRINTF_H */
-diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
-index 69d7062ec6..f55c5aab2c 100644
--- a/src/basic/stdio-util.h
+++ b/src/basic/stdio-util.h
@@ -1,13 +1,13 @@
@@ -409,10 +397,8 @@ index 69d7062ec6..f55c5aab2c 100644
#include "memory-util.h"
+#include "parse-printf-format.h"

- #define snprintf_ok(buf, len, fmt, ...) \
- ({ \
-diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
-index 1e10ed5524..e6ceba54f9 100644
+ #define snprintf_ok(buf, len, fmt, ...) \
+ ({ \
--- a/src/libsystemd/sd-journal/journal-send.c
+++ b/src/libsystemd/sd-journal/journal-send.c
@@ -2,7 +2,6 @@
diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
index 9e02666698..2c33033e91 100644
--- a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
+++ b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
@@ -72,11 +72,9 @@ Signed-off-by: Luca Boccassi <luca.boccassi@...>
src/udev/udev-rules.c | 1 +
52 files changed, 63 insertions(+)

-diff --git a/meson.build b/meson.build
-index 30b5305b89..0189ef8ce6 100644
--- a/meson.build
+++ b/meson.build
-@@ -512,6 +512,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
+@@ -557,6 +557,7 @@ foreach ident : ['secure_getenv', '__sec
endforeach

foreach ident : [
@@ -84,8 +82,6 @@ index 30b5305b89..0189ef8ce6 100644
['memfd_create', '''#include <sys/mman.h>'''],
['gettid', '''#include <sys/types.h>
#include <unistd.h>'''],
-diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
-index a4e5d77f6c..fc12da4c53 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -20,6 +20,7 @@
@@ -94,10 +90,8 @@ index a4e5d77f6c..fc12da4c53 100644
#include "util.h"
+#include "missing_stdlib.h"

- static int help(void) {
- _cleanup_free_ char *link = NULL;
-diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
-index b03cc70e2e..f4615ffce1 100644
+ #define PCI_CLASS_GRAPHICS_CARD 0x30000
+
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -37,6 +37,7 @@
@@ -108,8 +102,6 @@ index b03cc70e2e..f4615ffce1 100644

static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
_cleanup_free_ char *fs = NULL;
-diff --git a/src/basic/env-util.c b/src/basic/env-util.c
-index 885967e7f3..d0b7dc845e 100644
--- a/src/basic/env-util.c
+++ b/src/basic/env-util.c
@@ -19,6 +19,7 @@
@@ -120,8 +112,6 @@ index 885967e7f3..d0b7dc845e 100644

/* We follow bash for the character set. Different shells have different rules. */
#define VALID_BASH_ENV_NAME_CHARS \
-diff --git a/src/basic/log.c b/src/basic/log.c
-index 12071e2ebd..15254c7bbc 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -36,6 +36,7 @@
@@ -132,8 +122,6 @@ index 12071e2ebd..15254c7bbc 100644

#define SNDBUF_SIZE (8*1024*1024)

-diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h
-index 8c76f93eb2..9068bfb4f0 100644
--- a/src/basic/missing_stdlib.h
+++ b/src/basic/missing_stdlib.h
@@ -11,3 +11,15 @@
@@ -152,8 +140,6 @@ index 8c76f93eb2..9068bfb4f0 100644
+ (char *)memcpy(__new, __old, __len); \
+ })
+#endif
-diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
-index 51a0d74e87..03569f71f8 100644
--- a/src/basic/mkdir.c
+++ b/src/basic/mkdir.c
@@ -15,6 +15,7 @@
@@ -164,8 +150,6 @@ index 51a0d74e87..03569f71f8 100644

int mkdir_safe_internal(
const char *path,
-diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
-index 82a33a6829..d947774b40 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -13,6 +13,7 @@
@@ -176,8 +160,6 @@ index 82a33a6829..d947774b40 100644
#include "mountpoint-util.h"
#include "nulstr-util.h"
#include "parse-util.h"
-diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
-index 2888ab6523..d941afec2d 100644
--- a/src/basic/parse-util.c
+++ b/src/basic/parse-util.c
@@ -18,6 +18,7 @@
@@ -188,8 +170,6 @@ index 2888ab6523..d941afec2d 100644

int parse_boolean(const char *v) {
if (!v)
-diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
-index 6fb8c40e7a..c4b59e8518 100644
--- a/src/basic/path-lookup.c
+++ b/src/basic/path-lookup.c
@@ -16,6 +16,7 @@
@@ -200,8 +180,6 @@ index 6fb8c40e7a..c4b59e8518 100644

int xdg_user_runtime_dir(char **ret, const char *suffix) {
const char *e;
-diff --git a/src/basic/percent-util.c b/src/basic/percent-util.c
-index cab9d0eaea..5f6ca258e9 100644
--- a/src/basic/percent-util.c
+++ b/src/basic/percent-util.c
@@ -3,6 +3,7 @@
@@ -212,8 +190,6 @@ index cab9d0eaea..5f6ca258e9 100644

static int parse_parts_value_whole(const char *p, const char *symbol) {
const char *pc, *n;
-diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
-index 410b8a3eb5..f2c4355609 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -15,6 +15,7 @@
@@ -224,8 +200,6 @@ index 410b8a3eb5..f2c4355609 100644

int proc_cmdline(char **ret) {
const char *e;
-diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
-index 65f96abb06..e485a0196b 100644
--- a/src/basic/procfs-util.c
+++ b/src/basic/procfs-util.c
@@ -12,6 +12,7 @@
@@ -236,8 +210,6 @@ index 65f96abb06..e485a0196b 100644

int procfs_get_pid_max(uint64_t *ret) {
_cleanup_free_ char *value = NULL;
-diff --git a/src/basic/time-util.c b/src/basic/time-util.c
-index b659d6905d..020112be24 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -26,6 +26,7 @@
@@ -248,8 +220,6 @@ index b659d6905d..020112be24 100644

static clockid_t map_clock_id(clockid_t c) {

-diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c
-index d9c901d73b..79a035274c 100644
--- a/src/boot/bless-boot.c
+++ b/src/boot/bless-boot.c
@@ -22,6 +22,7 @@
@@ -260,8 +230,6 @@ index d9c901d73b..79a035274c 100644

static char **arg_path = NULL;

-diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
-index f0d8759e85..b4c1053e64 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -21,6 +21,7 @@
@@ -272,8 +240,6 @@ index f0d8759e85..b4c1053e64 100644
#include "socket-util.h"

BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
-diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
-index 5c499e5d06..e7ab1bb9a5 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -44,6 +44,7 @@
@@ -284,8 +250,6 @@ index 5c499e5d06..e7ab1bb9a5 100644

BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
-diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c
-index 32a2ec0ff9..36be2511e4 100644
--- a/src/core/dbus-util.c
+++ b/src/core/dbus-util.c
@@ -9,6 +9,7 @@
@@ -296,11 +260,9 @@ index 32a2ec0ff9..36be2511e4 100644

int bus_property_get_triggered_unit(
sd_bus *bus,
-diff --git a/src/core/execute.c b/src/core/execute.c
-index 2762b10287..a8aeec7f6e 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
-@@ -103,6 +103,7 @@
+@@ -104,6 +104,7 @@
#include "unit-serialize.h"
#include "user-util.h"
#include "utmp-wtmp.h"
@@ -308,8 +270,6 @@ index 2762b10287..a8aeec7f6e 100644

#define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
#define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
-diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
-index f4488dd692..1d331a7ee2 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -11,6 +11,7 @@
@@ -320,8 +280,6 @@ index f4488dd692..1d331a7ee2 100644

#if HAVE_KMOD
#include "module-util.h"
-diff --git a/src/core/service.c b/src/core/service.c
-index 9f7af9dffb..3ec5e30c8b 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -42,6 +42,7 @@
@@ -331,9 +289,7 @@ index 9f7af9dffb..3ec5e30c8b 100644
+#include "missing_stdlib.h"

#define service_spawn(...) service_spawn_internal(__func__, __VA_ARGS__)
-
-diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c
-index c6e201ecf2..ab034475e2 100644
+
--- a/src/coredump/coredump-vacuum.c
+++ b/src/coredump/coredump-vacuum.c
@@ -17,6 +17,7 @@
@@ -344,11 +300,9 @@ index c6e201ecf2..ab034475e2 100644

#define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
#define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
-diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
-index 9b32383a76..f8d3397a06 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
-@@ -29,6 +29,7 @@
+@@ -32,6 +32,7 @@
#include "util.h"
#include "virt.h"
#include "volatile-util.h"
@@ -356,8 +310,6 @@ index 9b32383a76..f8d3397a06 100644

typedef enum MountPointFlags {
MOUNT_NOAUTO = 1 << 0,
-diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
-index 3e3646e45f..6a8fc60f6d 100644
--- a/src/journal-remote/journal-remote-main.c
+++ b/src/journal-remote/journal-remote-main.c
@@ -24,6 +24,7 @@
@@ -368,11 +320,9 @@ index 3e3646e45f..6a8fc60f6d 100644

#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
-diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
-index cff34fd585..a5003e47e9 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
-@@ -74,6 +74,7 @@
+@@ -70,6 +70,7 @@
#include "unit-name.h"
#include "user-util.h"
#include "varlink.h"
@@ -380,20 +330,16 @@ index cff34fd585..a5003e47e9 100644

#define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
#define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
-diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
-index 96529b422b..ddb5e9c698 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
-@@ -20,6 +20,7 @@
+@@ -19,6 +19,7 @@
#include "strv.h"
#include "time-util.h"
#include "utf8.h"
+#include "missing_stdlib.h"

static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
-
-diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
-index 909dfe4d3a..254b7ce866 100644
+ static int message_parse_fields(sd_bus_message *m);
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -11,6 +11,7 @@
@@ -404,8 +350,6 @@ index 909dfe4d3a..254b7ce866 100644

static int node_vtable_get_userdata(
sd_bus *bus,
-diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
-index 14951ccb33..b7f86ca501 100644
--- a/src/libsystemd/sd-bus/bus-socket.c
+++ b/src/libsystemd/sd-bus/bus-socket.c
@@ -28,6 +28,7 @@
@@ -416,11 +360,9 @@ index 14951ccb33..b7f86ca501 100644

#define SNDBUF_SIZE (8*1024*1024)

-diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
-index 9e1d29cc1d..8c3165f0ce 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
-@@ -43,6 +43,7 @@
+@@ -44,6 +44,7 @@
#include "string-util.h"
#include "strv.h"
#include "user-util.h"
@@ -428,8 +370,6 @@ index 9e1d29cc1d..8c3165f0ce 100644

#define log_debug_bus_message(m) \
do { \
-diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c
-index 317653bedc..d028216c48 100644
--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
@@ -14,6 +14,7 @@
@@ -440,8 +380,6 @@ index 317653bedc..d028216c48 100644

#define MAX_SIZE (2*1024*1024)

-diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
-index 7a6cc4aca3..b7f7cd65c5 100644
--- a/src/libsystemd/sd-journal/sd-journal.c
+++ b/src/libsystemd/sd-journal/sd-journal.c
@@ -41,6 +41,7 @@
@@ -452,23 +390,9 @@ index 7a6cc4aca3..b7f7cd65c5 100644

#define JOURNAL_FILES_MAX 7168

-diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
-index 10d2ed7aec..4fbe3f6b4a 100644
---- a/src/locale/keymap-util.c
-+++ b/src/locale/keymap-util.c
-@@ -24,6 +24,7 @@
- #include "string-util.h"
- #include "strv.h"
- #include "tmpfile-util.h"
-+#include "missing_stdlib.h"
-
- static bool startswith_comma(const char *s, const char *prefix) {
- s = startswith(s, prefix);
-diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
-index 5bd7efc3e8..282899601e 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
-@@ -31,6 +31,7 @@
+@@ -32,6 +32,7 @@
#include "locale-util.h"
#include "login-util.h"
#include "macro.h"
@@ -476,8 +400,6 @@ index 5bd7efc3e8..282899601e 100644
#include "pam-util.h"
#include "parse-util.h"
#include "path-util.h"
-diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c
-index 063ad08d80..f9823a433b 100644
--- a/src/network/generator/network-generator.c
+++ b/src/network/generator/network-generator.c
@@ -13,6 +13,7 @@
@@ -488,8 +410,6 @@ index 063ad08d80..f9823a433b 100644

/*
# .network
-diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c
-index 1f58bf3ed4..8457a3b0e3 100644
--- a/src/nspawn/nspawn-settings.c
+++ b/src/nspawn/nspawn-settings.c
@@ -17,6 +17,7 @@
@@ -500,8 +420,6 @@ index 1f58bf3ed4..8457a3b0e3 100644

Settings *settings_new(void) {
Settings *s;
-diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
-index c64e79bdff..eda26b0b9a 100644
--- a/src/nss-mymachines/nss-mymachines.c
+++ b/src/nss-mymachines/nss-mymachines.c
@@ -21,6 +21,7 @@
@@ -512,8 +430,6 @@ index c64e79bdff..eda26b0b9a 100644

static void setup_logging_once(void) {
static pthread_once_t once = PTHREAD_ONCE_INIT;
-diff --git a/src/portable/portable.c b/src/portable/portable.c
-index 0e6461ba93..54148d5924 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -39,6 +39,7 @@
@@ -524,20 +440,16 @@ index 0e6461ba93..54148d5924 100644

/* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was
* dropped there by the portable service logic and b) for which image it was dropped there. */
-diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
-index 5b3ceeff36..d36d1d57ae 100644
--- a/src/resolve/resolvectl.c
+++ b/src/resolve/resolvectl.c
-@@ -43,6 +43,7 @@
- #include "utf8.h"
+@@ -46,6 +46,7 @@
+ #include "varlink.h"
#include "verb-log-control.h"
#include "verbs.h"
+#include "missing_stdlib.h"

static int arg_family = AF_UNSPEC;
static int arg_ifindex = 0;
-diff --git a/src/shared/bus-get-properties.c b/src/shared/bus-get-properties.c
-index 8b4f66b22e..5926e4c61b 100644
--- a/src/shared/bus-get-properties.c
+++ b/src/shared/bus-get-properties.c
@@ -4,6 +4,7 @@
@@ -548,11 +460,9 @@ index 8b4f66b22e..5926e4c61b 100644

int bus_property_get_bool(
sd_bus *bus,
-diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c
-index 87c0334fec..402ab3493b 100644
--- a/src/shared/bus-unit-procs.c
+++ b/src/shared/bus-unit-procs.c
-@@ -10,6 +10,7 @@
+@@ -11,6 +11,7 @@
#include "sort-util.h"
#include "string-util.h"
#include "terminal-util.h"
@@ -560,8 +470,6 @@ index 87c0334fec..402ab3493b 100644

struct CGroupInfo {
char *cgroup_path;
-diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
-index dcce530c99..faf5a5bda0 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -49,6 +49,7 @@
@@ -572,8 +480,6 @@ index dcce530c99..faf5a5bda0 100644

int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
assert(message);
-diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
-index 4a2b7684bc..ee6d687c58 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -21,6 +21,7 @@
@@ -583,12 +489,10 @@ index 4a2b7684bc..ee6d687c58 100644
+#include "missing_stdlib.h"

static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
- sd_event *e = userdata;
-diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
-index f54b187a1b..299758c7e4 100644
+ sd_event *e = ASSERT_PTR(userdata);
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
-@@ -17,6 +17,7 @@
+@@ -18,6 +18,7 @@
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
@@ -596,8 +500,6 @@ index f54b187a1b..299758c7e4 100644

int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
const char *n;
-diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
-index c6caf9330a..ebe33bd44a 100644
--- a/src/shared/journal-importer.c
+++ b/src/shared/journal-importer.c
@@ -15,6 +15,7 @@
@@ -608,8 +510,6 @@ index c6caf9330a..ebe33bd44a 100644

enum {
IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
-diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
-index cf83eb6bca..e672a003a3 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -42,6 +42,7 @@
@@ -620,8 +520,6 @@ index cf83eb6bca..e672a003a3 100644

/* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
#define PRINT_LINE_THRESHOLD 3
-diff --git a/src/shared/pager.c b/src/shared/pager.c
-index f75ef62d2d..530001a821 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -26,6 +26,7 @@
@@ -632,20 +530,6 @@ index f75ef62d2d..530001a821 100644

static pid_t pager_pid = 0;

-diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c
-index 1b4396a34c..c2f72b185f 100644
---- a/src/shared/uid-range.c
-+++ b/src/shared/uid-range.c
-@@ -14,6 +14,7 @@
- #include "stat-util.h"
- #include "uid-range.h"
- #include "user-util.h"
-+#include "missing_stdlib.h"
-
- static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
- assert(range);
-diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
-index 7e9ab19666..56f619e54e 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -26,6 +26,7 @@
@@ -656,8 +540,6 @@ index 7e9ab19666..56f619e54e 100644

#define BUFFER_SIZE (256 * 1024)

-diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
-index cc9a7cb838..a679614a47 100644
--- a/src/test/test-hexdecoct.c
+++ b/src/test/test-hexdecoct.c
@@ -7,6 +7,7 @@
@@ -668,8 +550,6 @@ index cc9a7cb838..a679614a47 100644
#include "tests.h"

TEST(hexchar) {
-diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
-index ae92e45205..1e6f3205cb 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -22,6 +22,7 @@
@@ -680,11 +560,9 @@ index ae92e45205..1e6f3205cb 100644

_printf_(2,3)
static void path_prepend(char **path, const char *fmt, ...) {
-diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
-index a60e4f294c..571c43765b 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
-@@ -35,6 +35,7 @@
+@@ -34,6 +34,7 @@
#include "udev-util.h"
#include "udev-watch.h"
#include "user-util.h"
@@ -692,8 +570,6 @@ index a60e4f294c..571c43765b 100644

typedef struct Spawn {
sd_device *device;
-diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
-index 1a384d6b38..0089833e3f 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -34,6 +34,7 @@
diff --git a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
index eeaaac1b9a..2a5770c515 100644
--- a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
+++ b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
@@ -23,8 +23,6 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/tmpfiles/tmpfiles.c | 10 ++++++++++
3 files changed, 38 insertions(+)

-diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
-index e026b29478..815e56ef68 100644
--- a/src/basic/glob-util.c
+++ b/src/basic/glob-util.c
@@ -12,6 +12,12 @@
@@ -48,7 +46,7 @@ index e026b29478..815e56ef68 100644
/* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
assert(!(flags & GLOB_ALTDIRFUNC));

-@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
+@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag
pglob->gl_lstat = lstat;
if (!pglob->gl_stat)
pglob->gl_stat = stat;
@@ -63,13 +61,11 @@ index e026b29478..815e56ef68 100644
if (k == GLOB_NOMATCH)
return -ENOENT;
if (k == GLOB_NOSPACE)
-diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
-index ec8b74f48f..d99a6095df 100644
--- a/src/test/test-glob-util.c
+++ b/src/test/test-glob-util.c
-@@ -13,6 +13,12 @@
- #include "tests.h"
- #include "tmpfile-util.h"
+@@ -34,6 +34,12 @@ TEST(glob_first) {
+ assert_se(first == NULL);
+ }

+/* Don't fail if the standard library
+ * doesn't provide brace expansion */
@@ -80,7 +76,7 @@ index ec8b74f48f..d99a6095df 100644
TEST(glob_exists) {
char name[] = "/tmp/test-glob_exists.XXXXXX";
int fd = -1;
-@@ -40,11 +46,13 @@ TEST(glob_no_dot) {
+@@ -61,11 +67,13 @@ TEST(glob_no_dot) {
const char *fn;

_cleanup_globfree_ glob_t g = {
@@ -94,7 +90,7 @@ index ec8b74f48f..d99a6095df 100644
};

int r;
-@@ -52,11 +60,19 @@ TEST(glob_no_dot) {
+@@ -73,11 +81,19 @@ TEST(glob_no_dot) {
assert_se(mkdtemp(template));

fn = strjoina(template, "/*");
@@ -114,13 +110,11 @@ index ec8b74f48f..d99a6095df 100644
assert_se(r == GLOB_NOMATCH);

(void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
-diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
-index fcab51c208..fdef1807ae 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
-@@ -67,6 +67,12 @@
- #include "umask-util.h"
+@@ -71,6 +71,12 @@
#include "user-util.h"
+ #include "virt.h"

+/* Don't fail if the standard library
+ * doesn't provide brace expansion */
@@ -131,7 +125,7 @@ index fcab51c208..fdef1807ae 100644
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
* them in the file system. This is intended to be used to create
* properly owned directories beneath /tmp, /var/tmp, /run, which are
-@@ -1934,7 +1940,9 @@ finish:
+@@ -2174,7 +2180,9 @@ finish:

static int glob_item(Item *i, action_t action) {
_cleanup_globfree_ glob_t g = {
@@ -140,8 +134,8 @@ index fcab51c208..fdef1807ae 100644
+#endif
};
int r = 0, k;
-
-@@ -1953,7 +1961,9 @@ static int glob_item(Item *i, action_t action) {
+
+@@ -2194,7 +2202,9 @@ static int glob_item(Item *i, action_t a

static int glob_item_recursively(Item *i, fdaction_t action) {
_cleanup_globfree_ glob_t g = {
@@ -150,3 +144,4 @@ index fcab51c208..fdef1807ae 100644
+#endif
};
int r = 0, k;
+
diff --git a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
index 3a47d09e8a..aac4ad49d7 100644
--- a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
+++ b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
@@ -27,11 +27,9 @@ Signed-off-by: Chen Qi <Qi.Chen@...>
src/core/execute.c | 4 ++--
3 files changed, 9 insertions(+), 15 deletions(-)

-diff --git a/src/basic/format-util.h b/src/basic/format-util.h
-index 8719df3e29..9becc96066 100644
--- a/src/basic/format-util.h
+++ b/src/basic/format-util.h
-@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32
# error Unknown timex member size
#endif

@@ -46,11 +44,9 @@ index 8719df3e29..9becc96066 100644

#if SIZEOF_DEV_T == 8
# define DEV_FMT "%" PRIu64
-diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
-index 33dfde9d6c..e018fd81fd 100644
--- a/src/basic/rlimit-util.c
+++ b/src/basic/rlimit-util.c
-@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, cons
fixed.rlim_max == highest.rlim_max)
return 0;

@@ -59,7 +55,7 @@ index 33dfde9d6c..e018fd81fd 100644

return RET_NERRNO(setrlimit(resource, &fixed));
}
-@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *r
if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
r = free_and_strdup(&s, "infinity");
else if (rl->rlim_cur >= RLIM_INFINITY)
@@ -86,11 +82,9 @@ index 33dfde9d6c..e018fd81fd 100644

return 1;
}
-diff --git a/src/core/execute.c b/src/core/execute.c
-index fccfb9268c..90f00e10a5 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
-@@ -5633,9 +5633,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+@@ -5869,9 +5869,9 @@ void exec_context_dump(const ExecContext
for (unsigned i = 0; i < RLIM_NLIMITS; i++)
if (c->rlimit[i]) {
fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
diff --git a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
index e1a2512ec3..6367adce07 100644
--- a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
+++ b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
@@ -31,11 +31,9 @@ Signed-off-by: Andre McCurdy <armccurdy@...>
src/shared/base-filesystem.c | 6 +++---
2 files changed, 23 insertions(+), 4 deletions(-)

-diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
-index 0bbb3f6298..3dc494dbfb 100644
--- a/src/basic/fs-util.h
+++ b/src/basic/fs-util.h
-@@ -46,8 +46,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
+@@ -47,8 +47,27 @@ int futimens_opath(int fd, const struct
int fd_warn_permissions(const char *path, int fd);
int stat_warn_permissions(const char *path, const struct stat *st);

@@ -63,12 +61,10 @@ index 0bbb3f6298..3dc494dbfb 100644
+ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0))

int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
- int touch(const char *path);
-diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
-index 6dacc1d20a..909a6818f6 100644
+
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
-@@ -131,7 +131,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -131,7 +131,7 @@ int base_filesystem_create(const char *r
return log_error_errno(errno, "Failed to open root file system: %m");

for (size_t i = 0; i < ELEMENTSOF(table); i++) {
@@ -77,7 +73,7 @@ index 6dacc1d20a..909a6818f6 100644
continue;

if (table[i].target) {
-@@ -139,7 +139,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -139,7 +139,7 @@ int base_filesystem_create(const char *r

/* check if one of the targets exists */
NULSTR_FOREACH(s, table[i].target) {
@@ -86,7 +82,7 @@ index 6dacc1d20a..909a6818f6 100644
continue;

/* check if a specific file exists at the target path */
-@@ -150,7 +150,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -150,7 +150,7 @@ int base_filesystem_create(const char *r
if (!p)
return log_oom();

diff --git a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
index 7b22d6214f..3228f1716b 100644
--- a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
+++ b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
@@ -14,13 +14,11 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/machine/machine-dbus.c | 5 +++++
1 file changed, 5 insertions(+)

-diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
-index 8f11afd65b..a2b57deb7a 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
-@@ -10,6 +10,11 @@
- #include <libgen.h>
- #undef basename
+@@ -4,6 +4,11 @@
+ #include <sys/mount.h>
+ #include <sys/wait.h>

+#if !defined(__GLIBC__)
+#include <string.h>
diff --git a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
index e5e592a837..da56d8b4b6 100644
--- a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
@@ -24,11 +24,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/basic/process-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

-diff --git a/src/basic/process-util.c b/src/basic/process-util.c
-index 6980e0c4f6..45ec26ea45 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
-@@ -1460,7 +1460,7 @@ int set_oom_score_adjust(int value) {
+@@ -1466,7 +1466,7 @@ int set_oom_score_adjust(int value) {
xsprintf(t, "%i", value);

return write_string_file("/proc/self/oom_score_adj", t,
diff --git a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
index c563982607..7533fde1e1 100644
--- a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
+++ b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
@@ -24,11 +24,9 @@ Signed-off-by: Chen Qi <Qi.Chen@...>
src/libsystemd/sd-journal/journal-send.c | 5 +++++
2 files changed, 10 insertions(+)

-diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
-index bdfa145ab7..61928f4bf3 100644
--- a/src/libsystemd/sd-bus/bus-error.c
+++ b/src/libsystemd/sd-bus/bus-error.c
-@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_er
return;

errno = 0;
@@ -41,11 +39,23 @@ index bdfa145ab7..61928f4bf3 100644
if (errno == ERANGE || strlen(x) >= k - 1) {
free(m);
k *= 2;
-diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
-index e6ceba54f9..285ebbc9ef 100644
+@@ -594,8 +599,12 @@ const char* _bus_error_message(const sd_
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
--- a/src/libsystemd/sd-journal/journal-send.c
+++ b/src/libsystemd/sd-journal/journal-send.c
-@@ -370,7 +370,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+@@ -381,7 +381,12 @@ static int fill_iovec_perror_and_send(co
char* j;

errno = 0;
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
index 00131de7d0..f76085e3af 100644
--- a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
+++ b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
@@ -43,11 +43,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/vconsole/vconsole-setup.c | 2 +-
21 files changed, 39 insertions(+), 40 deletions(-)

-diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
-index f4615ffce1..07cb8ed669 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
-@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *controller, const char *path) {
+@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *c
if (r < 0)
return r;

@@ -56,7 +54,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -805,7 +805,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
+@@ -805,7 +805,7 @@ int cg_install_release_agent(const char

sc = strstrip(contents);
if (isempty(sc)) {
@@ -65,7 +63,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;
} else if (!path_equal(sc, agent))
-@@ -823,7 +823,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
+@@ -823,7 +823,7 @@ int cg_install_release_agent(const char

sc = strstrip(contents);
if (streq(sc, "0")) {
@@ -74,7 +72,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const char *controller) {
+@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const cha
if (r < 0)
return r;

@@ -83,7 +81,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const char *controller) {
+@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const cha
if (r < 0)
return r;

@@ -92,7 +90,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -1730,7 +1730,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
+@@ -1730,7 +1730,7 @@ int cg_set_attribute(const char *control
if (r < 0)
return r;

@@ -101,11 +99,9 @@ index f4615ffce1..07cb8ed669 100644
}

int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
-diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c
-index b9120a5ed0..78e460b75f 100644
--- a/src/basic/namespace-util.c
+++ b/src/basic/namespace-util.c
-@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
+@@ -220,12 +220,12 @@ int userns_acquire(const char *uid_map,
freeze();

xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
@@ -120,11 +116,9 @@ index b9120a5ed0..78e460b75f 100644
if (r < 0)
return log_error_errno(r, "Failed to write GID map: %m");

-diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
-index e485a0196b..8bff210356 100644
--- a/src/basic/procfs-util.c
+++ b/src/basic/procfs-util.c
-@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
+@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi
* decrease it, as threads-max is the much more relevant sysctl. */
if (limit > pid_max-1) {
sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
@@ -140,11 +134,9 @@ index e485a0196b..8bff210356 100644
if (r < 0) {
uint64_t threads_max;

-diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c
-index b66a6622ae..8d1c93008a 100644
--- a/src/basic/sysctl-util.c
+++ b/src/basic/sysctl-util.c
-@@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) {
+@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c

log_debug("Setting '%s' to '%s'", p, value);

@@ -153,8 +145,6 @@ index b66a6622ae..8d1c93008a 100644
}

int sysctl_writef(const char *property, const char *format, ...) {
-diff --git a/src/basic/util.c b/src/basic/util.c
-index d7ef382737..31c35118d1 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -168,7 +168,7 @@ void disable_coredumps(void) {
@@ -166,8 +156,6 @@ index d7ef382737..31c35118d1 100644
if (r < 0)
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
}
-diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
-index 18231c2618..6c598d55c8 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -29,7 +29,7 @@ static bool arg_unregister = false;
@@ -179,7 +167,7 @@ index 18231c2618..6c598d55c8 100644
}

static int apply_rule(const char *filename, unsigned line, const char *rule) {
-@@ -59,7 +59,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) {
+@@ -59,7 +59,7 @@ static int apply_rule(const char *filena
if (r >= 0)
log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename);

@@ -197,11 +185,9 @@ index 18231c2618..6c598d55c8 100644
if (r < 0)
log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
else
-diff --git a/src/core/cgroup.c b/src/core/cgroup.c
-index 9282b1ff20..7781e0f8eb 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
-@@ -4182,7 +4182,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
+@@ -4191,7 +4191,7 @@ int unit_cgroup_freezer_action(Unit *u,
else
u->freezer_state = FREEZER_THAWING;

@@ -210,11 +196,9 @@ index 9282b1ff20..7781e0f8eb 100644
if (r < 0)
return r;

-diff --git a/src/core/main.c b/src/core/main.c
-index 409b84a006..b1631e57ce 100644
--- a/src/core/main.c
+++ b/src/core/main.c
-@@ -1374,7 +1374,7 @@ static int bump_unix_max_dgram_qlen(void) {
+@@ -1403,7 +1403,7 @@ static int bump_unix_max_dgram_qlen(void
if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
return 0;

@@ -223,7 +207,7 @@ index 409b84a006..b1631e57ce 100644
"%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
if (r < 0)
return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
-@@ -1646,7 +1646,7 @@ static void initialize_core_pattern(bool skip_setup) {
+@@ -1675,7 +1675,7 @@ static void initialize_core_pattern(bool
if (getpid_cached() != 1)
return;

@@ -232,11 +216,9 @@ index 409b84a006..b1631e57ce 100644
if (r < 0)
log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
arg_early_core_pattern);
-diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
-index f88cb80834..68055fb64a 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
-@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy) {
+@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy)
}

#if HAVE_SMACK_RUN_LABEL
@@ -258,8 +240,6 @@ index f88cb80834..68055fb64a 100644
if (r < 0)
log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
#endif
-diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
-index 1c7d9179d8..3ae78ee580 100644
--- a/src/hibernate-resume/hibernate-resume.c
+++ b/src/hibernate-resume/hibernate-resume.c
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
@@ -271,24 +251,20 @@ index 1c7d9179d8..3ae78ee580 100644
if (r < 0) {
log_error_errno(r, "Failed to write '" DEVNUM_FORMAT_STR "' to /sys/power/resume: %m", DEVNUM_FORMAT_VAL(st.st_rdev));
return EXIT_FAILURE;
-diff --git a/src/home/homework.c b/src/home/homework.c
-index 0014a7f598..ec3e9caa1c 100644
--- a/src/home/homework.c
+++ b/src/home/homework.c
@@ -278,7 +278,7 @@ static void drop_caches_now(void) {
- * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not
- * more. */
+ * for details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but
+ * not more. */

- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0);
if (r < 0)
log_warning_errno(r, "Failed to drop caches, ignoring: %m");
else
-diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
-index aaf951ced8..45a9d70f0d 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
-@@ -2215,7 +2215,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
+@@ -2439,7 +2439,7 @@ _public_ int sd_device_set_sysattr_value
if (!value)
return -ENOMEM;

@@ -297,11 +273,9 @@ index aaf951ced8..45a9d70f0d 100644
if (r < 0) {
/* On failure, clear cache entry, as we do not know how it fails. */
device_remove_cached_sysattr_value(device, sysattr);
-diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
-index 9e6379ae7b..546a03a7f5 100644
--- a/src/nspawn/nspawn-cgroup.c
+++ b/src/nspawn/nspawn-cgroup.c
-@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
+@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified
fn = strjoina(tree, cgroup, "/cgroup.procs");

sprintf(pid_string, PID_FMT, pid);
@@ -310,11 +284,9 @@ index 9e6379ae7b..546a03a7f5 100644
if (r < 0) {
log_error_errno(r, "Failed to move process: %m");
goto finish;
-diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
-index c5fd978395..fefe8a21e5 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
-@@ -2759,7 +2759,7 @@ static int reset_audit_loginuid(void) {
+@@ -2762,7 +2762,7 @@ static int reset_audit_loginuid(void) {
if (streq(p, "4294967295"))
return 0;

@@ -341,8 +313,6 @@ index c5fd978395..fefe8a21e5 100644
if (r < 0)
return log_error_errno(r, "Failed to write GID map: %m");

-diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
-index 724d7f27d9..dd725cff92 100644
--- a/src/shared/binfmt-util.c
+++ b/src/shared/binfmt-util.c
@@ -26,7 +26,7 @@ int disable_binfmt(void) {
@@ -354,11 +324,9 @@ index 724d7f27d9..dd725cff92 100644
if (r < 0)
return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");

-diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
-index a1fabc73c1..c5c8fc417e 100644
--- a/src/shared/cgroup-setup.c
+++ b/src/shared/cgroup-setup.c
-@@ -344,7 +344,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
+@@ -350,7 +350,7 @@ int cg_attach(const char *controller, co

xsprintf(c, PID_FMT "\n", pid);

@@ -367,7 +335,7 @@ index a1fabc73c1..c5c8fc417e 100644
if (r == -EOPNOTSUPP && cg_is_threaded(controller, path) > 0)
/* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
return -EUCLEAN;
-@@ -879,7 +879,7 @@ int cg_enable_everywhere(
+@@ -887,7 +887,7 @@ int cg_enable_everywhere(
return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
}

@@ -376,22 +344,18 @@ index a1fabc73c1..c5c8fc417e 100644
if (r < 0) {
log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
-diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c
-index a0b648bf79..13f921390d 100644
--- a/src/shared/coredump-util.c
+++ b/src/shared/coredump-util.c
-@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value) {
+@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value)
sprintf(t, "0x%"PRIx64, value);

return write_string_file("/proc/self/coredump_filter", t,
- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
}
-diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
-index 0df1778cb2..3b9a0c934e 100644
--- a/src/shared/smack-util.c
+++ b/src/shared/smack-util.c
-@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
+@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const
return 0;

p = procfs_file_alloca(pid, "attr/current");
@@ -400,11 +364,9 @@ index 0df1778cb2..3b9a0c934e 100644
if (r < 0)
return r;

-diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
-index 7064f3a905..8f2a7d9da2 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
-@@ -46,7 +46,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+@@ -50,7 +50,7 @@ static int write_hibernate_location_info
assert(hibernate_location->swap);

xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
@@ -413,7 +375,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (r < 0)
return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
hibernate_location->swap->device, resume_str);
-@@ -73,7 +73,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+@@ -77,7 +77,7 @@ static int write_hibernate_location_info
}

xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
@@ -422,7 +384,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (r < 0)
return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
hibernate_location->swap->device, offset_str);
-@@ -89,7 +89,7 @@ static int write_mode(char **modes) {
+@@ -93,7 +93,7 @@ static int write_mode(char **modes) {
STRV_FOREACH(mode, modes) {
int k;

@@ -431,7 +393,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (k >= 0)
return 0;

-@@ -110,7 +110,7 @@ static int write_state(FILE **f, char **states) {
+@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **
STRV_FOREACH(state, states) {
int k;

@@ -440,11 +402,9 @@ index 7064f3a905..8f2a7d9da2 100644
if (k >= 0)
return 0;
log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
-diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
-index cd858c9cca..0feb9669a0 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
-@@ -2335,7 +2335,6 @@ static int udev_rule_apply_token_to_event(
+@@ -2354,7 +2354,6 @@ static int udev_rule_apply_token_to_even
log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
r = write_string_file(buf, value,
WRITE_STRING_FILE_VERIFY_ON_FAILURE |
@@ -452,11 +412,9 @@ index cd858c9cca..0feb9669a0 100644
WRITE_STRING_FILE_AVOID_NEWLINE |
WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
if (r < 0)
-diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
-index 50930d4af3..5efd5d3728 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
-@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
+@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na
static int toggle_utf8_sysfs(bool utf8) {
int r;

diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
index 2c56838644..45778541c3 100644
--- a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
+++ b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
@@ -17,8 +17,6 @@ Signed-off-by: Luca Boccassi <luca.boccassi@...>
src/shared/userdb.c | 7 ++++++-
3 files changed, 30 insertions(+), 1 deletion(-)

-diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
-index 88b8fc2f8f..a819d41bac 100644
--- a/src/shared/user-record-nss.c
+++ b/src/shared/user-record-nss.c
@@ -331,8 +331,10 @@ int nss_group_to_group_record(
@@ -48,7 +46,7 @@ index 88b8fc2f8f..a819d41bac 100644

r = json_build(&g->json, JSON_BUILD_OBJECT(
JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
-@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct grou
assert(ret_sgrp);
assert(ret_buffer);

@@ -56,7 +54,7 @@ index 88b8fc2f8f..a819d41bac 100644
for (;;) {
_cleanup_free_ char *buf = NULL;
struct sgrp sgrp, *result;
-@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct grou
buflen *= 2;
buf = mfree(buf);
}
@@ -122,8 +120,6 @@ index 88b8fc2f8f..a819d41bac 100644
if (r < 0)
return r;

-diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h
-index 22ab04d6ee..4e52e7a911 100644
--- a/src/shared/user-record-nss.h
+++ b/src/shared/user-record-nss.h
@@ -2,7 +2,11 @@
@@ -138,11 +134,9 @@ index 22ab04d6ee..4e52e7a911 100644
#include <pwd.h>
#include <shadow.h>

-diff --git a/src/shared/userdb.c b/src/shared/userdb.c
-index 0eddd382e6..d506b8e263 100644
--- a/src/shared/userdb.c
+++ b/src/shared/userdb.c
-@@ -1046,13 +1046,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+@@ -1044,13 +1044,15 @@ int groupdb_iterator_get(UserDBIterator
if (gr) {
_cleanup_free_ char *buffer = NULL;
bool incomplete = false;
@@ -159,7 +153,7 @@ index 0eddd382e6..d506b8e263 100644
if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
r = nss_sgrp_for_group(gr, &sgrp, &buffer);
if (r < 0) {
-@@ -1065,6 +1067,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+@@ -1063,6 +1065,9 @@ int groupdb_iterator_get(UserDBIterator
}

r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
diff --git a/meta/recipes-core/systemd/systemd_252.bb b/meta/recipes-core/systemd/systemd_252.bb
index 3ce95ad257..00355ef9ec 100644
--- a/meta/recipes-core/systemd/systemd_252.bb
+++ b/meta/recipes-core/systemd/systemd_252.bb
@@ -25,6 +25,8 @@ SRC_URI += " \
file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
file://0003-implment-systemd-sysv-install-for-OE.patch \
file://0001-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
+ file://0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch \
+ file://0001-test-compile-test-utmp.c-only-if-UTMP-is-enabled.patch \
"

# patches needed by musl
@@ -49,6 +51,7 @@ SRC_URI_MUSL = "\
file://0001-pass-correct-parameters-to-getdents64.patch \
file://0002-Add-sys-stat.h-for-S_IFDIR.patch \
file://0001-Adjust-for-musl-headers.patch \
+ file://0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
"

PAM_PLUGINS = " \
@@ -109,7 +112,7 @@ PACKAGECONFIG:remove:libc-musl = " \
# https://github.com/seccomp/libseccomp/issues/347
PACKAGECONFIG:remove:mipsarch = "seccomp"

-CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 "
+TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE"

# Some of the dependencies are weak-style recommends - if not available at runtime,
# systemd won't fail but the library-related feature will be skipped with a warning.
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb b/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb
index 887a530a52..b56b104a99 100644
--- a/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb
@@ -52,6 +52,9 @@ EXTRA_OECONF:append:libc-musl = " --disable-backtrace "
EXTRA_PYTHON_CFLAGS = "${DEBUG_PREFIX_MAP}"
EXTRA_PYTHON_CFLAGS:class-native = ""
EXTRA_PYTHON_LDFLAGS = "${LDFLAGS}"
+
+TARGET_CC_ARCH:append:libc-musl = " -D_LARGEFILE64_SOURCE"
+
EXTRA_OEMAKE = "V=1 'EXTRA_PYTHON_CFLAGS=${EXTRA_PYTHON_CFLAGS}' 'EXTRA_PYTHON_LDFLAGS=${EXTRA_PYTHON_LDFLAGS}'"

do_configure:prepend() {
diff --git a/meta/recipes-multimedia/alsa/alsa-lib_1.2.8.bb b/meta/recipes-multimedia/alsa/alsa-lib_1.2.8.bb
index bf968c920b..9b5762dfdb 100644
--- a/meta/recipes-multimedia/alsa/alsa-lib_1.2.8.bb
+++ b/meta/recipes-multimedia/alsa/alsa-lib_1.2.8.bb
@@ -19,6 +19,8 @@ EXTRA_OECONF += " \
--disable-python \
"

+CFLAGS += "-D_LARGEFILE64_SOURCE"
+
PACKAGES =+ "alsa-server alsa-conf libatopology"

FILES:alsa-server = "${bindir}/*"
--
2.38.1


Re: [PATCH] oeqa/runtime: clean up deprecated backslash expansion

Alexandre Belloni
 

On 07/11/2022 22:09:34+0000, Ross Burton wrote:
Signed-off-by: Ross Burton <ross.burton@...>
---
meta/lib/oeqa/runtime/cases/apt.py | 4 ++--
meta/lib/oeqa/runtime/cases/buildcpio.py | 7 +++++--
meta/lib/oeqa/runtime/cases/systemd.py | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/apt.py b/meta/lib/oeqa/runtime/cases/apt.py
index 4e09374adde..8000645843a 100644
--- a/meta/lib/oeqa/runtime/cases/apt.py
+++ b/meta/lib/oeqa/runtime/cases/apt.py
@@ -39,9 +39,9 @@ class AptRepoTest(AptTest):
self.target.run('cd %s; echo deb [ allow-insecure=yes ] %s/all ./ > sources.list' % (apt_get_sourceslist_dir, apt_get_source_server))

def setup_source_config_for_package_install_signed(self):
- apt_get_source_server = 'http:\/\/%s:%s' % (self.tc.target.server_ip, self.repo_server.port)
+ apt_get_source_server = 'http://%s:%s' % (self.tc.target.server_ip, self.repo_server.port)
apt_get_sourceslist_dir = '/etc/apt/'
- self.target.run("cd %s; cp sources.list sources.list.bak; sed -i 's/\[trusted=yes\] http:\/\/bogus_ip:bogus_port/%s/g' sources.list" % (apt_get_sourceslist_dir, apt_get_source_server))
+ self.target.run("cd %s; cp sources.list sources.list.bak; sed -i 's|\[trusted=yes\] http://bogus_ip:bogus_port|%s|g' sources.list" % (apt_get_sourceslist_dir, apt_get_source_server))

def cleanup_source_config_for_package_install(self):
apt_get_sourceslist_dir = '/etc/apt/'
diff --git a/meta/lib/oeqa/runtime/cases/buildcpio.py b/meta/lib/oeqa/runtime/cases/buildcpio.py
index bd3b46d9ef0..c08de3c914d 100644
--- a/meta/lib/oeqa/runtime/cases/buildcpio.py
+++ b/meta/lib/oeqa/runtime/cases/buildcpio.py
@@ -29,7 +29,10 @@ class BuildCpioTest(OERuntimeTestCase):
@OEHasPackage(['autoconf'])
def test_cpio(self):
self.project.download_archive()
- self.project.run_configure('--disable-maintainer-mode',
- 'sed -i -e "/char \*program_name/d" src/global.c;')
+ self.project.run_configure('--disable-maintainer-mode')
+ # This sed is needed until
+ # https://git.savannah.gnu.org/cgit/cpio.git/commit/src/global.c?id=641d3f489cf6238bb916368d4ba0d9325a235afb
+ # is in a release.
+ self.project._run(r'sed -i -e "/char \*program_name/d" src/global.c')
I'm pretty sure this breaks:

https://autobuilder.yoctoproject.org/typhoon/#/builders/61/builds/6120/steps/12/logs/stdio

Traceback (most recent call last):
File "/home/pokybuild/yocto-worker/pkgman-rpm-non-rpm/build/meta/lib/oeqa/core/decorator/__init__.py", line 35, in wrapped_f
return func(*args, **kwargs)
File "/home/pokybuild/yocto-worker/pkgman-rpm-non-rpm/build/meta/lib/oeqa/core/decorator/__init__.py", line 35, in wrapped_f
return func(*args, **kwargs)
File "/home/pokybuild/yocto-worker/pkgman-rpm-non-rpm/build/meta/lib/oeqa/core/decorator/__init__.py", line 35, in wrapped_f
return func(*args, **kwargs)
[Previous line repeated 1 more time]
File "/home/pokybuild/yocto-worker/pkgman-rpm-non-rpm/build/meta/lib/oeqa/runtime/cases/buildcpio.py", line 36, in test_cpio
self.project._run(r'sed -i -e "/char \*program_name/d" src/global.c')
File "/home/pokybuild/yocto-worker/pkgman-rpm-non-rpm/build/meta/lib/oeqa/runtime/utils/targetbuildproject.py", line 43, in _run
raise Exception(msg)
Exception: Command sed -i -e "/char \*program_name/d" src/global.c failed with exit code 2: sed: can't read src/global.c: No such file or directory

self.project.run_make()
self.project.run_install()
diff --git a/meta/lib/oeqa/runtime/cases/systemd.py b/meta/lib/oeqa/runtime/cases/systemd.py
index 720b4b517ae..37f295492d3 100644
--- a/meta/lib/oeqa/runtime/cases/systemd.py
+++ b/meta/lib/oeqa/runtime/cases/systemd.py
@@ -154,7 +154,7 @@ class SystemdJournalTests(SystemdTest):
"""

# The expression chain that uniquely identifies the time boot message.
- expr_items=['Startup finished', 'kernel', 'userspace','\.$']
+ expr_items=['Startup finished', 'kernel', 'userspace', r'\.$']
try:
output = self.journalctl(args='-o cat --reverse')
except AssertionError:
--
2.34.1



--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


[PATCH] systemd: Fix 252 release build on musl

Khem Raj
 

Signed-off-by: Khem Raj <raj.khem@...>
Cc: Luca Boccassi <luca.boccassi@...>
---
.../0001-Adjust-for-musl-headers.patch | 84 +---------
....c-Use-net-if.h-for-getting-IFF_LOOP.patch | 27 +++
...trerror-is-assumed-to-be-GNU-specifi.patch | 42 +++++
...-Guard-the-testcase-with-ENABLE_UTMP.patch | 40 +++++
.../0002-Add-sys-stat.h-for-S_IFDIR.patch | 4 +-
...k-parse_printf_format-implementation.patch | 22 +--
...missing.h-check-for-missing-strndupa.patch | 158 ++----------------
...OB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch | 29 ++--
...10-Use-uintmax_t-for-handling-rlim_t.patch | 14 +-
...T_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | 14 +-
...patible-basename-for-non-glibc-syste.patch | 8 +-
...uffering-when-writing-to-oom_score_a.patch | 4 +-
...compliant-strerror_r-from-GNU-specif.patch | 22 ++-
...-not-disable-buffer-in-writing-files.patch | 100 ++++-------
.../systemd/0026-Handle-missing-gshadow.patch | 14 +-
meta/recipes-core/systemd/systemd_252.bb | 5 +-
.../btrfs-tools/btrfs-tools_6.0.bb | 3 +
.../recipes-multimedia/alsa/alsa-lib_1.2.8.bb | 2 +
18 files changed, 219 insertions(+), 373 deletions(-)
create mode 100644 meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
create mode 100644 meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
create mode 100644 meta/recipes-core/systemd/systemd/0001-test-utmp-Guard-the-testcase-with-ENABLE_UTMP.patch

diff --git a/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
index bce1ca4563..6496280dda 100644
--- a/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
+++ b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch
@@ -47,8 +47,6 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/udev/udev-builtin-net_id.c | 2 +-
37 files changed, 44 insertions(+), 42 deletions(-)

-diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
-index b346a50d78..7884d4c1cd 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -5,7 +5,7 @@
@@ -60,8 +58,6 @@ index b346a50d78..7884d4c1cd 100644
#include <linux/if_infiniband.h>

#include "sd-dhcp6-client.h"
-diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
-index 8ff0eb1360..7e06b8d57d 100644
--- a/src/network/netdev/bareudp.c
+++ b/src/network/netdev/bareudp.c
@@ -2,7 +2,7 @@
@@ -73,8 +69,6 @@ index 8ff0eb1360..7e06b8d57d 100644

#include "bareudp.h"
#include "netlink-util.h"
-diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
-index 15f3aee3a6..ec76428436 100644
--- a/src/network/netdev/batadv.c
+++ b/src/network/netdev/batadv.c
@@ -3,7 +3,7 @@
@@ -86,8 +80,6 @@ index 15f3aee3a6..ec76428436 100644

#include "batadv.h"
#include "fileio.h"
-diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
-index 5d94aa1d68..4e379a326d 100644
--- a/src/network/netdev/bond.c
+++ b/src/network/netdev/bond.c
@@ -1,7 +1,7 @@
@@ -99,8 +91,6 @@ index 5d94aa1d68..4e379a326d 100644

#include "alloc-util.h"
#include "bond.h"
-diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
-index b974f2ae0a..9a5f18d556 100644
--- a/src/network/netdev/bridge.c
+++ b/src/network/netdev/bridge.c
@@ -2,7 +2,7 @@
@@ -112,8 +102,6 @@ index b974f2ae0a..9a5f18d556 100644
#include <linux/if_bridge.h>

#include "bridge.h"
-diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
-index 00df1d2787..77b506b422 100644
--- a/src/network/netdev/dummy.c
+++ b/src/network/netdev/dummy.c
@@ -1,6 +1,6 @@
@@ -124,8 +112,6 @@ index 00df1d2787..77b506b422 100644

#include "dummy.h"

-diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
-index 224c17e979..fb79cc13f6 100644
--- a/src/network/netdev/geneve.c
+++ b/src/network/netdev/geneve.c
@@ -2,7 +2,7 @@
@@ -137,8 +123,6 @@ index 224c17e979..fb79cc13f6 100644

#include "alloc-util.h"
#include "conf-parser.h"
-diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
-index d7ff44cb9e..e037629ae4 100644
--- a/src/network/netdev/ifb.c
+++ b/src/network/netdev/ifb.c
@@ -1,7 +1,7 @@
@@ -150,8 +134,6 @@ index d7ff44cb9e..e037629ae4 100644

#include "ifb.h"

-diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
-index e0ff9e8c62..ab085c1f6d 100644
--- a/src/network/netdev/ipoib.c
+++ b/src/network/netdev/ipoib.c
@@ -1,6 +1,6 @@
@@ -162,8 +144,6 @@ index e0ff9e8c62..ab085c1f6d 100644
#include <linux/if_link.h>

#include "ipoib.h"
-diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
-index d15766cd7b..60728b4f94 100644
--- a/src/network/netdev/ipvlan.c
+++ b/src/network/netdev/ipvlan.c
@@ -2,7 +2,7 @@
@@ -175,8 +155,6 @@ index d15766cd7b..60728b4f94 100644

#include "conf-parser.h"
#include "ipvlan.h"
-diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
-index f1a566a9ca..1f37927a83 100644
--- a/src/network/netdev/macsec.c
+++ b/src/network/netdev/macsec.c
@@ -1,7 +1,7 @@
@@ -188,8 +166,6 @@ index f1a566a9ca..1f37927a83 100644
#include <linux/if_ether.h>
#include <linux/if_macsec.h>
#include <linux/genetlink.h>
-diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
-index c41be6e78f..ee2660c5bf 100644
--- a/src/network/netdev/macvlan.c
+++ b/src/network/netdev/macvlan.c
@@ -2,7 +2,7 @@
@@ -201,8 +177,6 @@ index c41be6e78f..ee2660c5bf 100644

#include "conf-parser.h"
#include "macvlan.h"
-diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
-index 8e7fe11c18..701ab2bd69 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -2,7 +2,7 @@
@@ -214,8 +188,6 @@ index 8e7fe11c18..701ab2bd69 100644
#include <unistd.h>

#include "alloc-util.h"
-diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
-index 15d5c132f9..a3ffa48b15 100644
--- a/src/network/netdev/netdevsim.c
+++ b/src/network/netdev/netdevsim.c
@@ -1,6 +1,6 @@
@@ -226,8 +198,6 @@ index 15d5c132f9..a3ffa48b15 100644

#include "netdevsim.h"

-diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
-index ff372092e6..eef66811f4 100644
--- a/src/network/netdev/nlmon.c
+++ b/src/network/netdev/nlmon.c
@@ -1,6 +1,6 @@
@@ -238,8 +208,6 @@ index ff372092e6..eef66811f4 100644

#include "nlmon.h"

-diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
-index 97e534fe99..0302c1cb94 100644
--- a/src/network/netdev/tunnel.c
+++ b/src/network/netdev/tunnel.c
@@ -2,7 +2,7 @@
@@ -251,8 +219,6 @@ index 97e534fe99..0302c1cb94 100644
#include <linux/if_tunnel.h>
#include <linux/ip.h>
#include <linux/ip6_tunnel.h>
-diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
-index 380547ee1e..137c1adf8a 100644
--- a/src/network/netdev/vcan.c
+++ b/src/network/netdev/vcan.c
@@ -1,6 +1,6 @@
@@ -263,8 +229,6 @@ index 380547ee1e..137c1adf8a 100644

#include "vcan.h"

-diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
-index c946e81fc0..d1a6be73f9 100644
--- a/src/network/netdev/veth.c
+++ b/src/network/netdev/veth.c
@@ -3,7 +3,7 @@
@@ -276,8 +240,6 @@ index c946e81fc0..d1a6be73f9 100644
#include <linux/veth.h>

#include "netlink-util.h"
-diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
-index af3e77963e..efa4b0a164 100644
--- a/src/network/netdev/vlan.c
+++ b/src/network/netdev/vlan.c
@@ -2,7 +2,7 @@
@@ -289,8 +251,6 @@ index af3e77963e..efa4b0a164 100644
#include <linux/if_vlan.h>

#include "parse-util.h"
-diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
-index b1b6707441..1c6d1982e1 100644
--- a/src/network/netdev/vrf.c
+++ b/src/network/netdev/vrf.c
@@ -2,7 +2,7 @@
@@ -302,8 +262,6 @@ index b1b6707441..1c6d1982e1 100644

#include "vrf.h"

-diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
-index a0ba048eb1..875f2e5901 100644
--- a/src/network/netdev/vxcan.c
+++ b/src/network/netdev/vxcan.c
@@ -1,7 +1,7 @@
@@ -315,8 +273,6 @@ index a0ba048eb1..875f2e5901 100644

#include "vxcan.h"

-diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
-index 30b0855598..a065158801 100644
--- a/src/network/netdev/vxlan.c
+++ b/src/network/netdev/vxlan.c
@@ -2,7 +2,7 @@
@@ -328,8 +284,6 @@ index 30b0855598..a065158801 100644

#include "conf-parser.h"
#include "alloc-util.h"
-diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
-index 88f668753a..5fc753384b 100644
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -6,7 +6,7 @@
@@ -341,8 +295,6 @@ index 88f668753a..5fc753384b 100644
#include <linux/ipv6_route.h>

#include "sd-resolve.h"
-diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
-index ef5e735b2b..419afd75f2 100644
--- a/src/network/netdev/xfrm.c
+++ b/src/network/netdev/xfrm.c
@@ -1,6 +1,6 @@
@@ -353,8 +305,6 @@ index ef5e735b2b..419afd75f2 100644

#include "missing_network.h"
#include "xfrm.h"
-diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
-index 10025a97ae..a0239ea83a 100644
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -1,7 +1,5 @@
@@ -374,8 +324,6 @@ index 10025a97ae..a0239ea83a 100644

#define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U

-diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
-index 7996960bd1..e870b9ba26 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -1,7 +1,8 @@
@@ -387,9 +335,7 @@ index 7996960bd1..e870b9ba26 100644
+#include <net/if.h>

#include "bus-error.h"
- #include "dhcp-identifier.h"
-diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c
-index 7be9713d46..e830fcd575 100644
+ #include "bus-locator.h"
--- a/src/network/networkd-dhcp-prefix-delegation.c
+++ b/src/network/networkd-dhcp-prefix-delegation.c
@@ -1,7 +1,5 @@
@@ -409,8 +355,6 @@ index 7be9713d46..e830fcd575 100644
bool link_dhcp_pd_is_enabled(Link *link) {
assert(link);

-diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
-index 9acfd17d49..3108289602 100644
--- a/src/network/networkd-dhcp-server.c
+++ b/src/network/networkd-dhcp-server.c
@@ -1,7 +1,7 @@
@@ -422,8 +366,6 @@ index 9acfd17d49..3108289602 100644
#include <linux/if.h>

#include "sd-dhcp-server.h"
-diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
-index cb9c428ae9..a35d58f3f1 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -3,7 +3,7 @@
@@ -435,21 +377,17 @@ index cb9c428ae9..a35d58f3f1 100644

#include "alloc-util.h"
#include "dhcp-client-internal.h"
-diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
-index dc09171afe..5b93ef3dd4 100644
--- a/src/network/networkd-ipv6ll.c
+++ b/src/network/networkd-ipv6ll.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-
+
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
-
+
#include "in-addr-util.h"
#include "networkd-address.h"
-diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
-index 63679505f7..825ea76ff2 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -3,7 +3,7 @@
@@ -461,8 +399,6 @@ index 63679505f7..825ea76ff2 100644
#include <linux/if_link.h>
#include <linux/netdevice.h>
#include <sys/socket.h>
-diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
-index efe407fedb..46a086cdf5 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -6,7 +6,7 @@
@@ -471,11 +407,9 @@ index efe407fedb..46a086cdf5 100644
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
-
+
#include "sd-ndisc.h"
-
-diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
-index 934fed3b7f..fdb89313dd 100644
+
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1,9 +1,5 @@
@@ -499,8 +433,6 @@ index 934fed3b7f..fdb89313dd 100644
int route_new(Route **ret) {
_cleanup_(route_freep) Route *route = NULL;

-diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
-index e00cc1e589..e392c7e1a2 100644
--- a/src/network/networkd-setlink.c
+++ b/src/network/networkd-setlink.c
@@ -2,7 +2,7 @@
@@ -512,8 +444,6 @@ index e00cc1e589..e392c7e1a2 100644
#include <linux/if_bridge.h>

#include "missing_network.h"
-diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
-index cf20b6dba5..c3a46dda11 100644
--- a/src/shared/linux/ethtool.h
+++ b/src/shared/linux/ethtool.h
@@ -16,7 +16,8 @@
@@ -526,8 +456,6 @@ index cf20b6dba5..c3a46dda11 100644

#ifndef __KERNEL__
#include <limits.h> /* for INT_MAX */
-diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
-index f56c5646c1..5af28ff119 100644
--- a/src/shared/netif-util.c
+++ b/src/shared/netif-util.c
@@ -1,7 +1,7 @@
@@ -539,8 +467,6 @@ index f56c5646c1..5af28ff119 100644

#include "arphrd-util.h"
#include "device-util.h"
-diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
-index f2ea2a7cd5..fe60a0744d 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -18,7 +18,7 @@
diff --git a/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch b/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
new file mode 100644
index 0000000000..835bb21be7
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch
@@ -0,0 +1,27 @@
+From 4a464ea4aaed5184a70b2e1ac77e4a955443d067 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Tue, 8 Nov 2022 12:21:35 -0800
+Subject: [PATCH] networkd-ipv4acd.c: Use net/if.h for getting IFF_LOOPBACK definition
+
+This helps in avoiding compiling errors on musl. Definition of
+IFF_LOOPBACK is the reason for including linux/if_arp.h, this however
+could be obtained from net/if.h glibc header equally and makes it
+portable as well.
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/25304]
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/network/networkd-ipv4acd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/network/networkd-ipv4acd.c
++++ b/src/network/networkd-ipv4acd.c
+@@ -1,6 +1,7 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <linux/if_arp.h>
++#include <net/if.h> /* IFF_LOOPBACK */
++#include <net/if_arp.h> /* ARPHRD_ETHER */
+
+ #include "sd-dhcp-client.h"
+ #include "sd-ipv4acd.h"
diff --git a/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch b/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
new file mode 100644
index 0000000000..c02d495d31
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
@@ -0,0 +1,42 @@
+From 5b5675913e2dbe6c5acda935b5814a8991829ec5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Tue, 8 Nov 2022 13:31:34 -0800
+Subject: [PATCH 2/2] test-bus-error: strerror() is assumed to be GNU specific version mark it so
+
+Upstream-Status: Inappropriate [Upstream systemd only supports glibc]
+
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/libsystemd/sd-bus/test-bus-error.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/src/libsystemd/sd-bus/test-bus-error.c
++++ b/src/libsystemd/sd-bus/test-bus-error.c
+@@ -99,7 +99,9 @@ TEST(error) {
+ assert_se(!sd_bus_error_is_set(&error));
+ assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY);
+ assert_se(streq(error.name, "System.Error.EBUSY"));
++#ifdef __GLIBC__
+ assert_se(streq(error.message, STRERROR(EBUSY)));
++#endif
+ assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY"));
+ assert_se(sd_bus_error_get_errno(&error) == EBUSY);
+ assert_se(sd_bus_error_is_set(&error));
+--- a/src/test/test-errno-util.c
++++ b/src/test/test-errno-util.c
+@@ -4,7 +4,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tests.h"
+-
++#ifdef __GLIBC__
+ TEST(strerror_not_threadsafe) {
+ /* Just check that strerror really is not thread-safe. */
+ log_info("strerror(%d) → %s", 200, strerror(200));
+@@ -46,5 +46,6 @@ TEST(STRERROR_OR_ELSE) {
+ log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM));
+ log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM));
+ }
++#endif /* __GLIBC__ */
+
+ DEFINE_TEST_MAIN(LOG_INFO);
diff --git a/meta/recipes-core/systemd/systemd/0001-test-utmp-Guard-the-testcase-with-ENABLE_UTMP.patch b/meta/recipes-core/systemd/systemd/0001-test-utmp-Guard-the-testcase-with-ENABLE_UTMP.patch
new file mode 100644
index 0000000000..67da575f4c
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-test-utmp-Guard-the-testcase-with-ENABLE_UTMP.patch
@@ -0,0 +1,40 @@
+From b80eba10e201e582be9c35fa9898cf91e6b49111 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@...>
+Date: Tue, 8 Nov 2022 13:12:52 -0800
+Subject: [PATCH 1/2] test-utmp: Guard the testcase with ENABLE_UTMP
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/25307]
+Signed-off-by: Khem Raj <raj.khem@...>
+---
+ src/test/test-utmp.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/test/test-utmp.c b/src/test/test-utmp.c
+index 06a0fce764..c8175f7160 100644
+--- a/src/test/test-utmp.c
++++ b/src/test/test-utmp.c
+@@ -7,6 +7,7 @@
+ #include "utmp-wtmp.h"
+ #include "tests.h"
+
++#if ENABLE_UTMP
+ #ifndef UT_LINESIZE
+ # define UT_LINESIZE 32
+ #endif
+@@ -16,7 +17,6 @@
+ #ifndef UT_HOSTSIZE
+ # define UT_HOSTSIZE 256
+ #endif
+-
+ TEST(dump_run_utmp) {
+ _unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
+
+@@ -55,4 +55,5 @@ TEST(dump_run_utmp) {
+ }
+ }
+
++#endif /* ENABLE_UTMP */
+ DEFINE_TEST_MAIN(LOG_DEBUG);
+--
+2.38.1
+
diff --git a/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
index 58767c7c35..e6abaadfcb 100644
--- a/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
+++ b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch
@@ -13,11 +13,9 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/shared/mkdir-label.c | 1 +
1 file changed, 1 insertion(+)

-diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c
-index 5b1ac5d1e0..fa5802b894 100644
--- a/src/shared/mkdir-label.c
+++ b/src/shared/mkdir-label.c
-@@ -6,6 +6,7 @@
+@@ -7,6 +7,7 @@
#include "selinux-util.h"
#include "smack-util.h"
#include "user-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
index 0c85f2bcbe..f9c7ced947 100644
--- a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
+++ b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
@@ -22,11 +22,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
create mode 100644 src/basic/parse-printf-format.c
create mode 100644 src/basic/parse-printf-format.h

-diff --git a/meson.build b/meson.build
-index 36cbfa4893..30b5305b89 100644
--- a/meson.build
+++ b/meson.build
-@@ -694,6 +694,7 @@ endif
+@@ -739,6 +739,7 @@ endif
foreach header : ['crypt.h',
'linux/memfd.h',
'linux/vm_sockets.h',
@@ -34,11 +32,9 @@ index 36cbfa4893..30b5305b89 100644
'sys/auxv.h',
'valgrind/memcheck.h',
'valgrind/valgrind.h',
-diff --git a/src/basic/meson.build b/src/basic/meson.build
-index 9b89fdcdea..0b1ef91016 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
-@@ -336,6 +336,11 @@ endforeach
+@@ -337,6 +337,11 @@ endforeach

basic_sources += generated_gperf_headers

@@ -50,9 +46,6 @@ index 9b89fdcdea..0b1ef91016 100644
############################################################

arch_list = [
-diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
-new file mode 100644
-index 0000000000..49437e5445
--- /dev/null
+++ b/src/basic/parse-printf-format.c
@@ -0,0 +1,273 @@
@@ -329,9 +322,6 @@ index 0000000000..49437e5445
+
+ return last;
+}
-diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
-new file mode 100644
-index 0000000000..47be7522d7
--- /dev/null
+++ b/src/basic/parse-printf-format.h
@@ -0,0 +1,57 @@
@@ -392,8 +382,6 @@ index 0000000000..47be7522d7
+size_t parse_printf_format(const char *fmt, size_t n, int *types);
+
+#endif /* HAVE_PRINTF_H */
-diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
-index 69d7062ec6..f55c5aab2c 100644
--- a/src/basic/stdio-util.h
+++ b/src/basic/stdio-util.h
@@ -1,13 +1,13 @@
@@ -409,10 +397,8 @@ index 69d7062ec6..f55c5aab2c 100644
#include "memory-util.h"
+#include "parse-printf-format.h"

- #define snprintf_ok(buf, len, fmt, ...) \
- ({ \
-diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
-index 1e10ed5524..e6ceba54f9 100644
+ #define snprintf_ok(buf, len, fmt, ...) \
+ ({ \
--- a/src/libsystemd/sd-journal/journal-send.c
+++ b/src/libsystemd/sd-journal/journal-send.c
@@ -2,7 +2,6 @@
diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
index 9e02666698..2c33033e91 100644
--- a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
+++ b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
@@ -72,11 +72,9 @@ Signed-off-by: Luca Boccassi <luca.boccassi@...>
src/udev/udev-rules.c | 1 +
52 files changed, 63 insertions(+)

-diff --git a/meson.build b/meson.build
-index 30b5305b89..0189ef8ce6 100644
--- a/meson.build
+++ b/meson.build
-@@ -512,6 +512,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
+@@ -557,6 +557,7 @@ foreach ident : ['secure_getenv', '__sec
endforeach

foreach ident : [
@@ -84,8 +82,6 @@ index 30b5305b89..0189ef8ce6 100644
['memfd_create', '''#include <sys/mman.h>'''],
['gettid', '''#include <sys/types.h>
#include <unistd.h>'''],
-diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
-index a4e5d77f6c..fc12da4c53 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -20,6 +20,7 @@
@@ -94,10 +90,8 @@ index a4e5d77f6c..fc12da4c53 100644
#include "util.h"
+#include "missing_stdlib.h"

- static int help(void) {
- _cleanup_free_ char *link = NULL;
-diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
-index b03cc70e2e..f4615ffce1 100644
+ #define PCI_CLASS_GRAPHICS_CARD 0x30000
+
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -37,6 +37,7 @@
@@ -108,8 +102,6 @@ index b03cc70e2e..f4615ffce1 100644

static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
_cleanup_free_ char *fs = NULL;
-diff --git a/src/basic/env-util.c b/src/basic/env-util.c
-index 885967e7f3..d0b7dc845e 100644
--- a/src/basic/env-util.c
+++ b/src/basic/env-util.c
@@ -19,6 +19,7 @@
@@ -120,8 +112,6 @@ index 885967e7f3..d0b7dc845e 100644

/* We follow bash for the character set. Different shells have different rules. */
#define VALID_BASH_ENV_NAME_CHARS \
-diff --git a/src/basic/log.c b/src/basic/log.c
-index 12071e2ebd..15254c7bbc 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -36,6 +36,7 @@
@@ -132,8 +122,6 @@ index 12071e2ebd..15254c7bbc 100644

#define SNDBUF_SIZE (8*1024*1024)

-diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h
-index 8c76f93eb2..9068bfb4f0 100644
--- a/src/basic/missing_stdlib.h
+++ b/src/basic/missing_stdlib.h
@@ -11,3 +11,15 @@
@@ -152,8 +140,6 @@ index 8c76f93eb2..9068bfb4f0 100644
+ (char *)memcpy(__new, __old, __len); \
+ })
+#endif
-diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
-index 51a0d74e87..03569f71f8 100644
--- a/src/basic/mkdir.c
+++ b/src/basic/mkdir.c
@@ -15,6 +15,7 @@
@@ -164,8 +150,6 @@ index 51a0d74e87..03569f71f8 100644

int mkdir_safe_internal(
const char *path,
-diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
-index 82a33a6829..d947774b40 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -13,6 +13,7 @@
@@ -176,8 +160,6 @@ index 82a33a6829..d947774b40 100644
#include "mountpoint-util.h"
#include "nulstr-util.h"
#include "parse-util.h"
-diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
-index 2888ab6523..d941afec2d 100644
--- a/src/basic/parse-util.c
+++ b/src/basic/parse-util.c
@@ -18,6 +18,7 @@
@@ -188,8 +170,6 @@ index 2888ab6523..d941afec2d 100644

int parse_boolean(const char *v) {
if (!v)
-diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
-index 6fb8c40e7a..c4b59e8518 100644
--- a/src/basic/path-lookup.c
+++ b/src/basic/path-lookup.c
@@ -16,6 +16,7 @@
@@ -200,8 +180,6 @@ index 6fb8c40e7a..c4b59e8518 100644

int xdg_user_runtime_dir(char **ret, const char *suffix) {
const char *e;
-diff --git a/src/basic/percent-util.c b/src/basic/percent-util.c
-index cab9d0eaea..5f6ca258e9 100644
--- a/src/basic/percent-util.c
+++ b/src/basic/percent-util.c
@@ -3,6 +3,7 @@
@@ -212,8 +190,6 @@ index cab9d0eaea..5f6ca258e9 100644

static int parse_parts_value_whole(const char *p, const char *symbol) {
const char *pc, *n;
-diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
-index 410b8a3eb5..f2c4355609 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -15,6 +15,7 @@
@@ -224,8 +200,6 @@ index 410b8a3eb5..f2c4355609 100644

int proc_cmdline(char **ret) {
const char *e;
-diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
-index 65f96abb06..e485a0196b 100644
--- a/src/basic/procfs-util.c
+++ b/src/basic/procfs-util.c
@@ -12,6 +12,7 @@
@@ -236,8 +210,6 @@ index 65f96abb06..e485a0196b 100644

int procfs_get_pid_max(uint64_t *ret) {
_cleanup_free_ char *value = NULL;
-diff --git a/src/basic/time-util.c b/src/basic/time-util.c
-index b659d6905d..020112be24 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -26,6 +26,7 @@
@@ -248,8 +220,6 @@ index b659d6905d..020112be24 100644

static clockid_t map_clock_id(clockid_t c) {

-diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c
-index d9c901d73b..79a035274c 100644
--- a/src/boot/bless-boot.c
+++ b/src/boot/bless-boot.c
@@ -22,6 +22,7 @@
@@ -260,8 +230,6 @@ index d9c901d73b..79a035274c 100644

static char **arg_path = NULL;

-diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
-index f0d8759e85..b4c1053e64 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -21,6 +21,7 @@
@@ -272,8 +240,6 @@ index f0d8759e85..b4c1053e64 100644
#include "socket-util.h"

BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
-diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
-index 5c499e5d06..e7ab1bb9a5 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -44,6 +44,7 @@
@@ -284,8 +250,6 @@ index 5c499e5d06..e7ab1bb9a5 100644

BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
-diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c
-index 32a2ec0ff9..36be2511e4 100644
--- a/src/core/dbus-util.c
+++ b/src/core/dbus-util.c
@@ -9,6 +9,7 @@
@@ -296,11 +260,9 @@ index 32a2ec0ff9..36be2511e4 100644

int bus_property_get_triggered_unit(
sd_bus *bus,
-diff --git a/src/core/execute.c b/src/core/execute.c
-index 2762b10287..a8aeec7f6e 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
-@@ -103,6 +103,7 @@
+@@ -104,6 +104,7 @@
#include "unit-serialize.h"
#include "user-util.h"
#include "utmp-wtmp.h"
@@ -308,8 +270,6 @@ index 2762b10287..a8aeec7f6e 100644

#define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
#define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
-diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
-index f4488dd692..1d331a7ee2 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -11,6 +11,7 @@
@@ -320,8 +280,6 @@ index f4488dd692..1d331a7ee2 100644

#if HAVE_KMOD
#include "module-util.h"
-diff --git a/src/core/service.c b/src/core/service.c
-index 9f7af9dffb..3ec5e30c8b 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -42,6 +42,7 @@
@@ -331,9 +289,7 @@ index 9f7af9dffb..3ec5e30c8b 100644
+#include "missing_stdlib.h"

#define service_spawn(...) service_spawn_internal(__func__, __VA_ARGS__)
-
-diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c
-index c6e201ecf2..ab034475e2 100644
+
--- a/src/coredump/coredump-vacuum.c
+++ b/src/coredump/coredump-vacuum.c
@@ -17,6 +17,7 @@
@@ -344,11 +300,9 @@ index c6e201ecf2..ab034475e2 100644

#define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
#define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
-diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
-index 9b32383a76..f8d3397a06 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
-@@ -29,6 +29,7 @@
+@@ -32,6 +32,7 @@
#include "util.h"
#include "virt.h"
#include "volatile-util.h"
@@ -356,8 +310,6 @@ index 9b32383a76..f8d3397a06 100644

typedef enum MountPointFlags {
MOUNT_NOAUTO = 1 << 0,
-diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
-index 3e3646e45f..6a8fc60f6d 100644
--- a/src/journal-remote/journal-remote-main.c
+++ b/src/journal-remote/journal-remote-main.c
@@ -24,6 +24,7 @@
@@ -368,11 +320,9 @@ index 3e3646e45f..6a8fc60f6d 100644

#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
-diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
-index cff34fd585..a5003e47e9 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
-@@ -74,6 +74,7 @@
+@@ -70,6 +70,7 @@
#include "unit-name.h"
#include "user-util.h"
#include "varlink.h"
@@ -380,20 +330,16 @@ index cff34fd585..a5003e47e9 100644

#define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
#define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
-diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
-index 96529b422b..ddb5e9c698 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
-@@ -20,6 +20,7 @@
+@@ -19,6 +19,7 @@
#include "strv.h"
#include "time-util.h"
#include "utf8.h"
+#include "missing_stdlib.h"

static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
-
-diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
-index 909dfe4d3a..254b7ce866 100644
+ static int message_parse_fields(sd_bus_message *m);
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -11,6 +11,7 @@
@@ -404,8 +350,6 @@ index 909dfe4d3a..254b7ce866 100644

static int node_vtable_get_userdata(
sd_bus *bus,
-diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
-index 14951ccb33..b7f86ca501 100644
--- a/src/libsystemd/sd-bus/bus-socket.c
+++ b/src/libsystemd/sd-bus/bus-socket.c
@@ -28,6 +28,7 @@
@@ -416,11 +360,9 @@ index 14951ccb33..b7f86ca501 100644

#define SNDBUF_SIZE (8*1024*1024)

-diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
-index 9e1d29cc1d..8c3165f0ce 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
-@@ -43,6 +43,7 @@
+@@ -44,6 +44,7 @@
#include "string-util.h"
#include "strv.h"
#include "user-util.h"
@@ -428,8 +370,6 @@ index 9e1d29cc1d..8c3165f0ce 100644

#define log_debug_bus_message(m) \
do { \
-diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c
-index 317653bedc..d028216c48 100644
--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
@@ -14,6 +14,7 @@
@@ -440,8 +380,6 @@ index 317653bedc..d028216c48 100644

#define MAX_SIZE (2*1024*1024)

-diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
-index 7a6cc4aca3..b7f7cd65c5 100644
--- a/src/libsystemd/sd-journal/sd-journal.c
+++ b/src/libsystemd/sd-journal/sd-journal.c
@@ -41,6 +41,7 @@
@@ -452,23 +390,9 @@ index 7a6cc4aca3..b7f7cd65c5 100644

#define JOURNAL_FILES_MAX 7168

-diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
-index 10d2ed7aec..4fbe3f6b4a 100644
---- a/src/locale/keymap-util.c
-+++ b/src/locale/keymap-util.c
-@@ -24,6 +24,7 @@
- #include "string-util.h"
- #include "strv.h"
- #include "tmpfile-util.h"
-+#include "missing_stdlib.h"
-
- static bool startswith_comma(const char *s, const char *prefix) {
- s = startswith(s, prefix);
-diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
-index 5bd7efc3e8..282899601e 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
-@@ -31,6 +31,7 @@
+@@ -32,6 +32,7 @@
#include "locale-util.h"
#include "login-util.h"
#include "macro.h"
@@ -476,8 +400,6 @@ index 5bd7efc3e8..282899601e 100644
#include "pam-util.h"
#include "parse-util.h"
#include "path-util.h"
-diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c
-index 063ad08d80..f9823a433b 100644
--- a/src/network/generator/network-generator.c
+++ b/src/network/generator/network-generator.c
@@ -13,6 +13,7 @@
@@ -488,8 +410,6 @@ index 063ad08d80..f9823a433b 100644

/*
# .network
-diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c
-index 1f58bf3ed4..8457a3b0e3 100644
--- a/src/nspawn/nspawn-settings.c
+++ b/src/nspawn/nspawn-settings.c
@@ -17,6 +17,7 @@
@@ -500,8 +420,6 @@ index 1f58bf3ed4..8457a3b0e3 100644

Settings *settings_new(void) {
Settings *s;
-diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
-index c64e79bdff..eda26b0b9a 100644
--- a/src/nss-mymachines/nss-mymachines.c
+++ b/src/nss-mymachines/nss-mymachines.c
@@ -21,6 +21,7 @@
@@ -512,8 +430,6 @@ index c64e79bdff..eda26b0b9a 100644

static void setup_logging_once(void) {
static pthread_once_t once = PTHREAD_ONCE_INIT;
-diff --git a/src/portable/portable.c b/src/portable/portable.c
-index 0e6461ba93..54148d5924 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -39,6 +39,7 @@
@@ -524,20 +440,16 @@ index 0e6461ba93..54148d5924 100644

/* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was
* dropped there by the portable service logic and b) for which image it was dropped there. */
-diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
-index 5b3ceeff36..d36d1d57ae 100644
--- a/src/resolve/resolvectl.c
+++ b/src/resolve/resolvectl.c
-@@ -43,6 +43,7 @@
- #include "utf8.h"
+@@ -46,6 +46,7 @@
+ #include "varlink.h"
#include "verb-log-control.h"
#include "verbs.h"
+#include "missing_stdlib.h"

static int arg_family = AF_UNSPEC;
static int arg_ifindex = 0;
-diff --git a/src/shared/bus-get-properties.c b/src/shared/bus-get-properties.c
-index 8b4f66b22e..5926e4c61b 100644
--- a/src/shared/bus-get-properties.c
+++ b/src/shared/bus-get-properties.c
@@ -4,6 +4,7 @@
@@ -548,11 +460,9 @@ index 8b4f66b22e..5926e4c61b 100644

int bus_property_get_bool(
sd_bus *bus,
-diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c
-index 87c0334fec..402ab3493b 100644
--- a/src/shared/bus-unit-procs.c
+++ b/src/shared/bus-unit-procs.c
-@@ -10,6 +10,7 @@
+@@ -11,6 +11,7 @@
#include "sort-util.h"
#include "string-util.h"
#include "terminal-util.h"
@@ -560,8 +470,6 @@ index 87c0334fec..402ab3493b 100644

struct CGroupInfo {
char *cgroup_path;
-diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
-index dcce530c99..faf5a5bda0 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -49,6 +49,7 @@
@@ -572,8 +480,6 @@ index dcce530c99..faf5a5bda0 100644

int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
assert(message);
-diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
-index 4a2b7684bc..ee6d687c58 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -21,6 +21,7 @@
@@ -583,12 +489,10 @@ index 4a2b7684bc..ee6d687c58 100644
+#include "missing_stdlib.h"

static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
- sd_event *e = userdata;
-diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
-index f54b187a1b..299758c7e4 100644
+ sd_event *e = ASSERT_PTR(userdata);
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
-@@ -17,6 +17,7 @@
+@@ -18,6 +18,7 @@
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
@@ -596,8 +500,6 @@ index f54b187a1b..299758c7e4 100644

int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
const char *n;
-diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
-index c6caf9330a..ebe33bd44a 100644
--- a/src/shared/journal-importer.c
+++ b/src/shared/journal-importer.c
@@ -15,6 +15,7 @@
@@ -608,8 +510,6 @@ index c6caf9330a..ebe33bd44a 100644

enum {
IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
-diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
-index cf83eb6bca..e672a003a3 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -42,6 +42,7 @@
@@ -620,8 +520,6 @@ index cf83eb6bca..e672a003a3 100644

/* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
#define PRINT_LINE_THRESHOLD 3
-diff --git a/src/shared/pager.c b/src/shared/pager.c
-index f75ef62d2d..530001a821 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -26,6 +26,7 @@
@@ -632,20 +530,6 @@ index f75ef62d2d..530001a821 100644

static pid_t pager_pid = 0;

-diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c
-index 1b4396a34c..c2f72b185f 100644
---- a/src/shared/uid-range.c
-+++ b/src/shared/uid-range.c
-@@ -14,6 +14,7 @@
- #include "stat-util.h"
- #include "uid-range.h"
- #include "user-util.h"
-+#include "missing_stdlib.h"
-
- static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
- assert(range);
-diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
-index 7e9ab19666..56f619e54e 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -26,6 +26,7 @@
@@ -656,8 +540,6 @@ index 7e9ab19666..56f619e54e 100644

#define BUFFER_SIZE (256 * 1024)

-diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
-index cc9a7cb838..a679614a47 100644
--- a/src/test/test-hexdecoct.c
+++ b/src/test/test-hexdecoct.c
@@ -7,6 +7,7 @@
@@ -668,8 +550,6 @@ index cc9a7cb838..a679614a47 100644
#include "tests.h"

TEST(hexchar) {
-diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
-index ae92e45205..1e6f3205cb 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -22,6 +22,7 @@
@@ -680,11 +560,9 @@ index ae92e45205..1e6f3205cb 100644

_printf_(2,3)
static void path_prepend(char **path, const char *fmt, ...) {
-diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
-index a60e4f294c..571c43765b 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
-@@ -35,6 +35,7 @@
+@@ -34,6 +34,7 @@
#include "udev-util.h"
#include "udev-watch.h"
#include "user-util.h"
@@ -692,8 +570,6 @@ index a60e4f294c..571c43765b 100644

typedef struct Spawn {
sd_device *device;
-diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
-index 1a384d6b38..0089833e3f 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -34,6 +34,7 @@
diff --git a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
index eeaaac1b9a..2a5770c515 100644
--- a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
+++ b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
@@ -23,8 +23,6 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/tmpfiles/tmpfiles.c | 10 ++++++++++
3 files changed, 38 insertions(+)

-diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
-index e026b29478..815e56ef68 100644
--- a/src/basic/glob-util.c
+++ b/src/basic/glob-util.c
@@ -12,6 +12,12 @@
@@ -48,7 +46,7 @@ index e026b29478..815e56ef68 100644
/* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
assert(!(flags & GLOB_ALTDIRFUNC));

-@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
+@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag
pglob->gl_lstat = lstat;
if (!pglob->gl_stat)
pglob->gl_stat = stat;
@@ -63,13 +61,11 @@ index e026b29478..815e56ef68 100644
if (k == GLOB_NOMATCH)
return -ENOENT;
if (k == GLOB_NOSPACE)
-diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
-index ec8b74f48f..d99a6095df 100644
--- a/src/test/test-glob-util.c
+++ b/src/test/test-glob-util.c
-@@ -13,6 +13,12 @@
- #include "tests.h"
- #include "tmpfile-util.h"
+@@ -34,6 +34,12 @@ TEST(glob_first) {
+ assert_se(first == NULL);
+ }

+/* Don't fail if the standard library
+ * doesn't provide brace expansion */
@@ -80,7 +76,7 @@ index ec8b74f48f..d99a6095df 100644
TEST(glob_exists) {
char name[] = "/tmp/test-glob_exists.XXXXXX";
int fd = -1;
-@@ -40,11 +46,13 @@ TEST(glob_no_dot) {
+@@ -61,11 +67,13 @@ TEST(glob_no_dot) {
const char *fn;

_cleanup_globfree_ glob_t g = {
@@ -94,7 +90,7 @@ index ec8b74f48f..d99a6095df 100644
};

int r;
-@@ -52,11 +60,19 @@ TEST(glob_no_dot) {
+@@ -73,11 +81,19 @@ TEST(glob_no_dot) {
assert_se(mkdtemp(template));

fn = strjoina(template, "/*");
@@ -114,13 +110,11 @@ index ec8b74f48f..d99a6095df 100644
assert_se(r == GLOB_NOMATCH);

(void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
-diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
-index fcab51c208..fdef1807ae 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
-@@ -67,6 +67,12 @@
- #include "umask-util.h"
+@@ -71,6 +71,12 @@
#include "user-util.h"
+ #include "virt.h"

+/* Don't fail if the standard library
+ * doesn't provide brace expansion */
@@ -131,7 +125,7 @@ index fcab51c208..fdef1807ae 100644
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
* them in the file system. This is intended to be used to create
* properly owned directories beneath /tmp, /var/tmp, /run, which are
-@@ -1934,7 +1940,9 @@ finish:
+@@ -2174,7 +2180,9 @@ finish:

static int glob_item(Item *i, action_t action) {
_cleanup_globfree_ glob_t g = {
@@ -140,8 +134,8 @@ index fcab51c208..fdef1807ae 100644
+#endif
};
int r = 0, k;
-
-@@ -1953,7 +1961,9 @@ static int glob_item(Item *i, action_t action) {
+
+@@ -2194,7 +2202,9 @@ static int glob_item(Item *i, action_t a

static int glob_item_recursively(Item *i, fdaction_t action) {
_cleanup_globfree_ glob_t g = {
@@ -150,3 +144,4 @@ index fcab51c208..fdef1807ae 100644
+#endif
};
int r = 0, k;
+
diff --git a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
index 3a47d09e8a..aac4ad49d7 100644
--- a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
+++ b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
@@ -27,11 +27,9 @@ Signed-off-by: Chen Qi <Qi.Chen@...>
src/core/execute.c | 4 ++--
3 files changed, 9 insertions(+), 15 deletions(-)

-diff --git a/src/basic/format-util.h b/src/basic/format-util.h
-index 8719df3e29..9becc96066 100644
--- a/src/basic/format-util.h
+++ b/src/basic/format-util.h
-@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32
# error Unknown timex member size
#endif

@@ -46,11 +44,9 @@ index 8719df3e29..9becc96066 100644

#if SIZEOF_DEV_T == 8
# define DEV_FMT "%" PRIu64
-diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
-index 33dfde9d6c..e018fd81fd 100644
--- a/src/basic/rlimit-util.c
+++ b/src/basic/rlimit-util.c
-@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, cons
fixed.rlim_max == highest.rlim_max)
return 0;

@@ -59,7 +55,7 @@ index 33dfde9d6c..e018fd81fd 100644

return RET_NERRNO(setrlimit(resource, &fixed));
}
-@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *r
if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
r = free_and_strdup(&s, "infinity");
else if (rl->rlim_cur >= RLIM_INFINITY)
@@ -86,11 +82,9 @@ index 33dfde9d6c..e018fd81fd 100644

return 1;
}
-diff --git a/src/core/execute.c b/src/core/execute.c
-index fccfb9268c..90f00e10a5 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
-@@ -5633,9 +5633,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+@@ -5869,9 +5869,9 @@ void exec_context_dump(const ExecContext
for (unsigned i = 0; i < RLIM_NLIMITS; i++)
if (c->rlimit[i]) {
fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
diff --git a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
index e1a2512ec3..6367adce07 100644
--- a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
+++ b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
@@ -31,11 +31,9 @@ Signed-off-by: Andre McCurdy <armccurdy@...>
src/shared/base-filesystem.c | 6 +++---
2 files changed, 23 insertions(+), 4 deletions(-)

-diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
-index 0bbb3f6298..3dc494dbfb 100644
--- a/src/basic/fs-util.h
+++ b/src/basic/fs-util.h
-@@ -46,8 +46,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
+@@ -47,8 +47,27 @@ int futimens_opath(int fd, const struct
int fd_warn_permissions(const char *path, int fd);
int stat_warn_permissions(const char *path, const struct stat *st);

@@ -63,12 +61,10 @@ index 0bbb3f6298..3dc494dbfb 100644
+ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0))

int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
- int touch(const char *path);
-diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
-index 6dacc1d20a..909a6818f6 100644
+
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
-@@ -131,7 +131,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -131,7 +131,7 @@ int base_filesystem_create(const char *r
return log_error_errno(errno, "Failed to open root file system: %m");

for (size_t i = 0; i < ELEMENTSOF(table); i++) {
@@ -77,7 +73,7 @@ index 6dacc1d20a..909a6818f6 100644
continue;

if (table[i].target) {
-@@ -139,7 +139,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -139,7 +139,7 @@ int base_filesystem_create(const char *r

/* check if one of the targets exists */
NULSTR_FOREACH(s, table[i].target) {
@@ -86,7 +82,7 @@ index 6dacc1d20a..909a6818f6 100644
continue;

/* check if a specific file exists at the target path */
-@@ -150,7 +150,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+@@ -150,7 +150,7 @@ int base_filesystem_create(const char *r
if (!p)
return log_oom();

diff --git a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
index 7b22d6214f..3228f1716b 100644
--- a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
+++ b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
@@ -14,13 +14,11 @@ Signed-off-by: Khem Raj <raj.khem@...>
src/machine/machine-dbus.c | 5 +++++
1 file changed, 5 insertions(+)

-diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
-index 8f11afd65b..a2b57deb7a 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
-@@ -10,6 +10,11 @@
- #include <libgen.h>
- #undef basename
+@@ -4,6 +4,11 @@
+ #include <sys/mount.h>
+ #include <sys/wait.h>

+#if !defined(__GLIBC__)
+#include <string.h>
diff --git a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
index e5e592a837..da56d8b4b6 100644
--- a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
@@ -24,11 +24,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/basic/process-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

-diff --git a/src/basic/process-util.c b/src/basic/process-util.c
-index 6980e0c4f6..45ec26ea45 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
-@@ -1460,7 +1460,7 @@ int set_oom_score_adjust(int value) {
+@@ -1466,7 +1466,7 @@ int set_oom_score_adjust(int value) {
xsprintf(t, "%i", value);

return write_string_file("/proc/self/oom_score_adj", t,
diff --git a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
index c563982607..7533fde1e1 100644
--- a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
+++ b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
@@ -24,11 +24,9 @@ Signed-off-by: Chen Qi <Qi.Chen@...>
src/libsystemd/sd-journal/journal-send.c | 5 +++++
2 files changed, 10 insertions(+)

-diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
-index bdfa145ab7..61928f4bf3 100644
--- a/src/libsystemd/sd-bus/bus-error.c
+++ b/src/libsystemd/sd-bus/bus-error.c
-@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_er
return;

errno = 0;
@@ -41,11 +39,23 @@ index bdfa145ab7..61928f4bf3 100644
if (errno == ERANGE || strlen(x) >= k - 1) {
free(m);
k *= 2;
-diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
-index e6ceba54f9..285ebbc9ef 100644
+@@ -594,8 +599,12 @@ const char* _bus_error_message(const sd_
+
+ if (e && e->message)
+ return e->message;
+-
++#ifndef __GLIBC__
++ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++ return buf;
++#else
+ return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
++#endif
+ }
+
+ static bool map_ok(const sd_bus_error_map *map) {
--- a/src/libsystemd/sd-journal/journal-send.c
+++ b/src/libsystemd/sd-journal/journal-send.c
-@@ -370,7 +370,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+@@ -381,7 +381,12 @@ static int fill_iovec_perror_and_send(co
char* j;

errno = 0;
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
index 00131de7d0..f76085e3af 100644
--- a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
+++ b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
@@ -43,11 +43,9 @@ Signed-off-by: Scott Murray <scott.murray@...>
src/vconsole/vconsole-setup.c | 2 +-
21 files changed, 39 insertions(+), 40 deletions(-)

-diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
-index f4615ffce1..07cb8ed669 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
-@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *controller, const char *path) {
+@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *c
if (r < 0)
return r;

@@ -56,7 +54,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -805,7 +805,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
+@@ -805,7 +805,7 @@ int cg_install_release_agent(const char

sc = strstrip(contents);
if (isempty(sc)) {
@@ -65,7 +63,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;
} else if (!path_equal(sc, agent))
-@@ -823,7 +823,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
+@@ -823,7 +823,7 @@ int cg_install_release_agent(const char

sc = strstrip(contents);
if (streq(sc, "0")) {
@@ -74,7 +72,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const char *controller) {
+@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const cha
if (r < 0)
return r;

@@ -83,7 +81,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const char *controller) {
+@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const cha
if (r < 0)
return r;

@@ -92,7 +90,7 @@ index f4615ffce1..07cb8ed669 100644
if (r < 0)
return r;

-@@ -1730,7 +1730,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
+@@ -1730,7 +1730,7 @@ int cg_set_attribute(const char *control
if (r < 0)
return r;

@@ -101,11 +99,9 @@ index f4615ffce1..07cb8ed669 100644
}

int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
-diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c
-index b9120a5ed0..78e460b75f 100644
--- a/src/basic/namespace-util.c
+++ b/src/basic/namespace-util.c
-@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
+@@ -220,12 +220,12 @@ int userns_acquire(const char *uid_map,
freeze();

xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
@@ -120,11 +116,9 @@ index b9120a5ed0..78e460b75f 100644
if (r < 0)
return log_error_errno(r, "Failed to write GID map: %m");

-diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
-index e485a0196b..8bff210356 100644
--- a/src/basic/procfs-util.c
+++ b/src/basic/procfs-util.c
-@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
+@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi
* decrease it, as threads-max is the much more relevant sysctl. */
if (limit > pid_max-1) {
sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
@@ -140,11 +134,9 @@ index e485a0196b..8bff210356 100644
if (r < 0) {
uint64_t threads_max;

-diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c
-index b66a6622ae..8d1c93008a 100644
--- a/src/basic/sysctl-util.c
+++ b/src/basic/sysctl-util.c
-@@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) {
+@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c

log_debug("Setting '%s' to '%s'", p, value);

@@ -153,8 +145,6 @@ index b66a6622ae..8d1c93008a 100644
}

int sysctl_writef(const char *property, const char *format, ...) {
-diff --git a/src/basic/util.c b/src/basic/util.c
-index d7ef382737..31c35118d1 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -168,7 +168,7 @@ void disable_coredumps(void) {
@@ -166,8 +156,6 @@ index d7ef382737..31c35118d1 100644
if (r < 0)
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
}
-diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
-index 18231c2618..6c598d55c8 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -29,7 +29,7 @@ static bool arg_unregister = false;
@@ -179,7 +167,7 @@ index 18231c2618..6c598d55c8 100644
}

static int apply_rule(const char *filename, unsigned line, const char *rule) {
-@@ -59,7 +59,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) {
+@@ -59,7 +59,7 @@ static int apply_rule(const char *filena
if (r >= 0)
log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename);

@@ -197,11 +185,9 @@ index 18231c2618..6c598d55c8 100644
if (r < 0)
log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
else
-diff --git a/src/core/cgroup.c b/src/core/cgroup.c
-index 9282b1ff20..7781e0f8eb 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
-@@ -4182,7 +4182,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
+@@ -4191,7 +4191,7 @@ int unit_cgroup_freezer_action(Unit *u,
else
u->freezer_state = FREEZER_THAWING;

@@ -210,11 +196,9 @@ index 9282b1ff20..7781e0f8eb 100644
if (r < 0)
return r;

-diff --git a/src/core/main.c b/src/core/main.c
-index 409b84a006..b1631e57ce 100644
--- a/src/core/main.c
+++ b/src/core/main.c
-@@ -1374,7 +1374,7 @@ static int bump_unix_max_dgram_qlen(void) {
+@@ -1403,7 +1403,7 @@ static int bump_unix_max_dgram_qlen(void
if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
return 0;

@@ -223,7 +207,7 @@ index 409b84a006..b1631e57ce 100644
"%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
if (r < 0)
return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
-@@ -1646,7 +1646,7 @@ static void initialize_core_pattern(bool skip_setup) {
+@@ -1675,7 +1675,7 @@ static void initialize_core_pattern(bool
if (getpid_cached() != 1)
return;

@@ -232,11 +216,9 @@ index 409b84a006..b1631e57ce 100644
if (r < 0)
log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
arg_early_core_pattern);
-diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
-index f88cb80834..68055fb64a 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
-@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy) {
+@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy)
}

#if HAVE_SMACK_RUN_LABEL
@@ -258,8 +240,6 @@ index f88cb80834..68055fb64a 100644
if (r < 0)
log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
#endif
-diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
-index 1c7d9179d8..3ae78ee580 100644
--- a/src/hibernate-resume/hibernate-resume.c
+++ b/src/hibernate-resume/hibernate-resume.c
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
@@ -271,24 +251,20 @@ index 1c7d9179d8..3ae78ee580 100644
if (r < 0) {
log_error_errno(r, "Failed to write '" DEVNUM_FORMAT_STR "' to /sys/power/resume: %m", DEVNUM_FORMAT_VAL(st.st_rdev));
return EXIT_FAILURE;
-diff --git a/src/home/homework.c b/src/home/homework.c
-index 0014a7f598..ec3e9caa1c 100644
--- a/src/home/homework.c
+++ b/src/home/homework.c
@@ -278,7 +278,7 @@ static void drop_caches_now(void) {
- * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not
- * more. */
+ * for details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but
+ * not more. */

- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER);
+ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0);
if (r < 0)
log_warning_errno(r, "Failed to drop caches, ignoring: %m");
else
-diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
-index aaf951ced8..45a9d70f0d 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
-@@ -2215,7 +2215,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
+@@ -2439,7 +2439,7 @@ _public_ int sd_device_set_sysattr_value
if (!value)
return -ENOMEM;

@@ -297,11 +273,9 @@ index aaf951ced8..45a9d70f0d 100644
if (r < 0) {
/* On failure, clear cache entry, as we do not know how it fails. */
device_remove_cached_sysattr_value(device, sysattr);
-diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
-index 9e6379ae7b..546a03a7f5 100644
--- a/src/nspawn/nspawn-cgroup.c
+++ b/src/nspawn/nspawn-cgroup.c
-@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
+@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified
fn = strjoina(tree, cgroup, "/cgroup.procs");

sprintf(pid_string, PID_FMT, pid);
@@ -310,11 +284,9 @@ index 9e6379ae7b..546a03a7f5 100644
if (r < 0) {
log_error_errno(r, "Failed to move process: %m");
goto finish;
-diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
-index c5fd978395..fefe8a21e5 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
-@@ -2759,7 +2759,7 @@ static int reset_audit_loginuid(void) {
+@@ -2762,7 +2762,7 @@ static int reset_audit_loginuid(void) {
if (streq(p, "4294967295"))
return 0;

@@ -341,8 +313,6 @@ index c5fd978395..fefe8a21e5 100644
if (r < 0)
return log_error_errno(r, "Failed to write GID map: %m");

-diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
-index 724d7f27d9..dd725cff92 100644
--- a/src/shared/binfmt-util.c
+++ b/src/shared/binfmt-util.c
@@ -26,7 +26,7 @@ int disable_binfmt(void) {
@@ -354,11 +324,9 @@ index 724d7f27d9..dd725cff92 100644
if (r < 0)
return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");

-diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
-index a1fabc73c1..c5c8fc417e 100644
--- a/src/shared/cgroup-setup.c
+++ b/src/shared/cgroup-setup.c
-@@ -344,7 +344,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
+@@ -350,7 +350,7 @@ int cg_attach(const char *controller, co

xsprintf(c, PID_FMT "\n", pid);

@@ -367,7 +335,7 @@ index a1fabc73c1..c5c8fc417e 100644
if (r == -EOPNOTSUPP && cg_is_threaded(controller, path) > 0)
/* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
return -EUCLEAN;
-@@ -879,7 +879,7 @@ int cg_enable_everywhere(
+@@ -887,7 +887,7 @@ int cg_enable_everywhere(
return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
}

@@ -376,22 +344,18 @@ index a1fabc73c1..c5c8fc417e 100644
if (r < 0) {
log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
-diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c
-index a0b648bf79..13f921390d 100644
--- a/src/shared/coredump-util.c
+++ b/src/shared/coredump-util.c
-@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value) {
+@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value)
sprintf(t, "0x%"PRIx64, value);

return write_string_file("/proc/self/coredump_filter", t,
- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
}
-diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
-index 0df1778cb2..3b9a0c934e 100644
--- a/src/shared/smack-util.c
+++ b/src/shared/smack-util.c
-@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
+@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const
return 0;

p = procfs_file_alloca(pid, "attr/current");
@@ -400,11 +364,9 @@ index 0df1778cb2..3b9a0c934e 100644
if (r < 0)
return r;

-diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
-index 7064f3a905..8f2a7d9da2 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
-@@ -46,7 +46,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+@@ -50,7 +50,7 @@ static int write_hibernate_location_info
assert(hibernate_location->swap);

xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
@@ -413,7 +375,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (r < 0)
return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
hibernate_location->swap->device, resume_str);
-@@ -73,7 +73,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+@@ -77,7 +77,7 @@ static int write_hibernate_location_info
}

xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
@@ -422,7 +384,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (r < 0)
return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
hibernate_location->swap->device, offset_str);
-@@ -89,7 +89,7 @@ static int write_mode(char **modes) {
+@@ -93,7 +93,7 @@ static int write_mode(char **modes) {
STRV_FOREACH(mode, modes) {
int k;

@@ -431,7 +393,7 @@ index 7064f3a905..8f2a7d9da2 100644
if (k >= 0)
return 0;

-@@ -110,7 +110,7 @@ static int write_state(FILE **f, char **states) {
+@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **
STRV_FOREACH(state, states) {
int k;

@@ -440,11 +402,9 @@ index 7064f3a905..8f2a7d9da2 100644
if (k >= 0)
return 0;
log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
-diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
-index cd858c9cca..0feb9669a0 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
-@@ -2335,7 +2335,6 @@ static int udev_rule_apply_token_to_event(
+@@ -2354,7 +2354,6 @@ static int udev_rule_apply_token_to_even
log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
r = write_string_file(buf, value,
WRITE_STRING_FILE_VERIFY_ON_FAILURE |
@@ -452,11 +412,9 @@ index cd858c9cca..0feb9669a0 100644
WRITE_STRING_FILE_AVOID_NEWLINE |
WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
if (r < 0)
-diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
-index 50930d4af3..5efd5d3728 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
-@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
+@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na
static int toggle_utf8_sysfs(bool utf8) {
int r;

diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
index 2c56838644..45778541c3 100644
--- a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
+++ b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
@@ -17,8 +17,6 @@ Signed-off-by: Luca Boccassi <luca.boccassi@...>
src/shared/userdb.c | 7 ++++++-
3 files changed, 30 insertions(+), 1 deletion(-)

-diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
-index 88b8fc2f8f..a819d41bac 100644
--- a/src/shared/user-record-nss.c
+++ b/src/shared/user-record-nss.c
@@ -331,8 +331,10 @@ int nss_group_to_group_record(
@@ -48,7 +46,7 @@ index 88b8fc2f8f..a819d41bac 100644

r = json_build(&g->json, JSON_BUILD_OBJECT(
JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
-@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct grou
assert(ret_sgrp);
assert(ret_buffer);

@@ -56,7 +54,7 @@ index 88b8fc2f8f..a819d41bac 100644
for (;;) {
_cleanup_free_ char *buf = NULL;
struct sgrp sgrp, *result;
-@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct grou
buflen *= 2;
buf = mfree(buf);
}
@@ -122,8 +120,6 @@ index 88b8fc2f8f..a819d41bac 100644
if (r < 0)
return r;

-diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h
-index 22ab04d6ee..4e52e7a911 100644
--- a/src/shared/user-record-nss.h
+++ b/src/shared/user-record-nss.h
@@ -2,7 +2,11 @@
@@ -138,11 +134,9 @@ index 22ab04d6ee..4e52e7a911 100644
#include <pwd.h>
#include <shadow.h>

-diff --git a/src/shared/userdb.c b/src/shared/userdb.c
-index 0eddd382e6..d506b8e263 100644
--- a/src/shared/userdb.c
+++ b/src/shared/userdb.c
-@@ -1046,13 +1046,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+@@ -1044,13 +1044,15 @@ int groupdb_iterator_get(UserDBIterator
if (gr) {
_cleanup_free_ char *buffer = NULL;
bool incomplete = false;
@@ -159,7 +153,7 @@ index 0eddd382e6..d506b8e263 100644
if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
r = nss_sgrp_for_group(gr, &sgrp, &buffer);
if (r < 0) {
-@@ -1065,6 +1067,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+@@ -1063,6 +1065,9 @@ int groupdb_iterator_get(UserDBIterator
}

r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
diff --git a/meta/recipes-core/systemd/systemd_252.bb b/meta/recipes-core/systemd/systemd_252.bb
index 3ce95ad257..2d2a8f5f7f 100644
--- a/meta/recipes-core/systemd/systemd_252.bb
+++ b/meta/recipes-core/systemd/systemd_252.bb
@@ -25,6 +25,8 @@ SRC_URI += " \
file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
file://0003-implment-systemd-sysv-install-for-OE.patch \
file://0001-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
+ file://0001-networkd-ipv4acd.c-Use-net-if.h-for-getting-IFF_LOOP.patch \
+ file://0001-test-utmp-Guard-the-testcase-with-ENABLE_UTMP.patch \
"

# patches needed by musl
@@ -49,6 +51,7 @@ SRC_URI_MUSL = "\
file://0001-pass-correct-parameters-to-getdents64.patch \
file://0002-Add-sys-stat.h-for-S_IFDIR.patch \
file://0001-Adjust-for-musl-headers.patch \
+ file://0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
"

PAM_PLUGINS = " \
@@ -109,7 +112,7 @@ PACKAGECONFIG:remove:libc-musl = " \
# https://github.com/seccomp/libseccomp/issues/347
PACKAGECONFIG:remove:mipsarch = "seccomp"

-CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 "
+TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE"

# Some of the dependencies are weak-style recommends - if not available at runtime,
# systemd won't fail but the library-related feature will be skipped with a warning.
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb b/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb
index 887a530a52..b56b104a99 100644
--- a/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb
@@ -52,6 +52,9 @@ EXTRA_OECONF:append:libc-musl = " --disable-backtrace "
EXTRA_PYTHON_CFLAGS = "${DEBUG_PREFIX_MAP}"
EXTRA_PYTHON_CFLAGS:class-native = ""
EXTRA_PYTHON_LDFLAGS = "${LDFLAGS}"
+
+TARGET_CC_ARCH:append:libc-musl = " -D_LARGEFILE64_SOURCE"
+
EXTRA_OEMAKE = "V=1 'EXTRA_PYTHON_CFLAGS=${EXTRA_PYTHON_CFLAGS}' 'EXTRA_PYTHON_LDFLAGS=${EXTRA_PYTHON_LDFLAGS}'"

do_configure:prepend() {
diff --git a/meta/recipes-multimedia/alsa/alsa-lib_1.2.8.bb b/meta/recipes-multimedia/alsa/alsa-lib_1.2.8.bb
index bf968c920b..9b5762dfdb 100644
--- a/meta/recipes-multimedia/alsa/alsa-lib_1.2.8.bb
+++ b/meta/recipes-multimedia/alsa/alsa-lib_1.2.8.bb
@@ -19,6 +19,8 @@ EXTRA_OECONF += " \
--disable-python \
"

+CFLAGS += "-D_LARGEFILE64_SOURCE"
+
PACKAGES =+ "alsa-server alsa-conf libatopology"

FILES:alsa-server = "${bindir}/*"
--
2.38.1


Re: [PATCH] openssh: Install internal header/lib files

Willy Tu
 

ok, sounds good. thanks. I think I had a version that does that. I'll
revert back to that version.

I'll let the maintainer there know so that we can proceed with that direction.

Willy Tu


On Tue, Nov 8, 2022 at 11:37 AM Alexander Kanavin
<alex.kanavin@...> wrote:

Ah, I thought this was in a separate layer. I think you're best off
getting a private copy of openssh sources then.

Alex

On Tue, 8 Nov 2022 at 20:30, Willy Tu <wltu@...> wrote:

So do you suggest adding bbappend in meta-openembedded where https://github.com/openembedded/meta-openembedded/pull/597 will live?

I'll check with the maintainer there. And Google/hiba users will maintain that.

Best,

Willy Tu


On Tue, Nov 8, 2022 at 11:25 AM Alexander Kanavin <alex.kanavin@...> wrote:

Actually, you don't need to do this in HIBA - a bbappend to openssh will do.

Alex

On Tue, 8 Nov 2022 at 20:21, Alexander Kanavin via
lists.openembedded.org <alex.kanavin=gmail.com@...>
wrote:

I'd rather have this hidden in your recipes, yes. It's clearly a
special needs issue, and something you shouldn't ask us to maintain
for you (what I mean is that you're not going to rebase the patch when
a new openssh version is out, or adjust do_install - this falls on
usually me, and my time to do these ever-growing maintenance things is
not infinite).

Alex


On Tue, 8 Nov 2022 at 20:12, Tristan Lelong <tlelong@...> wrote:

To be clear: OpenSSH maintainer will not accept a patch that exposes these files in the upstream version, but we got confirmation that they were ok if we maintained such a patch in OE (or a custom do_install in the recipe).

If this solution is not acceptable from the OE maintainers point of view, the next option is to update the HIBA recipe to fetch OpenSSH sources on top of HIBA sources directly in HIBA's workdir, and use these instead of the one from sysroot.

Would this work better for you?

On Tue, Nov 8, 2022, 18:16 Willy Tu <wltu@...> wrote:

I think they are fine with the hack here. oops. Ok, I'll work with
them to get the fix without this change.

Thanks for the feedback.

Willy Tu


On Tue, Nov 8, 2022 at 9:12 AM Alexander Kanavin <alex.kanavin@...> wrote:

On Tue, 8 Nov 2022 at 18:08, Willy Tu <wltu@...> wrote:

Thanks Alexander for the feedback,

We had some discussion internally with one of the OpenSSH maintainers
and they are fine with it. I'll try to see if there is a public forum
where we can share the discussion.
If they are fine with it, then you need to submit a patch to openssh
that installs the needed pieces (perhaps subject to a configure
switch), get it accepted, and then add a backport to oe-core, in that
order. No do_install_append hacks please.

Alex


[PATCH] classes: create-spdx: Move to version specific class

Joshua Watt
 

In expectation of SPDX 3.0 support, move the create-spdx.bbclass ->
create-spdx-2.2.bbclass. The create-spdx.bbclass class still exists and
can be used if a user doesn't care about which specific version of SPDX
they get.

Signed-off-by: Joshua Watt <JPEWhacker@...>
---
meta/classes/create-spdx-2.2.bbclass | 1025 ++++++++++++++++++++++++++
meta/classes/create-spdx.bbclass | 1023 +------------------------
2 files changed, 1028 insertions(+), 1020 deletions(-)
create mode 100644 meta/classes/create-spdx-2.2.bbclass

diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass
new file mode 100644
index 0000000000..af6afcc653
--- /dev/null
+++ b/meta/classes/create-spdx-2.2.bbclass
@@ -0,0 +1,1025 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+
+DEPLOY_DIR_SPDX ??= "${DEPLOY_DIR}/spdx/${MACHINE}"
+
+# The product name that the CVE database uses. Defaults to BPN, but may need to
+# be overriden per recipe (for example tiff.bb sets CVE_PRODUCT=libtiff).
+CVE_PRODUCT ??= "${BPN}"
+CVE_VERSION ??= "${PV}"
+
+SPDXDIR ??= "${WORKDIR}/spdx"
+SPDXDEPLOY = "${SPDXDIR}/deploy"
+SPDXWORK = "${SPDXDIR}/work"
+
+SPDX_TOOL_NAME ??= "oe-spdx-creator"
+SPDX_TOOL_VERSION ??= "1.0"
+
+SPDXRUNTIMEDEPLOY = "${SPDXDIR}/runtime-deploy"
+
+SPDX_INCLUDE_SOURCES ??= "0"
+SPDX_ARCHIVE_SOURCES ??= "0"
+SPDX_ARCHIVE_PACKAGED ??= "0"
+
+SPDX_UUID_NAMESPACE ??= "sbom.openembedded.org"
+SPDX_NAMESPACE_PREFIX ??= "http://spdx.org/spdxdoc"
+SPDX_PRETTY ??= "0"
+
+SPDX_LICENSES ??= "${COREBASE}/meta/files/spdx-licenses.json"
+
+SPDX_ORG ??= "OpenEmbedded ()"
+SPDX_SUPPLIER ??= "Organization: ${SPDX_ORG}"
+SPDX_SUPPLIER[doc] = "The SPDX PackageSupplier field for SPDX packages created from \
+ this recipe. For SPDX documents create using this class during the build, this \
+ is the contact information for the person or organization who is doing the \
+ build."
+
+def extract_licenses(filename):
+ import re
+
+ lic_regex = re.compile(rb'^\W*SPDX-License-Identifier:\s*([ \w\d.()+-]+?)(?:\s+\W*)?$', re.MULTILINE)
+
+ try:
+ with open(filename, 'rb') as f:
+ size = min(15000, os.stat(filename).st_size)
+ txt = f.read(size)
+ licenses = re.findall(lic_regex, txt)
+ if licenses:
+ ascii_licenses = [lic.decode('ascii') for lic in licenses]
+ return ascii_licenses
+ except Exception as e:
+ bb.warn(f"Exception reading {filename}: {e}")
+ return None
+
+def get_doc_namespace(d, doc):
+ import uuid
+ namespace_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, d.getVar("SPDX_UUID_NAMESPACE"))
+ return "%s/%s-%s" % (d.getVar("SPDX_NAMESPACE_PREFIX"), doc.name, str(uuid.uuid5(namespace_uuid, doc.name)))
+
+def create_annotation(d, comment):
+ from datetime import datetime, timezone
+
+ creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
+ annotation = oe.spdx.SPDXAnnotation()
+ annotation.annotationDate = creation_time
+ annotation.annotationType = "OTHER"
+ annotation.annotator = "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION"))
+ annotation.comment = comment
+ return annotation
+
+def recipe_spdx_is_native(d, recipe):
+ return any(a.annotationType == "OTHER" and
+ a.annotator == "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION")) and
+ a.comment == "isNative" for a in recipe.annotations)
+
+def is_work_shared_spdx(d):
+ return bb.data.inherits_class('kernel', d) or ('work-shared' in d.getVar('WORKDIR'))
+
+def get_json_indent(d):
+ if d.getVar("SPDX_PRETTY") == "1":
+ return 2
+ return None
+
+python() {
+ import json
+ if d.getVar("SPDX_LICENSE_DATA"):
+ return
+
+ with open(d.getVar("SPDX_LICENSES"), "r") as f:
+ data = json.load(f)
+ # Transform the license array to a dictionary
+ data["licenses"] = {l["licenseId"]: l for l in data["licenses"]}
+ d.setVar("SPDX_LICENSE_DATA", data)
+}
+
+def convert_license_to_spdx(lic, document, d, existing={}):
+ from pathlib import Path
+ import oe.spdx
+
+ license_data = d.getVar("SPDX_LICENSE_DATA")
+ extracted = {}
+
+ def add_extracted_license(ident, name):
+ nonlocal document
+
+ if name in extracted:
+ return
+
+ extracted_info = oe.spdx.SPDXExtractedLicensingInfo()
+ extracted_info.name = name
+ extracted_info.licenseId = ident
+ extracted_info.extractedText = None
+
+ if name == "PD":
+ # Special-case this.
+ extracted_info.extractedText = "Software released to the public domain"
+ else:
+ # Seach for the license in COMMON_LICENSE_DIR and LICENSE_PATH
+ for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split():
+ try:
+ with (Path(directory) / name).open(errors="replace") as f:
+ extracted_info.extractedText = f.read()
+ break
+ except FileNotFoundError:
+ pass
+ if extracted_info.extractedText is None:
+ # If it's not SPDX or PD, then NO_GENERIC_LICENSE must be set
+ filename = d.getVarFlag('NO_GENERIC_LICENSE', name)
+ if filename:
+ filename = d.expand("${S}/" + filename)
+ with open(filename, errors="replace") as f:
+ extracted_info.extractedText = f.read()
+ else:
+ bb.error("Cannot find any text for license %s" % name)
+
+ extracted[name] = extracted_info
+ document.hasExtractedLicensingInfos.append(extracted_info)
+
+ def convert(l):
+ if l == "(" or l == ")":
+ return l
+
+ if l == "&":
+ return "AND"
+
+ if l == "|":
+ return "OR"
+
+ if l == "CLOSED":
+ return "NONE"
+
+ spdx_license = d.getVarFlag("SPDXLICENSEMAP", l) or l
+ if spdx_license in license_data["licenses"]:
+ return spdx_license
+
+ try:
+ spdx_license = existing[l]
+ except KeyError:
+ spdx_license = "LicenseRef-" + l
+ add_extracted_license(spdx_license, l)
+
+ return spdx_license
+
+ lic_split = lic.replace("(", " ( ").replace(")", " ) ").split()
+
+ return ' '.join(convert(l) for l in lic_split)
+
+def process_sources(d):
+ pn = d.getVar('PN')
+ assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()
+ if pn in assume_provided:
+ for p in d.getVar("PROVIDES").split():
+ if p != pn:
+ pn = p
+ break
+
+ # glibc-locale: do_fetch, do_unpack and do_patch tasks have been deleted,
+ # so avoid archiving source here.
+ if pn.startswith('glibc-locale'):
+ return False
+ if d.getVar('PN') == "libtool-cross":
+ return False
+ if d.getVar('PN') == "libgcc-initial":
+ return False
+ if d.getVar('PN') == "shadow-sysroot":
+ return False
+
+ # We just archive gcc-source for all the gcc related recipes
+ if d.getVar('BPN') in ['gcc', 'libgcc']:
+ bb.debug(1, 'spdx: There is bug in scan of %s is, do nothing' % pn)
+ return False
+
+ return True
+
+
+def add_package_files(d, doc, spdx_pkg, topdir, get_spdxid, get_types, *, archive=None, ignore_dirs=[], ignore_top_level_dirs=[]):
+ from pathlib import Path
+ import oe.spdx
+ import hashlib
+
+ source_date_epoch = d.getVar("SOURCE_DATE_EPOCH")
+ if source_date_epoch:
+ source_date_epoch = int(source_date_epoch)
+
+ sha1s = []
+ spdx_files = []
+
+ file_counter = 1
+ for subdir, dirs, files in os.walk(topdir):
+ dirs[:] = [d for d in dirs if d not in ignore_dirs]
+ if subdir == str(topdir):
+ dirs[:] = [d for d in dirs if d not in ignore_top_level_dirs]
+
+ for file in files:
+ filepath = Path(subdir) / file
+ filename = str(filepath.relative_to(topdir))
+
+ if not filepath.is_symlink() and filepath.is_file():
+ spdx_file = oe.spdx.SPDXFile()
+ spdx_file.SPDXID = get_spdxid(file_counter)
+ for t in get_types(filepath):
+ spdx_file.fileTypes.append(t)
+ spdx_file.fileName = filename
+
+ if archive is not None:
+ with filepath.open("rb") as f:
+ info = archive.gettarinfo(fileobj=f)
+ info.name = filename
+ info.uid = 0
+ info.gid = 0
+ info.uname = "root"
+ info.gname = "root"
+
+ if source_date_epoch is not None and info.mtime > source_date_epoch:
+ info.mtime = source_date_epoch
+
+ archive.addfile(info, f)
+
+ sha1 = bb.utils.sha1_file(filepath)
+ sha1s.append(sha1)
+ spdx_file.checksums.append(oe.spdx.SPDXChecksum(
+ algorithm="SHA1",
+ checksumValue=sha1,
+ ))
+ spdx_file.checksums.append(oe.spdx.SPDXChecksum(
+ algorithm="SHA256",
+ checksumValue=bb.utils.sha256_file(filepath),
+ ))
+
+ if "SOURCE" in spdx_file.fileTypes:
+ extracted_lics = extract_licenses(filepath)
+ if extracted_lics:
+ spdx_file.licenseInfoInFiles = extracted_lics
+
+ doc.files.append(spdx_file)
+ doc.add_relationship(spdx_pkg, "CONTAINS", spdx_file)
+ spdx_pkg.hasFiles.append(spdx_file.SPDXID)
+
+ spdx_files.append(spdx_file)
+
+ file_counter += 1
+
+ sha1s.sort()
+ verifier = hashlib.sha1()
+ for v in sha1s:
+ verifier.update(v.encode("utf-8"))
+ spdx_pkg.packageVerificationCode.packageVerificationCodeValue = verifier.hexdigest()
+
+ return spdx_files
+
+
+def add_package_sources_from_debug(d, package_doc, spdx_package, package, package_files, sources):
+ from pathlib import Path
+ import hashlib
+ import oe.packagedata
+ import oe.spdx
+
+ debug_search_paths = [
+ Path(d.getVar('PKGD')),
+ Path(d.getVar('STAGING_DIR_TARGET')),
+ Path(d.getVar('STAGING_DIR_NATIVE')),
+ Path(d.getVar('STAGING_KERNEL_DIR')),
+ ]
+
+ pkg_data = oe.packagedata.read_subpkgdata_extended(package, d)
+
+ if pkg_data is None:
+ return
+
+ for file_path, file_data in pkg_data["files_info"].items():
+ if not "debugsrc" in file_data:
+ continue
+
+ for pkg_file in package_files:
+ if file_path.lstrip("/") == pkg_file.fileName.lstrip("/"):
+ break
+ else:
+ bb.fatal("No package file found for %s" % str(file_path))
+ continue
+
+ for debugsrc in file_data["debugsrc"]:
+ ref_id = "NOASSERTION"
+ for search in debug_search_paths:
+ if debugsrc.startswith("/usr/src/kernel"):
+ debugsrc_path = search / debugsrc.replace('/usr/src/kernel/', '')
+ else:
+ debugsrc_path = search / debugsrc.lstrip("/")
+ if not debugsrc_path.exists():
+ continue
+
+ file_sha256 = bb.utils.sha256_file(debugsrc_path)
+
+ if file_sha256 in sources:
+ source_file = sources[file_sha256]
+
+ doc_ref = package_doc.find_external_document_ref(source_file.doc.documentNamespace)
+ if doc_ref is None:
+ doc_ref = oe.spdx.SPDXExternalDocumentRef()
+ doc_ref.externalDocumentId = "DocumentRef-dependency-" + source_file.doc.name
+ doc_ref.spdxDocument = source_file.doc.documentNamespace
+ doc_ref.checksum.algorithm = "SHA1"
+ doc_ref.checksum.checksumValue = source_file.doc_sha1
+ package_doc.externalDocumentRefs.append(doc_ref)
+
+ ref_id = "%s:%s" % (doc_ref.externalDocumentId, source_file.file.SPDXID)
+ else:
+ bb.debug(1, "Debug source %s with SHA256 %s not found in any dependency" % (str(debugsrc_path), file_sha256))
+ break
+ else:
+ bb.debug(1, "Debug source %s not found" % debugsrc)
+
+ package_doc.add_relationship(pkg_file, "GENERATED_FROM", ref_id, comment=debugsrc)
+
+def collect_dep_recipes(d, doc, spdx_recipe):
+ from pathlib import Path
+ import oe.sbom
+ import oe.spdx
+
+ deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
+
+ dep_recipes = []
+ taskdepdata = d.getVar("BB_TASKDEPDATA", False)
+ deps = sorted(set(
+ dep[0] for dep in taskdepdata.values() if
+ dep[1] == "do_create_spdx" and dep[0] != d.getVar("PN")
+ ))
+ for dep_pn in deps:
+ dep_recipe_path = deploy_dir_spdx / "recipes" / ("recipe-%s.spdx.json" % dep_pn)
+
+ spdx_dep_doc, spdx_dep_sha1 = oe.sbom.read_doc(dep_recipe_path)
+
+ for pkg in spdx_dep_doc.packages:
+ if pkg.name == dep_pn:
+ spdx_dep_recipe = pkg
+ break
+ else:
+ continue
+
+ dep_recipes.append(oe.sbom.DepRecipe(spdx_dep_doc, spdx_dep_sha1, spdx_dep_recipe))
+
+ dep_recipe_ref = oe.spdx.SPDXExternalDocumentRef()
+ dep_recipe_ref.externalDocumentId = "DocumentRef-dependency-" + spdx_dep_doc.name
+ dep_recipe_ref.spdxDocument = spdx_dep_doc.documentNamespace
+ dep_recipe_ref.checksum.algorithm = "SHA1"
+ dep_recipe_ref.checksum.checksumValue = spdx_dep_sha1
+
+ doc.externalDocumentRefs.append(dep_recipe_ref)
+
+ doc.add_relationship(
+ "%s:%s" % (dep_recipe_ref.externalDocumentId, spdx_dep_recipe.SPDXID),
+ "BUILD_DEPENDENCY_OF",
+ spdx_recipe
+ )
+
+ return dep_recipes
+
+collect_dep_recipes[vardepsexclude] += "BB_TASKDEPDATA"
+
+
+def collect_dep_sources(d, dep_recipes):
+ import oe.sbom
+
+ sources = {}
+ for dep in dep_recipes:
+ # Don't collect sources from native recipes as they
+ # match non-native sources also.
+ if recipe_spdx_is_native(d, dep.recipe):
+ continue
+ recipe_files = set(dep.recipe.hasFiles)
+
+ for spdx_file in dep.doc.files:
+ if spdx_file.SPDXID not in recipe_files:
+ continue
+
+ if "SOURCE" in spdx_file.fileTypes:
+ for checksum in spdx_file.checksums:
+ if checksum.algorithm == "SHA256":
+ sources[checksum.checksumValue] = oe.sbom.DepSource(dep.doc, dep.doc_sha1, dep.recipe, spdx_file)
+ break
+
+ return sources
+
+
+python do_create_spdx() {
+ from datetime import datetime, timezone
+ import oe.sbom
+ import oe.spdx
+ import uuid
+ from pathlib import Path
+ from contextlib import contextmanager
+ import oe.cve_check
+
+ @contextmanager
+ def optional_tarfile(name, guard, mode="w"):
+ import tarfile
+ import bb.compress.zstd
+
+ num_threads = int(d.getVar("BB_NUMBER_THREADS"))
+
+ if guard:
+ name.parent.mkdir(parents=True, exist_ok=True)
+ with bb.compress.zstd.open(name, mode=mode + "b", num_threads=num_threads) as f:
+ with tarfile.open(fileobj=f, mode=mode + "|") as tf:
+ yield tf
+ else:
+ yield None
+
+
+ deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
+ spdx_workdir = Path(d.getVar("SPDXWORK"))
+ include_sources = d.getVar("SPDX_INCLUDE_SOURCES") == "1"
+ archive_sources = d.getVar("SPDX_ARCHIVE_SOURCES") == "1"
+ archive_packaged = d.getVar("SPDX_ARCHIVE_PACKAGED") == "1"
+
+ creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
+
+ doc = oe.spdx.SPDXDocument()
+
+ doc.name = "recipe-" + d.getVar("PN")
+ doc.documentNamespace = get_doc_namespace(d, doc)
+ doc.creationInfo.created = creation_time
+ doc.creationInfo.comment = "This document was created by analyzing recipe files during the build."
+ doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"]
+ doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass")
+ doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG"))
+ doc.creationInfo.creators.append("Person: N/A ()")
+
+ recipe = oe.spdx.SPDXPackage()
+ recipe.name = d.getVar("PN")
+ recipe.versionInfo = d.getVar("PV")
+ recipe.SPDXID = oe.sbom.get_recipe_spdxid(d)
+ recipe.supplier = d.getVar("SPDX_SUPPLIER")
+ if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d):
+ recipe.annotations.append(create_annotation(d, "isNative"))
+
+ for s in d.getVar('SRC_URI').split():
+ if not s.startswith("file://"):
+ s = s.split(';')[0]
+ recipe.downloadLocation = s
+ break
+ else:
+ recipe.downloadLocation = "NOASSERTION"
+
+ homepage = d.getVar("HOMEPAGE")
+ if homepage:
+ recipe.homepage = homepage
+
+ license = d.getVar("LICENSE")
+ if license:
+ recipe.licenseDeclared = convert_license_to_spdx(license, doc, d)
+
+ summary = d.getVar("SUMMARY")
+ if summary:
+ recipe.summary = summary
+
+ description = d.getVar("DESCRIPTION")
+ if description:
+ recipe.description = description
+
+ # Some CVEs may be patched during the build process without incrementing the version number,
+ # so querying for CVEs based on the CPE id can lead to false positives. To account for this,
+ # save the CVEs fixed by patches to source information field in the SPDX.
+ patched_cves = oe.cve_check.get_patched_cves(d)
+ patched_cves = list(patched_cves)
+ patched_cves = ' '.join(patched_cves)
+ if patched_cves:
+ recipe.sourceInfo = "CVEs fixed: " + patched_cves
+
+ cpe_ids = oe.cve_check.get_cpe_ids(d.getVar("CVE_PRODUCT"), d.getVar("CVE_VERSION"))
+ if cpe_ids:
+ for cpe_id in cpe_ids:
+ cpe = oe.spdx.SPDXExternalReference()
+ cpe.referenceCategory = "SECURITY"
+ cpe.referenceType = "http://spdx.org/rdf/references/cpe23Type"
+ cpe.referenceLocator = cpe_id
+ recipe.externalRefs.append(cpe)
+
+ doc.packages.append(recipe)
+ doc.add_relationship(doc, "DESCRIBES", recipe)
+
+ if process_sources(d) and include_sources:
+ recipe_archive = deploy_dir_spdx / "recipes" / (doc.name + ".tar.zst")
+ with optional_tarfile(recipe_archive, archive_sources) as archive:
+ spdx_get_src(d)
+
+ add_package_files(
+ d,
+ doc,
+ recipe,
+ spdx_workdir,
+ lambda file_counter: "SPDXRef-SourceFile-%s-%d" % (d.getVar("PN"), file_counter),
+ lambda filepath: ["SOURCE"],
+ ignore_dirs=[".git"],
+ ignore_top_level_dirs=["temp"],
+ archive=archive,
+ )
+
+ if archive is not None:
+ recipe.packageFileName = str(recipe_archive.name)
+
+ dep_recipes = collect_dep_recipes(d, doc, recipe)
+
+ doc_sha1 = oe.sbom.write_doc(d, doc, "recipes", indent=get_json_indent(d))
+ dep_recipes.append(oe.sbom.DepRecipe(doc, doc_sha1, recipe))
+
+ recipe_ref = oe.spdx.SPDXExternalDocumentRef()
+ recipe_ref.externalDocumentId = "DocumentRef-recipe-" + recipe.name
+ recipe_ref.spdxDocument = doc.documentNamespace
+ recipe_ref.checksum.algorithm = "SHA1"
+ recipe_ref.checksum.checksumValue = doc_sha1
+
+ sources = collect_dep_sources(d, dep_recipes)
+ found_licenses = {license.name:recipe_ref.externalDocumentId + ":" + license.licenseId for license in doc.hasExtractedLicensingInfos}
+
+ if not recipe_spdx_is_native(d, recipe):
+ bb.build.exec_func("read_subpackage_metadata", d)
+
+ pkgdest = Path(d.getVar("PKGDEST"))
+ for package in d.getVar("PACKAGES").split():
+ if not oe.packagedata.packaged(package, d):
+ continue
+
+ package_doc = oe.spdx.SPDXDocument()
+ pkg_name = d.getVar("PKG:%s" % package) or package
+ package_doc.name = pkg_name
+ package_doc.documentNamespace = get_doc_namespace(d, package_doc)
+ package_doc.creationInfo.created = creation_time
+ package_doc.creationInfo.comment = "This document was created by analyzing packages created during the build."
+ package_doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"]
+ package_doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass")
+ package_doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG"))
+ package_doc.creationInfo.creators.append("Person: N/A ()")
+ package_doc.externalDocumentRefs.append(recipe_ref)
+
+ package_license = d.getVar("LICENSE:%s" % package) or d.getVar("LICENSE")
+
+ spdx_package = oe.spdx.SPDXPackage()
+
+ spdx_package.SPDXID = oe.sbom.get_package_spdxid(pkg_name)
+ spdx_package.name = pkg_name
+ spdx_package.versionInfo = d.getVar("PV")
+ spdx_package.licenseDeclared = convert_license_to_spdx(package_license, package_doc, d, found_licenses)
+ spdx_package.supplier = d.getVar("SPDX_SUPPLIER")
+
+ package_doc.packages.append(spdx_package)
+
+ package_doc.add_relationship(spdx_package, "GENERATED_FROM", "%s:%s" % (recipe_ref.externalDocumentId, recipe.SPDXID))
+ package_doc.add_relationship(package_doc, "DESCRIBES", spdx_package)
+
+ package_archive = deploy_dir_spdx / "packages" / (package_doc.name + ".tar.zst")
+ with optional_tarfile(package_archive, archive_packaged) as archive:
+ package_files = add_package_files(
+ d,
+ package_doc,
+ spdx_package,
+ pkgdest / package,
+ lambda file_counter: oe.sbom.get_packaged_file_spdxid(pkg_name, file_counter),
+ lambda filepath: ["BINARY"],
+ ignore_top_level_dirs=['CONTROL', 'DEBIAN'],
+ archive=archive,
+ )
+
+ if archive is not None:
+ spdx_package.packageFileName = str(package_archive.name)
+
+ add_package_sources_from_debug(d, package_doc, spdx_package, package, package_files, sources)
+
+ oe.sbom.write_doc(d, package_doc, "packages", indent=get_json_indent(d))
+}
+# NOTE: depending on do_unpack is a hack that is necessary to get it's dependencies for archive the source
+addtask do_create_spdx after do_package do_packagedata do_unpack before do_populate_sdk do_build do_rm_work
+
+SSTATETASKS += "do_create_spdx"
+do_create_spdx[sstate-inputdirs] = "${SPDXDEPLOY}"
+do_create_spdx[sstate-outputdirs] = "${DEPLOY_DIR_SPDX}"
+
+python do_create_spdx_setscene () {
+ sstate_setscene(d)
+}
+addtask do_create_spdx_setscene
+
+do_create_spdx[dirs] = "${SPDXWORK}"
+do_create_spdx[cleandirs] = "${SPDXDEPLOY} ${SPDXWORK}"
+do_create_spdx[depends] += "${PATCHDEPENDENCY}"
+do_create_spdx[deptask] = "do_create_spdx"
+
+def collect_package_providers(d):
+ from pathlib import Path
+ import oe.sbom
+ import oe.spdx
+ import json
+
+ deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
+
+ providers = {}
+
+ taskdepdata = d.getVar("BB_TASKDEPDATA", False)
+ deps = sorted(set(
+ dep[0] for dep in taskdepdata.values() if dep[0] != d.getVar("PN")
+ ))
+ deps.append(d.getVar("PN"))
+
+ for dep_pn in deps:
+ recipe_data = oe.packagedata.read_pkgdata(dep_pn, d)
+
+ for pkg in recipe_data.get("PACKAGES", "").split():
+
+ pkg_data = oe.packagedata.read_subpkgdata_dict(pkg, d)
+ rprovides = set(n for n, _ in bb.utils.explode_dep_versions2(pkg_data.get("RPROVIDES", "")).items())
+ rprovides.add(pkg)
+
+ for r in rprovides:
+ providers[r] = pkg
+
+ return providers
+
+collect_package_providers[vardepsexclude] += "BB_TASKDEPDATA"
+
+python do_create_runtime_spdx() {
+ from datetime import datetime, timezone
+ import oe.sbom
+ import oe.spdx
+ import oe.packagedata
+ from pathlib import Path
+
+ deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
+ spdx_deploy = Path(d.getVar("SPDXRUNTIMEDEPLOY"))
+ is_native = bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d)
+
+ creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
+
+ providers = collect_package_providers(d)
+
+ if not is_native:
+ bb.build.exec_func("read_subpackage_metadata", d)
+
+ dep_package_cache = {}
+
+ pkgdest = Path(d.getVar("PKGDEST"))
+ for package in d.getVar("PACKAGES").split():
+ localdata = bb.data.createCopy(d)
+ pkg_name = d.getVar("PKG:%s" % package) or package
+ localdata.setVar("PKG", pkg_name)
+ localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + package)
+
+ if not oe.packagedata.packaged(package, localdata):
+ continue
+
+ pkg_spdx_path = deploy_dir_spdx / "packages" / (pkg_name + ".spdx.json")
+
+ package_doc, package_doc_sha1 = oe.sbom.read_doc(pkg_spdx_path)
+
+ for p in package_doc.packages:
+ if p.name == pkg_name:
+ spdx_package = p
+ break
+ else:
+ bb.fatal("Package '%s' not found in %s" % (pkg_name, pkg_spdx_path))
+
+ runtime_doc = oe.spdx.SPDXDocument()
+ runtime_doc.name = "runtime-" + pkg_name
+ runtime_doc.documentNamespace = get_doc_namespace(localdata, runtime_doc)
+ runtime_doc.creationInfo.created = creation_time
+ runtime_doc.creationInfo.comment = "This document was created by analyzing package runtime dependencies."
+ runtime_doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"]
+ runtime_doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass")
+ runtime_doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG"))
+ runtime_doc.creationInfo.creators.append("Person: N/A ()")
+
+ package_ref = oe.spdx.SPDXExternalDocumentRef()
+ package_ref.externalDocumentId = "DocumentRef-package-" + package
+ package_ref.spdxDocument = package_doc.documentNamespace
+ package_ref.checksum.algorithm = "SHA1"
+ package_ref.checksum.checksumValue = package_doc_sha1
+
+ runtime_doc.externalDocumentRefs.append(package_ref)
+
+ runtime_doc.add_relationship(
+ runtime_doc.SPDXID,
+ "AMENDS",
+ "%s:%s" % (package_ref.externalDocumentId, package_doc.SPDXID)
+ )
+
+ deps = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
+ seen_deps = set()
+ for dep, _ in deps.items():
+ if dep in seen_deps:
+ continue
+
+ if dep not in providers:
+ continue
+
+ dep = providers[dep]
+
+ if not oe.packagedata.packaged(dep, localdata):
+ continue
+
+ dep_pkg_data = oe.packagedata.read_subpkgdata_dict(dep, d)
+ dep_pkg = dep_pkg_data["PKG"]
+
+ if dep in dep_package_cache:
+ (dep_spdx_package, dep_package_ref) = dep_package_cache[dep]
+ else:
+ dep_path = deploy_dir_spdx / "packages" / ("%s.spdx.json" % dep_pkg)
+
+ spdx_dep_doc, spdx_dep_sha1 = oe.sbom.read_doc(dep_path)
+
+ for pkg in spdx_dep_doc.packages:
+ if pkg.name == dep_pkg:
+ dep_spdx_package = pkg
+ break
+ else:
+ bb.fatal("Package '%s' not found in %s" % (dep_pkg, dep_path))
+
+ dep_package_ref = oe.spdx.SPDXExternalDocumentRef()
+ dep_package_ref.externalDocumentId = "DocumentRef-runtime-dependency-" + spdx_dep_doc.name
+ dep_package_ref.spdxDocument = spdx_dep_doc.documentNamespace
+ dep_package_ref.checksum.algorithm = "SHA1"
+ dep_package_ref.checksum.checksumValue = spdx_dep_sha1
+
+ dep_package_cache[dep] = (dep_spdx_package, dep_package_ref)
+
+ runtime_doc.externalDocumentRefs.append(dep_package_ref)
+
+ runtime_doc.add_relationship(
+ "%s:%s" % (dep_package_ref.externalDocumentId, dep_spdx_package.SPDXID),
+ "RUNTIME_DEPENDENCY_OF",
+ "%s:%s" % (package_ref.externalDocumentId, spdx_package.SPDXID)
+ )
+ seen_deps.add(dep)
+
+ oe.sbom.write_doc(d, runtime_doc, "runtime", spdx_deploy, indent=get_json_indent(d))
+}
+
+addtask do_create_runtime_spdx after do_create_spdx before do_build do_rm_work
+SSTATETASKS += "do_create_runtime_spdx"
+do_create_runtime_spdx[sstate-inputdirs] = "${SPDXRUNTIMEDEPLOY}"
+do_create_runtime_spdx[sstate-outputdirs] = "${DEPLOY_DIR_SPDX}"
+
+python do_create_runtime_spdx_setscene () {
+ sstate_setscene(d)
+}
+addtask do_create_runtime_spdx_setscene
+
+do_create_runtime_spdx[dirs] = "${SPDXRUNTIMEDEPLOY}"
+do_create_runtime_spdx[cleandirs] = "${SPDXRUNTIMEDEPLOY}"
+do_create_runtime_spdx[rdeptask] = "do_create_spdx"
+
+def spdx_get_src(d):
+ """
+ save patched source of the recipe in SPDX_WORKDIR.
+ """
+ import shutil
+ spdx_workdir = d.getVar('SPDXWORK')
+ spdx_sysroot_native = d.getVar('STAGING_DIR_NATIVE')
+ pn = d.getVar('PN')
+
+ workdir = d.getVar("WORKDIR")
+
+ try:
+ # The kernel class functions require it to be on work-shared, so we dont change WORKDIR
+ if not is_work_shared_spdx(d):
+ # Change the WORKDIR to make do_unpack do_patch run in another dir.
+ d.setVar('WORKDIR', spdx_workdir)
+ # Restore the original path to recipe's native sysroot (it's relative to WORKDIR).
+ d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native)
+
+ # The changed 'WORKDIR' also caused 'B' changed, create dir 'B' for the
+ # possibly requiring of the following tasks (such as some recipes's
+ # do_patch required 'B' existed).
+ bb.utils.mkdirhier(d.getVar('B'))
+
+ bb.build.exec_func('do_unpack', d)
+ # Copy source of kernel to spdx_workdir
+ if is_work_shared_spdx(d):
+ d.setVar('WORKDIR', spdx_workdir)
+ d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native)
+ src_dir = spdx_workdir + "/" + d.getVar('PN')+ "-" + d.getVar('PV') + "-" + d.getVar('PR')
+ bb.utils.mkdirhier(src_dir)
+ if bb.data.inherits_class('kernel',d):
+ share_src = d.getVar('STAGING_KERNEL_DIR')
+ cmd_copy_share = "cp -rf " + share_src + "/* " + src_dir + "/"
+ cmd_copy_kernel_result = os.popen(cmd_copy_share).read()
+ bb.note("cmd_copy_kernel_result = " + cmd_copy_kernel_result)
+
+ git_path = src_dir + "/.git"
+ if os.path.exists(git_path):
+ shutils.rmtree(git_path)
+
+ # Make sure gcc and kernel sources are patched only once
+ if not (d.getVar('SRC_URI') == "" or is_work_shared_spdx(d)):
+ bb.build.exec_func('do_patch', d)
+
+ # Some userland has no source.
+ if not os.path.exists( spdx_workdir ):
+ bb.utils.mkdirhier(spdx_workdir)
+ finally:
+ d.setVar("WORKDIR", workdir)
+
+do_rootfs[recrdeptask] += "do_create_spdx do_create_runtime_spdx"
+
+ROOTFS_POSTUNINSTALL_COMMAND =+ "image_combine_spdx ; "
+
+do_populate_sdk[recrdeptask] += "do_create_spdx do_create_runtime_spdx"
+POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " sdk_host_combine_spdx; "
+POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " sdk_target_combine_spdx; "
+
+python image_combine_spdx() {
+ import os
+ import oe.sbom
+ from pathlib import Path
+ from oe.rootfs import image_list_installed_packages
+
+ image_name = d.getVar("IMAGE_NAME")
+ image_link_name = d.getVar("IMAGE_LINK_NAME")
+ imgdeploydir = Path(d.getVar("IMGDEPLOYDIR"))
+ img_spdxid = oe.sbom.get_image_spdxid(image_name)
+ packages = image_list_installed_packages(d)
+
+ combine_spdx(d, image_name, imgdeploydir, img_spdxid, packages)
+
+ def make_image_link(target_path, suffix):
+ if image_link_name:
+ link = imgdeploydir / (image_link_name + suffix)
+ if link != target_path:
+ link.symlink_to(os.path.relpath(target_path, link.parent))
+
+ image_spdx_path = imgdeploydir / (image_name + ".spdx.json")
+ make_image_link(image_spdx_path, ".spdx.json")
+ spdx_tar_path = imgdeploydir / (image_name + ".spdx.tar.zst")
+ make_image_link(spdx_tar_path, ".spdx.tar.zst")
+ spdx_index_path = imgdeploydir / (image_name + ".spdx.index.json")
+ make_image_link(spdx_index_path, ".spdx.index.json")
+}
+
+python sdk_host_combine_spdx() {
+ sdk_combine_spdx(d, "host")
+}
+
+python sdk_target_combine_spdx() {
+ sdk_combine_spdx(d, "target")
+}
+
+def sdk_combine_spdx(d, sdk_type):
+ import oe.sbom
+ from pathlib import Path
+ from oe.sdk import sdk_list_installed_packages
+
+ sdk_name = d.getVar("SDK_NAME") + "-" + sdk_type
+ sdk_deploydir = Path(d.getVar("SDKDEPLOYDIR"))
+ sdk_spdxid = oe.sbom.get_sdk_spdxid(sdk_name)
+ sdk_packages = sdk_list_installed_packages(d, sdk_type == "target")
+ combine_spdx(d, sdk_name, sdk_deploydir, sdk_spdxid, sdk_packages)
+
+def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages):
+ import os
+ import oe.spdx
+ import oe.sbom
+ import io
+ import json
+ from datetime import timezone, datetime
+ from pathlib import Path
+ import tarfile
+ import bb.compress.zstd
+
+ creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
+ deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
+ source_date_epoch = d.getVar("SOURCE_DATE_EPOCH")
+
+ doc = oe.spdx.SPDXDocument()
+ doc.name = rootfs_name
+ doc.documentNamespace = get_doc_namespace(d, doc)
+ doc.creationInfo.created = creation_time
+ doc.creationInfo.comment = "This document was created by analyzing the source of the Yocto recipe during the build."
+ doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"]
+ doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass")
+ doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG"))
+ doc.creationInfo.creators.append("Person: N/A ()")
+
+ image = oe.spdx.SPDXPackage()
+ image.name = d.getVar("PN")
+ image.versionInfo = d.getVar("PV")
+ image.SPDXID = rootfs_spdxid
+ image.supplier = d.getVar("SPDX_SUPPLIER")
+
+ doc.packages.append(image)
+
+ for name in sorted(packages.keys()):
+ pkg_spdx_path = deploy_dir_spdx / "packages" / (name + ".spdx.json")
+ pkg_doc, pkg_doc_sha1 = oe.sbom.read_doc(pkg_spdx_path)
+
+ for p in pkg_doc.packages:
+ if p.name == name:
+ pkg_ref = oe.spdx.SPDXExternalDocumentRef()
+ pkg_ref.externalDocumentId = "DocumentRef-%s" % pkg_doc.name
+ pkg_ref.spdxDocument = pkg_doc.documentNamespace
+ pkg_ref.checksum.algorithm = "SHA1"
+ pkg_ref.checksum.checksumValue = pkg_doc_sha1
+
+ doc.externalDocumentRefs.append(pkg_ref)
+ doc.add_relationship(image, "CONTAINS", "%s:%s" % (pkg_ref.externalDocumentId, p.SPDXID))
+ break
+ else:
+ bb.fatal("Unable to find package with name '%s' in SPDX file %s" % (name, pkg_spdx_path))
+
+ runtime_spdx_path = deploy_dir_spdx / "runtime" / ("runtime-" + name + ".spdx.json")
+ runtime_doc, runtime_doc_sha1 = oe.sbom.read_doc(runtime_spdx_path)
+
+ runtime_ref = oe.spdx.SPDXExternalDocumentRef()
+ runtime_ref.externalDocumentId = "DocumentRef-%s" % runtime_doc.name
+ runtime_ref.spdxDocument = runtime_doc.documentNamespace
+ runtime_ref.checksum.algorithm = "SHA1"
+ runtime_ref.checksum.checksumValue = runtime_doc_sha1
+
+ # "OTHER" isn't ideal here, but I can't find a relationship that makes sense
+ doc.externalDocumentRefs.append(runtime_ref)
+ doc.add_relationship(
+ image,
+ "OTHER",
+ "%s:%s" % (runtime_ref.externalDocumentId, runtime_doc.SPDXID),
+ comment="Runtime dependencies for %s" % name
+ )
+
+ image_spdx_path = rootfs_deploydir / (rootfs_name + ".spdx.json")
+
+ with image_spdx_path.open("wb") as f:
+ doc.to_json(f, sort_keys=True, indent=get_json_indent(d))
+
+ num_threads = int(d.getVar("BB_NUMBER_THREADS"))
+
+ visited_docs = set()
+
+ index = {"documents": []}
+
+ spdx_tar_path = rootfs_deploydir / (rootfs_name + ".spdx.tar.zst")
+ with bb.compress.zstd.open(spdx_tar_path, "w", num_threads=num_threads) as f:
+ with tarfile.open(fileobj=f, mode="w|") as tar:
+ def collect_spdx_document(path):
+ nonlocal tar
+ nonlocal deploy_dir_spdx
+ nonlocal source_date_epoch
+ nonlocal index
+
+ if path in visited_docs:
+ return
+
+ visited_docs.add(path)
+
+ with path.open("rb") as f:
+ doc, sha1 = oe.sbom.read_doc(f)
+ f.seek(0)
+
+ if doc.documentNamespace in visited_docs:
+ return
+
+ bb.note("Adding SPDX document %s" % path)
+ visited_docs.add(doc.documentNamespace)
+ info = tar.gettarinfo(fileobj=f)
+
+ info.name = doc.name + ".spdx.json"
+ info.uid = 0
+ info.gid = 0
+ info.uname = "root"
+ info.gname = "root"
+
+ if source_date_epoch is not None and info.mtime > int(source_date_epoch):
+ info.mtime = int(source_date_epoch)
+
+ tar.addfile(info, f)
+
+ index["documents"].append({
+ "filename": info.name,
+ "documentNamespace": doc.documentNamespace,
+ "sha1": sha1,
+ })
+
+ for ref in doc.externalDocumentRefs:
+ ref_path = deploy_dir_spdx / "by-namespace" / ref.spdxDocument.replace("/", "_")
+ collect_spdx_document(ref_path)
+
+ collect_spdx_document(image_spdx_path)
+
+ index["documents"].sort(key=lambda x: x["filename"])
+
+ index_str = io.BytesIO(json.dumps(
+ index,
+ sort_keys=True,
+ indent=get_json_indent(d),
+ ).encode("utf-8"))
+
+ info = tarfile.TarInfo()
+ info.name = "index.json"
+ info.size = len(index_str.getvalue())
+ info.uid = 0
+ info.gid = 0
+ info.uname = "root"
+ info.gname = "root"
+
+ tar.addfile(info, fileobj=index_str)
+
+ spdx_index_path = rootfs_deploydir / (rootfs_name + ".spdx.index.json")
+ with spdx_index_path.open("w") as f:
+ json.dump(index, f, sort_keys=True, indent=get_json_indent(d))
diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass
index af6afcc653..19c6c0ff0b 100644
--- a/meta/classes/create-spdx.bbclass
+++ b/meta/classes/create-spdx.bbclass
@@ -3,1023 +3,6 @@
#
# SPDX-License-Identifier: GPL-2.0-only
#
-
-DEPLOY_DIR_SPDX ??= "${DEPLOY_DIR}/spdx/${MACHINE}"
-
-# The product name that the CVE database uses. Defaults to BPN, but may need to
-# be overriden per recipe (for example tiff.bb sets CVE_PRODUCT=libtiff).
-CVE_PRODUCT ??= "${BPN}"
-CVE_VERSION ??= "${PV}"
-
-SPDXDIR ??= "${WORKDIR}/spdx"
-SPDXDEPLOY = "${SPDXDIR}/deploy"
-SPDXWORK = "${SPDXDIR}/work"
-
-SPDX_TOOL_NAME ??= "oe-spdx-creator"
-SPDX_TOOL_VERSION ??= "1.0"
-
-SPDXRUNTIMEDEPLOY = "${SPDXDIR}/runtime-deploy"
-
-SPDX_INCLUDE_SOURCES ??= "0"
-SPDX_ARCHIVE_SOURCES ??= "0"
-SPDX_ARCHIVE_PACKAGED ??= "0"
-
-SPDX_UUID_NAMESPACE ??= "sbom.openembedded.org"
-SPDX_NAMESPACE_PREFIX ??= "http://spdx.org/spdxdoc"
-SPDX_PRETTY ??= "0"
-
-SPDX_LICENSES ??= "${COREBASE}/meta/files/spdx-licenses.json"
-
-SPDX_ORG ??= "OpenEmbedded ()"
-SPDX_SUPPLIER ??= "Organization: ${SPDX_ORG}"
-SPDX_SUPPLIER[doc] = "The SPDX PackageSupplier field for SPDX packages created from \
- this recipe. For SPDX documents create using this class during the build, this \
- is the contact information for the person or organization who is doing the \
- build."
-
-def extract_licenses(filename):
- import re
-
- lic_regex = re.compile(rb'^\W*SPDX-License-Identifier:\s*([ \w\d.()+-]+?)(?:\s+\W*)?$', re.MULTILINE)
-
- try:
- with open(filename, 'rb') as f:
- size = min(15000, os.stat(filename).st_size)
- txt = f.read(size)
- licenses = re.findall(lic_regex, txt)
- if licenses:
- ascii_licenses = [lic.decode('ascii') for lic in licenses]
- return ascii_licenses
- except Exception as e:
- bb.warn(f"Exception reading {filename}: {e}")
- return None
-
-def get_doc_namespace(d, doc):
- import uuid
- namespace_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, d.getVar("SPDX_UUID_NAMESPACE"))
- return "%s/%s-%s" % (d.getVar("SPDX_NAMESPACE_PREFIX"), doc.name, str(uuid.uuid5(namespace_uuid, doc.name)))
-
-def create_annotation(d, comment):
- from datetime import datetime, timezone
-
- creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
- annotation = oe.spdx.SPDXAnnotation()
- annotation.annotationDate = creation_time
- annotation.annotationType = "OTHER"
- annotation.annotator = "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION"))
- annotation.comment = comment
- return annotation
-
-def recipe_spdx_is_native(d, recipe):
- return any(a.annotationType == "OTHER" and
- a.annotator == "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION")) and
- a.comment == "isNative" for a in recipe.annotations)
-
-def is_work_shared_spdx(d):
- return bb.data.inherits_class('kernel', d) or ('work-shared' in d.getVar('WORKDIR'))
-
-def get_json_indent(d):
- if d.getVar("SPDX_PRETTY") == "1":
- return 2
- return None
-
-python() {
- import json
- if d.getVar("SPDX_LICENSE_DATA"):
- return
-
- with open(d.getVar("SPDX_LICENSES"), "r") as f:
- data = json.load(f)
- # Transform the license array to a dictionary
- data["licenses"] = {l["licenseId"]: l for l in data["licenses"]}
- d.setVar("SPDX_LICENSE_DATA", data)
-}
-
-def convert_license_to_spdx(lic, document, d, existing={}):
- from pathlib import Path
- import oe.spdx
-
- license_data = d.getVar("SPDX_LICENSE_DATA")
- extracted = {}
-
- def add_extracted_license(ident, name):
- nonlocal document
-
- if name in extracted:
- return
-
- extracted_info = oe.spdx.SPDXExtractedLicensingInfo()
- extracted_info.name = name
- extracted_info.licenseId = ident
- extracted_info.extractedText = None
-
- if name == "PD":
- # Special-case this.
- extracted_info.extractedText = "Software released to the public domain"
- else:
- # Seach for the license in COMMON_LICENSE_DIR and LICENSE_PATH
- for directory in [d.getVar('COMMON_LICENSE_DIR')] + (d.getVar('LICENSE_PATH') or '').split():
- try:
- with (Path(directory) / name).open(errors="replace") as f:
- extracted_info.extractedText = f.read()
- break
- except FileNotFoundError:
- pass
- if extracted_info.extractedText is None:
- # If it's not SPDX or PD, then NO_GENERIC_LICENSE must be set
- filename = d.getVarFlag('NO_GENERIC_LICENSE', name)
- if filename:
- filename = d.expand("${S}/" + filename)
- with open(filename, errors="replace") as f:
- extracted_info.extractedText = f.read()
- else:
- bb.error("Cannot find any text for license %s" % name)
-
- extracted[name] = extracted_info
- document.hasExtractedLicensingInfos.append(extracted_info)
-
- def convert(l):
- if l == "(" or l == ")":
- return l
-
- if l == "&":
- return "AND"
-
- if l == "|":
- return "OR"
-
- if l == "CLOSED":
- return "NONE"
-
- spdx_license = d.getVarFlag("SPDXLICENSEMAP", l) or l
- if spdx_license in license_data["licenses"]:
- return spdx_license
-
- try:
- spdx_license = existing[l]
- except KeyError:
- spdx_license = "LicenseRef-" + l
- add_extracted_license(spdx_license, l)
-
- return spdx_license
-
- lic_split = lic.replace("(", " ( ").replace(")", " ) ").split()
-
- return ' '.join(convert(l) for l in lic_split)
-
-def process_sources(d):
- pn = d.getVar('PN')
- assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split()
- if pn in assume_provided:
- for p in d.getVar("PROVIDES").split():
- if p != pn:
- pn = p
- break
-
- # glibc-locale: do_fetch, do_unpack and do_patch tasks have been deleted,
- # so avoid archiving source here.
- if pn.startswith('glibc-locale'):
- return False
- if d.getVar('PN') == "libtool-cross":
- return False
- if d.getVar('PN') == "libgcc-initial":
- return False
- if d.getVar('PN') == "shadow-sysroot":
- return False
-
- # We just archive gcc-source for all the gcc related recipes
- if d.getVar('BPN') in ['gcc', 'libgcc']:
- bb.debug(1, 'spdx: There is bug in scan of %s is, do nothing' % pn)
- return False
-
- return True
-
-
-def add_package_files(d, doc, spdx_pkg, topdir, get_spdxid, get_types, *, archive=None, ignore_dirs=[], ignore_top_level_dirs=[]):
- from pathlib import Path
- import oe.spdx
- import hashlib
-
- source_date_epoch = d.getVar("SOURCE_DATE_EPOCH")
- if source_date_epoch:
- source_date_epoch = int(source_date_epoch)
-
- sha1s = []
- spdx_files = []
-
- file_counter = 1
- for subdir, dirs, files in os.walk(topdir):
- dirs[:] = [d for d in dirs if d not in ignore_dirs]
- if subdir == str(topdir):
- dirs[:] = [d for d in dirs if d not in ignore_top_level_dirs]
-
- for file in files:
- filepath = Path(subdir) / file
- filename = str(filepath.relative_to(topdir))
-
- if not filepath.is_symlink() and filepath.is_file():
- spdx_file = oe.spdx.SPDXFile()
- spdx_file.SPDXID = get_spdxid(file_counter)
- for t in get_types(filepath):
- spdx_file.fileTypes.append(t)
- spdx_file.fileName = filename
-
- if archive is not None:
- with filepath.open("rb") as f:
- info = archive.gettarinfo(fileobj=f)
- info.name = filename
- info.uid = 0
- info.gid = 0
- info.uname = "root"
- info.gname = "root"
-
- if source_date_epoch is not None and info.mtime > source_date_epoch:
- info.mtime = source_date_epoch
-
- archive.addfile(info, f)
-
- sha1 = bb.utils.sha1_file(filepath)
- sha1s.append(sha1)
- spdx_file.checksums.append(oe.spdx.SPDXChecksum(
- algorithm="SHA1",
- checksumValue=sha1,
- ))
- spdx_file.checksums.append(oe.spdx.SPDXChecksum(
- algorithm="SHA256",
- checksumValue=bb.utils.sha256_file(filepath),
- ))
-
- if "SOURCE" in spdx_file.fileTypes:
- extracted_lics = extract_licenses(filepath)
- if extracted_lics:
- spdx_file.licenseInfoInFiles = extracted_lics
-
- doc.files.append(spdx_file)
- doc.add_relationship(spdx_pkg, "CONTAINS", spdx_file)
- spdx_pkg.hasFiles.append(spdx_file.SPDXID)
-
- spdx_files.append(spdx_file)
-
- file_counter += 1
-
- sha1s.sort()
- verifier = hashlib.sha1()
- for v in sha1s:
- verifier.update(v.encode("utf-8"))
- spdx_pkg.packageVerificationCode.packageVerificationCodeValue = verifier.hexdigest()
-
- return spdx_files
-
-
-def add_package_sources_from_debug(d, package_doc, spdx_package, package, package_files, sources):
- from pathlib import Path
- import hashlib
- import oe.packagedata
- import oe.spdx
-
- debug_search_paths = [
- Path(d.getVar('PKGD')),
- Path(d.getVar('STAGING_DIR_TARGET')),
- Path(d.getVar('STAGING_DIR_NATIVE')),
- Path(d.getVar('STAGING_KERNEL_DIR')),
- ]
-
- pkg_data = oe.packagedata.read_subpkgdata_extended(package, d)
-
- if pkg_data is None:
- return
-
- for file_path, file_data in pkg_data["files_info"].items():
- if not "debugsrc" in file_data:
- continue
-
- for pkg_file in package_files:
- if file_path.lstrip("/") == pkg_file.fileName.lstrip("/"):
- break
- else:
- bb.fatal("No package file found for %s" % str(file_path))
- continue
-
- for debugsrc in file_data["debugsrc"]:
- ref_id = "NOASSERTION"
- for search in debug_search_paths:
- if debugsrc.startswith("/usr/src/kernel"):
- debugsrc_path = search / debugsrc.replace('/usr/src/kernel/', '')
- else:
- debugsrc_path = search / debugsrc.lstrip("/")
- if not debugsrc_path.exists():
- continue
-
- file_sha256 = bb.utils.sha256_file(debugsrc_path)
-
- if file_sha256 in sources:
- source_file = sources[file_sha256]
-
- doc_ref = package_doc.find_external_document_ref(source_file.doc.documentNamespace)
- if doc_ref is None:
- doc_ref = oe.spdx.SPDXExternalDocumentRef()
- doc_ref.externalDocumentId = "DocumentRef-dependency-" + source_file.doc.name
- doc_ref.spdxDocument = source_file.doc.documentNamespace
- doc_ref.checksum.algorithm = "SHA1"
- doc_ref.checksum.checksumValue = source_file.doc_sha1
- package_doc.externalDocumentRefs.append(doc_ref)
-
- ref_id = "%s:%s" % (doc_ref.externalDocumentId, source_file.file.SPDXID)
- else:
- bb.debug(1, "Debug source %s with SHA256 %s not found in any dependency" % (str(debugsrc_path), file_sha256))
- break
- else:
- bb.debug(1, "Debug source %s not found" % debugsrc)
-
- package_doc.add_relationship(pkg_file, "GENERATED_FROM", ref_id, comment=debugsrc)
-
-def collect_dep_recipes(d, doc, spdx_recipe):
- from pathlib import Path
- import oe.sbom
- import oe.spdx
-
- deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
-
- dep_recipes = []
- taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- deps = sorted(set(
- dep[0] for dep in taskdepdata.values() if
- dep[1] == "do_create_spdx" and dep[0] != d.getVar("PN")
- ))
- for dep_pn in deps:
- dep_recipe_path = deploy_dir_spdx / "recipes" / ("recipe-%s.spdx.json" % dep_pn)
-
- spdx_dep_doc, spdx_dep_sha1 = oe.sbom.read_doc(dep_recipe_path)
-
- for pkg in spdx_dep_doc.packages:
- if pkg.name == dep_pn:
- spdx_dep_recipe = pkg
- break
- else:
- continue
-
- dep_recipes.append(oe.sbom.DepRecipe(spdx_dep_doc, spdx_dep_sha1, spdx_dep_recipe))
-
- dep_recipe_ref = oe.spdx.SPDXExternalDocumentRef()
- dep_recipe_ref.externalDocumentId = "DocumentRef-dependency-" + spdx_dep_doc.name
- dep_recipe_ref.spdxDocument = spdx_dep_doc.documentNamespace
- dep_recipe_ref.checksum.algorithm = "SHA1"
- dep_recipe_ref.checksum.checksumValue = spdx_dep_sha1
-
- doc.externalDocumentRefs.append(dep_recipe_ref)
-
- doc.add_relationship(
- "%s:%s" % (dep_recipe_ref.externalDocumentId, spdx_dep_recipe.SPDXID),
- "BUILD_DEPENDENCY_OF",
- spdx_recipe
- )
-
- return dep_recipes
-
-collect_dep_recipes[vardepsexclude] += "BB_TASKDEPDATA"
-
-
-def collect_dep_sources(d, dep_recipes):
- import oe.sbom
-
- sources = {}
- for dep in dep_recipes:
- # Don't collect sources from native recipes as they
- # match non-native sources also.
- if recipe_spdx_is_native(d, dep.recipe):
- continue
- recipe_files = set(dep.recipe.hasFiles)
-
- for spdx_file in dep.doc.files:
- if spdx_file.SPDXID not in recipe_files:
- continue
-
- if "SOURCE" in spdx_file.fileTypes:
- for checksum in spdx_file.checksums:
- if checksum.algorithm == "SHA256":
- sources[checksum.checksumValue] = oe.sbom.DepSource(dep.doc, dep.doc_sha1, dep.recipe, spdx_file)
- break
-
- return sources
-
-
-python do_create_spdx() {
- from datetime import datetime, timezone
- import oe.sbom
- import oe.spdx
- import uuid
- from pathlib import Path
- from contextlib import contextmanager
- import oe.cve_check
-
- @contextmanager
- def optional_tarfile(name, guard, mode="w"):
- import tarfile
- import bb.compress.zstd
-
- num_threads = int(d.getVar("BB_NUMBER_THREADS"))
-
- if guard:
- name.parent.mkdir(parents=True, exist_ok=True)
- with bb.compress.zstd.open(name, mode=mode + "b", num_threads=num_threads) as f:
- with tarfile.open(fileobj=f, mode=mode + "|") as tf:
- yield tf
- else:
- yield None
-
-
- deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
- spdx_workdir = Path(d.getVar("SPDXWORK"))
- include_sources = d.getVar("SPDX_INCLUDE_SOURCES") == "1"
- archive_sources = d.getVar("SPDX_ARCHIVE_SOURCES") == "1"
- archive_packaged = d.getVar("SPDX_ARCHIVE_PACKAGED") == "1"
-
- creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
-
- doc = oe.spdx.SPDXDocument()
-
- doc.name = "recipe-" + d.getVar("PN")
- doc.documentNamespace = get_doc_namespace(d, doc)
- doc.creationInfo.created = creation_time
- doc.creationInfo.comment = "This document was created by analyzing recipe files during the build."
- doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"]
- doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass")
- doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG"))
- doc.creationInfo.creators.append("Person: N/A ()")
-
- recipe = oe.spdx.SPDXPackage()
- recipe.name = d.getVar("PN")
- recipe.versionInfo = d.getVar("PV")
- recipe.SPDXID = oe.sbom.get_recipe_spdxid(d)
- recipe.supplier = d.getVar("SPDX_SUPPLIER")
- if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d):
- recipe.annotations.append(create_annotation(d, "isNative"))
-
- for s in d.getVar('SRC_URI').split():
- if not s.startswith("file://"):
- s = s.split(';')[0]
- recipe.downloadLocation = s
- break
- else:
- recipe.downloadLocation = "NOASSERTION"
-
- homepage = d.getVar("HOMEPAGE")
- if homepage:
- recipe.homepage = homepage
-
- license = d.getVar("LICENSE")
- if license:
- recipe.licenseDeclared = convert_license_to_spdx(license, doc, d)
-
- summary = d.getVar("SUMMARY")
- if summary:
- recipe.summary = summary
-
- description = d.getVar("DESCRIPTION")
- if description:
- recipe.description = description
-
- # Some CVEs may be patched during the build process without incrementing the version number,
- # so querying for CVEs based on the CPE id can lead to false positives. To account for this,
- # save the CVEs fixed by patches to source information field in the SPDX.
- patched_cves = oe.cve_check.get_patched_cves(d)
- patched_cves = list(patched_cves)
- patched_cves = ' '.join(patched_cves)
- if patched_cves:
- recipe.sourceInfo = "CVEs fixed: " + patched_cves
-
- cpe_ids = oe.cve_check.get_cpe_ids(d.getVar("CVE_PRODUCT"), d.getVar("CVE_VERSION"))
- if cpe_ids:
- for cpe_id in cpe_ids:
- cpe = oe.spdx.SPDXExternalReference()
- cpe.referenceCategory = "SECURITY"
- cpe.referenceType = "http://spdx.org/rdf/references/cpe23Type"
- cpe.referenceLocator = cpe_id
- recipe.externalRefs.append(cpe)
-
- doc.packages.append(recipe)
- doc.add_relationship(doc, "DESCRIBES", recipe)
-
- if process_sources(d) and include_sources:
- recipe_archive = deploy_dir_spdx / "recipes" / (doc.name + ".tar.zst")
- with optional_tarfile(recipe_archive, archive_sources) as archive:
- spdx_get_src(d)
-
- add_package_files(
- d,
- doc,
- recipe,
- spdx_workdir,
- lambda file_counter: "SPDXRef-SourceFile-%s-%d" % (d.getVar("PN"), file_counter),
- lambda filepath: ["SOURCE"],
- ignore_dirs=[".git"],
- ignore_top_level_dirs=["temp"],
- archive=archive,
- )
-
- if archive is not None:
- recipe.packageFileName = str(recipe_archive.name)
-
- dep_recipes = collect_dep_recipes(d, doc, recipe)
-
- doc_sha1 = oe.sbom.write_doc(d, doc, "recipes", indent=get_json_indent(d))
- dep_recipes.append(oe.sbom.DepRecipe(doc, doc_sha1, recipe))
-
- recipe_ref = oe.spdx.SPDXExternalDocumentRef()
- recipe_ref.externalDocumentId = "DocumentRef-recipe-" + recipe.name
- recipe_ref.spdxDocument = doc.documentNamespace
- recipe_ref.checksum.algorithm = "SHA1"
- recipe_ref.checksum.checksumValue = doc_sha1
-
- sources = collect_dep_sources(d, dep_recipes)
- found_licenses = {license.name:recipe_ref.externalDocumentId + ":" + license.licenseId for license in doc.hasExtractedLicensingInfos}
-
- if not recipe_spdx_is_native(d, recipe):
- bb.build.exec_func("read_subpackage_metadata", d)
-
- pkgdest = Path(d.getVar("PKGDEST"))
- for package in d.getVar("PACKAGES").split():
- if not oe.packagedata.packaged(package, d):
- continue
-
- package_doc = oe.spdx.SPDXDocument()
- pkg_name = d.getVar("PKG:%s" % package) or package
- package_doc.name = pkg_name
- package_doc.documentNamespace = get_doc_namespace(d, package_doc)
- package_doc.creationInfo.created = creation_time
- package_doc.creationInfo.comment = "This document was created by analyzing packages created during the build."
- package_doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"]
- package_doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass")
- package_doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG"))
- package_doc.creationInfo.creators.append("Person: N/A ()")
- package_doc.externalDocumentRefs.append(recipe_ref)
-
- package_license = d.getVar("LICENSE:%s" % package) or d.getVar("LICENSE")
-
- spdx_package = oe.spdx.SPDXPackage()
-
- spdx_package.SPDXID = oe.sbom.get_package_spdxid(pkg_name)
- spdx_package.name = pkg_name
- spdx_package.versionInfo = d.getVar("PV")
- spdx_package.licenseDeclared = convert_license_to_spdx(package_license, package_doc, d, found_licenses)
- spdx_package.supplier = d.getVar("SPDX_SUPPLIER")
-
- package_doc.packages.append(spdx_package)
-
- package_doc.add_relationship(spdx_package, "GENERATED_FROM", "%s:%s" % (recipe_ref.externalDocumentId, recipe.SPDXID))
- package_doc.add_relationship(package_doc, "DESCRIBES", spdx_package)
-
- package_archive = deploy_dir_spdx / "packages" / (package_doc.name + ".tar.zst")
- with optional_tarfile(package_archive, archive_packaged) as archive:
- package_files = add_package_files(
- d,
- package_doc,
- spdx_package,
- pkgdest / package,
- lambda file_counter: oe.sbom.get_packaged_file_spdxid(pkg_name, file_counter),
- lambda filepath: ["BINARY"],
- ignore_top_level_dirs=['CONTROL', 'DEBIAN'],
- archive=archive,
- )
-
- if archive is not None:
- spdx_package.packageFileName = str(package_archive.name)
-
- add_package_sources_from_debug(d, package_doc, spdx_package, package, package_files, sources)
-
- oe.sbom.write_doc(d, package_doc, "packages", indent=get_json_indent(d))
-}
-# NOTE: depending on do_unpack is a hack that is necessary to get it's dependencies for archive the source
-addtask do_create_spdx after do_package do_packagedata do_unpack before do_populate_sdk do_build do_rm_work
-
-SSTATETASKS += "do_create_spdx"
-do_create_spdx[sstate-inputdirs] = "${SPDXDEPLOY}"
-do_create_spdx[sstate-outputdirs] = "${DEPLOY_DIR_SPDX}"
-
-python do_create_spdx_setscene () {
- sstate_setscene(d)
-}
-addtask do_create_spdx_setscene
-
-do_create_spdx[dirs] = "${SPDXWORK}"
-do_create_spdx[cleandirs] = "${SPDXDEPLOY} ${SPDXWORK}"
-do_create_spdx[depends] += "${PATCHDEPENDENCY}"
-do_create_spdx[deptask] = "do_create_spdx"
-
-def collect_package_providers(d):
- from pathlib import Path
- import oe.sbom
- import oe.spdx
- import json
-
- deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
-
- providers = {}
-
- taskdepdata = d.getVar("BB_TASKDEPDATA", False)
- deps = sorted(set(
- dep[0] for dep in taskdepdata.values() if dep[0] != d.getVar("PN")
- ))
- deps.append(d.getVar("PN"))
-
- for dep_pn in deps:
- recipe_data = oe.packagedata.read_pkgdata(dep_pn, d)
-
- for pkg in recipe_data.get("PACKAGES", "").split():
-
- pkg_data = oe.packagedata.read_subpkgdata_dict(pkg, d)
- rprovides = set(n for n, _ in bb.utils.explode_dep_versions2(pkg_data.get("RPROVIDES", "")).items())
- rprovides.add(pkg)
-
- for r in rprovides:
- providers[r] = pkg
-
- return providers
-
-collect_package_providers[vardepsexclude] += "BB_TASKDEPDATA"
-
-python do_create_runtime_spdx() {
- from datetime import datetime, timezone
- import oe.sbom
- import oe.spdx
- import oe.packagedata
- from pathlib import Path
-
- deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
- spdx_deploy = Path(d.getVar("SPDXRUNTIMEDEPLOY"))
- is_native = bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d)
-
- creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
-
- providers = collect_package_providers(d)
-
- if not is_native:
- bb.build.exec_func("read_subpackage_metadata", d)
-
- dep_package_cache = {}
-
- pkgdest = Path(d.getVar("PKGDEST"))
- for package in d.getVar("PACKAGES").split():
- localdata = bb.data.createCopy(d)
- pkg_name = d.getVar("PKG:%s" % package) or package
- localdata.setVar("PKG", pkg_name)
- localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + package)
-
- if not oe.packagedata.packaged(package, localdata):
- continue
-
- pkg_spdx_path = deploy_dir_spdx / "packages" / (pkg_name + ".spdx.json")
-
- package_doc, package_doc_sha1 = oe.sbom.read_doc(pkg_spdx_path)
-
- for p in package_doc.packages:
- if p.name == pkg_name:
- spdx_package = p
- break
- else:
- bb.fatal("Package '%s' not found in %s" % (pkg_name, pkg_spdx_path))
-
- runtime_doc = oe.spdx.SPDXDocument()
- runtime_doc.name = "runtime-" + pkg_name
- runtime_doc.documentNamespace = get_doc_namespace(localdata, runtime_doc)
- runtime_doc.creationInfo.created = creation_time
- runtime_doc.creationInfo.comment = "This document was created by analyzing package runtime dependencies."
- runtime_doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"]
- runtime_doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass")
- runtime_doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG"))
- runtime_doc.creationInfo.creators.append("Person: N/A ()")
-
- package_ref = oe.spdx.SPDXExternalDocumentRef()
- package_ref.externalDocumentId = "DocumentRef-package-" + package
- package_ref.spdxDocument = package_doc.documentNamespace
- package_ref.checksum.algorithm = "SHA1"
- package_ref.checksum.checksumValue = package_doc_sha1
-
- runtime_doc.externalDocumentRefs.append(package_ref)
-
- runtime_doc.add_relationship(
- runtime_doc.SPDXID,
- "AMENDS",
- "%s:%s" % (package_ref.externalDocumentId, package_doc.SPDXID)
- )
-
- deps = bb.utils.explode_dep_versions2(localdata.getVar("RDEPENDS") or "")
- seen_deps = set()
- for dep, _ in deps.items():
- if dep in seen_deps:
- continue
-
- if dep not in providers:
- continue
-
- dep = providers[dep]
-
- if not oe.packagedata.packaged(dep, localdata):
- continue
-
- dep_pkg_data = oe.packagedata.read_subpkgdata_dict(dep, d)
- dep_pkg = dep_pkg_data["PKG"]
-
- if dep in dep_package_cache:
- (dep_spdx_package, dep_package_ref) = dep_package_cache[dep]
- else:
- dep_path = deploy_dir_spdx / "packages" / ("%s.spdx.json" % dep_pkg)
-
- spdx_dep_doc, spdx_dep_sha1 = oe.sbom.read_doc(dep_path)
-
- for pkg in spdx_dep_doc.packages:
- if pkg.name == dep_pkg:
- dep_spdx_package = pkg
- break
- else:
- bb.fatal("Package '%s' not found in %s" % (dep_pkg, dep_path))
-
- dep_package_ref = oe.spdx.SPDXExternalDocumentRef()
- dep_package_ref.externalDocumentId = "DocumentRef-runtime-dependency-" + spdx_dep_doc.name
- dep_package_ref.spdxDocument = spdx_dep_doc.documentNamespace
- dep_package_ref.checksum.algorithm = "SHA1"
- dep_package_ref.checksum.checksumValue = spdx_dep_sha1
-
- dep_package_cache[dep] = (dep_spdx_package, dep_package_ref)
-
- runtime_doc.externalDocumentRefs.append(dep_package_ref)
-
- runtime_doc.add_relationship(
- "%s:%s" % (dep_package_ref.externalDocumentId, dep_spdx_package.SPDXID),
- "RUNTIME_DEPENDENCY_OF",
- "%s:%s" % (package_ref.externalDocumentId, spdx_package.SPDXID)
- )
- seen_deps.add(dep)
-
- oe.sbom.write_doc(d, runtime_doc, "runtime", spdx_deploy, indent=get_json_indent(d))
-}
-
-addtask do_create_runtime_spdx after do_create_spdx before do_build do_rm_work
-SSTATETASKS += "do_create_runtime_spdx"
-do_create_runtime_spdx[sstate-inputdirs] = "${SPDXRUNTIMEDEPLOY}"
-do_create_runtime_spdx[sstate-outputdirs] = "${DEPLOY_DIR_SPDX}"
-
-python do_create_runtime_spdx_setscene () {
- sstate_setscene(d)
-}
-addtask do_create_runtime_spdx_setscene
-
-do_create_runtime_spdx[dirs] = "${SPDXRUNTIMEDEPLOY}"
-do_create_runtime_spdx[cleandirs] = "${SPDXRUNTIMEDEPLOY}"
-do_create_runtime_spdx[rdeptask] = "do_create_spdx"
-
-def spdx_get_src(d):
- """
- save patched source of the recipe in SPDX_WORKDIR.
- """
- import shutil
- spdx_workdir = d.getVar('SPDXWORK')
- spdx_sysroot_native = d.getVar('STAGING_DIR_NATIVE')
- pn = d.getVar('PN')
-
- workdir = d.getVar("WORKDIR")
-
- try:
- # The kernel class functions require it to be on work-shared, so we dont change WORKDIR
- if not is_work_shared_spdx(d):
- # Change the WORKDIR to make do_unpack do_patch run in another dir.
- d.setVar('WORKDIR', spdx_workdir)
- # Restore the original path to recipe's native sysroot (it's relative to WORKDIR).
- d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native)
-
- # The changed 'WORKDIR' also caused 'B' changed, create dir 'B' for the
- # possibly requiring of the following tasks (such as some recipes's
- # do_patch required 'B' existed).
- bb.utils.mkdirhier(d.getVar('B'))
-
- bb.build.exec_func('do_unpack', d)
- # Copy source of kernel to spdx_workdir
- if is_work_shared_spdx(d):
- d.setVar('WORKDIR', spdx_workdir)
- d.setVar('STAGING_DIR_NATIVE', spdx_sysroot_native)
- src_dir = spdx_workdir + "/" + d.getVar('PN')+ "-" + d.getVar('PV') + "-" + d.getVar('PR')
- bb.utils.mkdirhier(src_dir)
- if bb.data.inherits_class('kernel',d):
- share_src = d.getVar('STAGING_KERNEL_DIR')
- cmd_copy_share = "cp -rf " + share_src + "/* " + src_dir + "/"
- cmd_copy_kernel_result = os.popen(cmd_copy_share).read()
- bb.note("cmd_copy_kernel_result = " + cmd_copy_kernel_result)
-
- git_path = src_dir + "/.git"
- if os.path.exists(git_path):
- shutils.rmtree(git_path)
-
- # Make sure gcc and kernel sources are patched only once
- if not (d.getVar('SRC_URI') == "" or is_work_shared_spdx(d)):
- bb.build.exec_func('do_patch', d)
-
- # Some userland has no source.
- if not os.path.exists( spdx_workdir ):
- bb.utils.mkdirhier(spdx_workdir)
- finally:
- d.setVar("WORKDIR", workdir)
-
-do_rootfs[recrdeptask] += "do_create_spdx do_create_runtime_spdx"
-
-ROOTFS_POSTUNINSTALL_COMMAND =+ "image_combine_spdx ; "
-
-do_populate_sdk[recrdeptask] += "do_create_spdx do_create_runtime_spdx"
-POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " sdk_host_combine_spdx; "
-POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " sdk_target_combine_spdx; "
-
-python image_combine_spdx() {
- import os
- import oe.sbom
- from pathlib import Path
- from oe.rootfs import image_list_installed_packages
-
- image_name = d.getVar("IMAGE_NAME")
- image_link_name = d.getVar("IMAGE_LINK_NAME")
- imgdeploydir = Path(d.getVar("IMGDEPLOYDIR"))
- img_spdxid = oe.sbom.get_image_spdxid(image_name)
- packages = image_list_installed_packages(d)
-
- combine_spdx(d, image_name, imgdeploydir, img_spdxid, packages)
-
- def make_image_link(target_path, suffix):
- if image_link_name:
- link = imgdeploydir / (image_link_name + suffix)
- if link != target_path:
- link.symlink_to(os.path.relpath(target_path, link.parent))
-
- image_spdx_path = imgdeploydir / (image_name + ".spdx.json")
- make_image_link(image_spdx_path, ".spdx.json")
- spdx_tar_path = imgdeploydir / (image_name + ".spdx.tar.zst")
- make_image_link(spdx_tar_path, ".spdx.tar.zst")
- spdx_index_path = imgdeploydir / (image_name + ".spdx.index.json")
- make_image_link(spdx_index_path, ".spdx.index.json")
-}
-
-python sdk_host_combine_spdx() {
- sdk_combine_spdx(d, "host")
-}
-
-python sdk_target_combine_spdx() {
- sdk_combine_spdx(d, "target")
-}
-
-def sdk_combine_spdx(d, sdk_type):
- import oe.sbom
- from pathlib import Path
- from oe.sdk import sdk_list_installed_packages
-
- sdk_name = d.getVar("SDK_NAME") + "-" + sdk_type
- sdk_deploydir = Path(d.getVar("SDKDEPLOYDIR"))
- sdk_spdxid = oe.sbom.get_sdk_spdxid(sdk_name)
- sdk_packages = sdk_list_installed_packages(d, sdk_type == "target")
- combine_spdx(d, sdk_name, sdk_deploydir, sdk_spdxid, sdk_packages)
-
-def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages):
- import os
- import oe.spdx
- import oe.sbom
- import io
- import json
- from datetime import timezone, datetime
- from pathlib import Path
- import tarfile
- import bb.compress.zstd
-
- creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
- deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
- source_date_epoch = d.getVar("SOURCE_DATE_EPOCH")
-
- doc = oe.spdx.SPDXDocument()
- doc.name = rootfs_name
- doc.documentNamespace = get_doc_namespace(d, doc)
- doc.creationInfo.created = creation_time
- doc.creationInfo.comment = "This document was created by analyzing the source of the Yocto recipe during the build."
- doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"]
- doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass")
- doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG"))
- doc.creationInfo.creators.append("Person: N/A ()")
-
- image = oe.spdx.SPDXPackage()
- image.name = d.getVar("PN")
- image.versionInfo = d.getVar("PV")
- image.SPDXID = rootfs_spdxid
- image.supplier = d.getVar("SPDX_SUPPLIER")
-
- doc.packages.append(image)
-
- for name in sorted(packages.keys()):
- pkg_spdx_path = deploy_dir_spdx / "packages" / (name + ".spdx.json")
- pkg_doc, pkg_doc_sha1 = oe.sbom.read_doc(pkg_spdx_path)
-
- for p in pkg_doc.packages:
- if p.name == name:
- pkg_ref = oe.spdx.SPDXExternalDocumentRef()
- pkg_ref.externalDocumentId = "DocumentRef-%s" % pkg_doc.name
- pkg_ref.spdxDocument = pkg_doc.documentNamespace
- pkg_ref.checksum.algorithm = "SHA1"
- pkg_ref.checksum.checksumValue = pkg_doc_sha1
-
- doc.externalDocumentRefs.append(pkg_ref)
- doc.add_relationship(image, "CONTAINS", "%s:%s" % (pkg_ref.externalDocumentId, p.SPDXID))
- break
- else:
- bb.fatal("Unable to find package with name '%s' in SPDX file %s" % (name, pkg_spdx_path))
-
- runtime_spdx_path = deploy_dir_spdx / "runtime" / ("runtime-" + name + ".spdx.json")
- runtime_doc, runtime_doc_sha1 = oe.sbom.read_doc(runtime_spdx_path)
-
- runtime_ref = oe.spdx.SPDXExternalDocumentRef()
- runtime_ref.externalDocumentId = "DocumentRef-%s" % runtime_doc.name
- runtime_ref.spdxDocument = runtime_doc.documentNamespace
- runtime_ref.checksum.algorithm = "SHA1"
- runtime_ref.checksum.checksumValue = runtime_doc_sha1
-
- # "OTHER" isn't ideal here, but I can't find a relationship that makes sense
- doc.externalDocumentRefs.append(runtime_ref)
- doc.add_relationship(
- image,
- "OTHER",
- "%s:%s" % (runtime_ref.externalDocumentId, runtime_doc.SPDXID),
- comment="Runtime dependencies for %s" % name
- )
-
- image_spdx_path = rootfs_deploydir / (rootfs_name + ".spdx.json")
-
- with image_spdx_path.open("wb") as f:
- doc.to_json(f, sort_keys=True, indent=get_json_indent(d))
-
- num_threads = int(d.getVar("BB_NUMBER_THREADS"))
-
- visited_docs = set()
-
- index = {"documents": []}
-
- spdx_tar_path = rootfs_deploydir / (rootfs_name + ".spdx.tar.zst")
- with bb.compress.zstd.open(spdx_tar_path, "w", num_threads=num_threads) as f:
- with tarfile.open(fileobj=f, mode="w|") as tar:
- def collect_spdx_document(path):
- nonlocal tar
- nonlocal deploy_dir_spdx
- nonlocal source_date_epoch
- nonlocal index
-
- if path in visited_docs:
- return
-
- visited_docs.add(path)
-
- with path.open("rb") as f:
- doc, sha1 = oe.sbom.read_doc(f)
- f.seek(0)
-
- if doc.documentNamespace in visited_docs:
- return
-
- bb.note("Adding SPDX document %s" % path)
- visited_docs.add(doc.documentNamespace)
- info = tar.gettarinfo(fileobj=f)
-
- info.name = doc.name + ".spdx.json"
- info.uid = 0
- info.gid = 0
- info.uname = "root"
- info.gname = "root"
-
- if source_date_epoch is not None and info.mtime > int(source_date_epoch):
- info.mtime = int(source_date_epoch)
-
- tar.addfile(info, f)
-
- index["documents"].append({
- "filename": info.name,
- "documentNamespace": doc.documentNamespace,
- "sha1": sha1,
- })
-
- for ref in doc.externalDocumentRefs:
- ref_path = deploy_dir_spdx / "by-namespace" / ref.spdxDocument.replace("/", "_")
- collect_spdx_document(ref_path)
-
- collect_spdx_document(image_spdx_path)
-
- index["documents"].sort(key=lambda x: x["filename"])
-
- index_str = io.BytesIO(json.dumps(
- index,
- sort_keys=True,
- indent=get_json_indent(d),
- ).encode("utf-8"))
-
- info = tarfile.TarInfo()
- info.name = "index.json"
- info.size = len(index_str.getvalue())
- info.uid = 0
- info.gid = 0
- info.uname = "root"
- info.gname = "root"
-
- tar.addfile(info, fileobj=index_str)
-
- spdx_index_path = rootfs_deploydir / (rootfs_name + ".spdx.index.json")
- with spdx_index_path.open("w") as f:
- json.dump(index, f, sort_keys=True, indent=get_json_indent(d))
+# Include this class when you don't care what version of SPDX you get; it will
+# be updated to the latest stable version that is supported
+inherit create-spdx-2.2
--
2.33.0


Re: [PATCH v3] libc-test: add libc testsuite for musl

Alexandre Belloni
 

Hello,

This fails with:
The following recipes do not have a maintainer assigned to them. Please add an entry to meta/conf/distro/include/maintainers.inc file.
libc-test (/home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/recipes-core/musl/libc-test_git.bb)

On 08/11/2022 03:42:33+0000, Chase Qi wrote:
libc-test is a collection of unit test to measure the correctness and
robustness of a C/POSIX standard library implementation. It is developed
as part of the musl project.

Signed-off-by: Chase Qi <chase.qi@...>
---
.../distro/include/ptest-packagelists.inc | 1 +
meta/recipes-core/musl/libc-test/run-ptest | 28 ++++++++++
meta/recipes-core/musl/libc-test_git.bb | 51 +++++++++++++++++++
3 files changed, 80 insertions(+)
create mode 100644 meta/recipes-core/musl/libc-test/run-ptest
create mode 100644 meta/recipes-core/musl/libc-test_git.bb

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 32b0e5297a..3c9ff43bd9 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -105,6 +105,7 @@ PTESTS_SLOW = "\

PTESTS_SLOW:remove:riscv64 = "valgrind-ptest"
PTESTS_PROBLEMS:append:riscv64 = "valgrind-ptest"
+PTESTS_SLOW:append:libc-musl = " libc-test-ptest"

# ruby-ptest \ # Timeout
# lz4-ptest \ # Needs a rewrite
diff --git a/meta/recipes-core/musl/libc-test/run-ptest b/meta/recipes-core/musl/libc-test/run-ptest
new file mode 100644
index 0000000000..0b4b687dec
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test/run-ptest
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+cd /opt/libc-test
+make cleanall
+make run || true
+
+echo ""
+echo "--- ptest result ---"
+# libc-test runs tests by module(e.g. src/api) and generates sub-module test
+# report(e.g. src/api/REPORT) first. After all tests finish, it generates the
+# consolidated report file src/REPORT.
+report="/opt/libc-test/src/REPORT"
+if ! [ -f "${report}" ]; then
+ echo "${report} not found!"
+ echo "FAIL: libc-test"
+ exit 1
+# libc-test prints error on failure and prints nothing on success.
+elif grep -q '^FAIL src.*\.exe.*' "${report}"; then
+ # Print test failure in ptest format.
+ # e.g. "FAIL src/api/main.exe [status 1]" -> "FAIL: api_main"
+ grep '^FAIL src.*\.exe.*' "${report}" \
+ | sed 's|^FAIL src/|FAIL: |;s|/|_|;s|\.exe.*\]||'
+ exit 1
+else
+ echo "PASS: libc-test"
+fi
diff --git a/meta/recipes-core/musl/libc-test_git.bb b/meta/recipes-core/musl/libc-test_git.bb
new file mode 100644
index 0000000000..b5bfc6e34c
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test_git.bb
@@ -0,0 +1,51 @@
+SUMMARY = "Musl libc unit tests"
+HOMEPAGE = "https://wiki.musl-libc.org/libc-test.html"
+DESCRIPTION = "libc-test is a collection of unit tests to measure the \
+correctness and robustness of a C/POSIX standard library implementation. It is \
+developed as part of the musl project."
+SECTION = "tests"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=43ed1245085be90dc934288117d55a3b"
+
+inherit ptest
+
+SRCREV = "18e28496adee3d84fefdda6efcb9c5b8996a2398"
+SRC_URI = " \
+ git://repo.or.cz/libc-test;branch=master \
+ file://run-ptest \
+"
+
+PV = "0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+# libc-test 'make' or 'make run' command is designed to build and run tests. It
+# reports both build and test failures. The commands should be run on target.
+do_compile() {
+ :
+}
+
+RDEPENDS:${PN} = " \
+ bash \
+ grep \
+ musl \
+ packagegroup-core-buildessential \
+"
+
+RDEPENDS:${PN}-ptest = " \
+ ${PN} \
+ sed \
+"
+
+install_path = "/opt/${PN}"
+FILES:${PN} += "${install_path}/*"
+
+do_install () {
+ install -d ${D}${install_path}/
+ cp ${S}/Makefile ${D}${install_path}
+ cp ${S}/config.mak.def ${D}${install_path}/config.mak
+ cp -r ${S}/src ${D}${install_path}
+}
+
+COMPATIBLE_HOST = "null"
+COMPATIBLE_HOST:libc-musl = "(.*)"
--
2.25.1


--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com