mirror of
https://git.yoctoproject.org/poky
synced 2026-02-15 21:23:04 +01:00
Compare commits
112 Commits
yocto-2.7.
...
warrior-21
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0f7312155 | ||
|
|
4e1e733e06 | ||
|
|
9111972adb | ||
|
|
eb54600df1 | ||
|
|
c8125e68c6 | ||
|
|
77a4470733 | ||
|
|
f29207ae99 | ||
|
|
0e55cd3815 | ||
|
|
cd8a048b62 | ||
|
|
9cb405a3eb | ||
|
|
2559517faf | ||
|
|
f3eae2a4f7 | ||
|
|
098385a227 | ||
|
|
34f1a3dda4 | ||
|
|
e869cd4ccb | ||
|
|
463a49da05 | ||
|
|
ee52ee1d64 | ||
|
|
314f062519 | ||
|
|
b5626d15c8 | ||
|
|
5f67715b7a | ||
|
|
4ada58f74c | ||
|
|
c1b94791e6 | ||
|
|
25b88e7072 | ||
|
|
aafa34cda5 | ||
|
|
2c152f790a | ||
|
|
a6d1001b2a | ||
|
|
79a850a10a | ||
|
|
1e8ef6520a | ||
|
|
7c08b5a91f | ||
|
|
07d4569049 | ||
|
|
1153a954e6 | ||
|
|
ee1ab63ef3 | ||
|
|
cf840f4e0c | ||
|
|
2797993ea5 | ||
|
|
5cfe5f0f7b | ||
|
|
88de1b03a0 | ||
|
|
fd8df1bd0f | ||
|
|
959edeb83d | ||
|
|
eacd4b0f0c | ||
|
|
d1a785686f | ||
|
|
b58c50811b | ||
|
|
40e28b6b9a | ||
|
|
411624fa50 | ||
|
|
5be20f94d6 | ||
|
|
c046ff7d09 | ||
|
|
a58e84987d | ||
|
|
bcdafed2db | ||
|
|
dabc1206b5 | ||
|
|
4802bed8ce | ||
|
|
1b9559de4b | ||
|
|
c6720451a8 | ||
|
|
86beba7ac3 | ||
|
|
5d9457135f | ||
|
|
56d33a456b | ||
|
|
feb1ac93fd | ||
|
|
b174d936e9 | ||
|
|
648d939192 | ||
|
|
c887c1b217 | ||
|
|
e973b8d7e2 | ||
|
|
556d54a9ae | ||
|
|
0f3e9bf070 | ||
|
|
b475bfa446 | ||
|
|
a217ea667d | ||
|
|
e7649d187e | ||
|
|
b3f4f862a7 | ||
|
|
6438f794f6 | ||
|
|
5c9a02ed67 | ||
|
|
cf77c4ae24 | ||
|
|
add1a327cf | ||
|
|
a110e1f586 | ||
|
|
729064626e | ||
|
|
c5463adc43 | ||
|
|
5743d1591b | ||
|
|
b472d5bf26 | ||
|
|
64b0e0380f | ||
|
|
1eb6e018a3 | ||
|
|
271c0c2dc1 | ||
|
|
0570ef5a5e | ||
|
|
1895bf4915 | ||
|
|
5a44c81061 | ||
|
|
95632e679d | ||
|
|
bd1ccd4c28 | ||
|
|
787ec750a2 | ||
|
|
70fa47b5e0 | ||
|
|
f691e4104f | ||
|
|
6bf811e9bd | ||
|
|
a5528d9010 | ||
|
|
5ad2773072 | ||
|
|
7e2b96aae0 | ||
|
|
1fc478aa88 | ||
|
|
93ba4bb6a1 | ||
|
|
df4f089cbf | ||
|
|
7401aef349 | ||
|
|
d1c75cb784 | ||
|
|
0840b9dce3 | ||
|
|
552d3d8e1f | ||
|
|
6d2e12e792 | ||
|
|
e4ceb7fcdc | ||
|
|
c4680d0c06 | ||
|
|
78ac8af785 | ||
|
|
6cd3eee5fa | ||
|
|
01b8a8b54b | ||
|
|
9773b89a2f | ||
|
|
b692ba5eaf | ||
|
|
31057d6dcc | ||
|
|
1ccb3bd2dc | ||
|
|
4626a7f6d1 | ||
|
|
069cfba445 | ||
|
|
51223035e6 | ||
|
|
fc3688b874 | ||
|
|
fb14f0a952 | ||
|
|
2bb7aabf24 |
@@ -16,6 +16,7 @@ import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import hashlib
|
||||
from functools import wraps
|
||||
import bb
|
||||
from bb import data
|
||||
@@ -269,6 +270,7 @@ class CookerDataBuilder(object):
|
||||
self.mcdata = {}
|
||||
|
||||
def parseBaseConfiguration(self):
|
||||
data_hash = hashlib.sha256()
|
||||
try:
|
||||
bb.parse.init_parser(self.basedata)
|
||||
self.data = self.parseConfigurationFiles(self.prefiles, self.postfiles)
|
||||
@@ -292,7 +294,7 @@ class CookerDataBuilder(object):
|
||||
bb.event.fire(bb.event.ConfigParsed(), self.data)
|
||||
|
||||
bb.parse.init_parser(self.data)
|
||||
self.data_hash = self.data.get_hash()
|
||||
data_hash.update(self.data.get_hash().encode('utf-8'))
|
||||
self.mcdata[''] = self.data
|
||||
|
||||
multiconfig = (self.data.getVar("BBMULTICONFIG") or "").split()
|
||||
@@ -300,9 +302,11 @@ class CookerDataBuilder(object):
|
||||
mcdata = self.parseConfigurationFiles(self.prefiles, self.postfiles, config)
|
||||
bb.event.fire(bb.event.ConfigParsed(), mcdata)
|
||||
self.mcdata[config] = mcdata
|
||||
data_hash.update(mcdata.get_hash().encode('utf-8'))
|
||||
if multiconfig:
|
||||
bb.event.fire(bb.event.MultiConfigParsed(self.mcdata), self.data)
|
||||
|
||||
self.data_hash = data_hash.hexdigest()
|
||||
except (SyntaxError, bb.BBHandledException):
|
||||
raise bb.BBHandledException
|
||||
except bb.data_smart.ExpansionError as e:
|
||||
|
||||
@@ -964,7 +964,8 @@ def rename_bad_checksum(ud, suffix):
|
||||
|
||||
new_localpath = "%s_bad-checksum_%s" % (ud.localpath, suffix)
|
||||
bb.warn("Renaming %s to %s" % (ud.localpath, new_localpath))
|
||||
bb.utils.movefile(ud.localpath, new_localpath)
|
||||
if not bb.utils.movefile(ud.localpath, new_localpath):
|
||||
bb.warn("Renaming %s to %s failed, grep movefile in log.do_fetch to see why" % (ud.localpath, new_localpath))
|
||||
|
||||
|
||||
def try_mirror_url(fetch, origud, ud, ld, check = False):
|
||||
|
||||
@@ -1117,8 +1117,8 @@ class FetchLatestVersionTest(FetcherTest):
|
||||
# packages with valid UPSTREAM_CHECK_URI and UPSTREAM_CHECK_REGEX
|
||||
("cups", "http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2", "https://github.com/apple/cups/releases", "(?P<name>cups\-)(?P<pver>((\d+[\.\-_]*)+))\-source\.tar\.gz")
|
||||
: "2.0.0",
|
||||
("db", "http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz", "http://www.oracle.com/technetwork/products/berkeleydb/downloads/index-082944.html", "http://download.oracle.com/otn/berkeley-db/(?P<name>db-)(?P<pver>((\d+[\.\-_]*)+))\.tar\.gz")
|
||||
: "6.1.19",
|
||||
("db", "http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz", "http://ftp.debian.org/debian/pool/main/d/db5.3/", "(?P<name>db5\.3_)(?P<pver>\d+(\.\d+)+).+\.orig\.tar\.xz")
|
||||
: "5.3.10",
|
||||
}
|
||||
|
||||
@skipIfNoNetwork()
|
||||
|
||||
@@ -782,7 +782,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
||||
os.rename(src, destpath)
|
||||
renamefailed = 0
|
||||
except Exception as e:
|
||||
if e[0] != errno.EXDEV:
|
||||
if e.errno != errno.EXDEV:
|
||||
# Some random error.
|
||||
print("movefile: Failed to move", src, "to", dest, e)
|
||||
return None
|
||||
|
||||
@@ -128,9 +128,19 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -2348,7 +2348,7 @@
|
||||
Most software provides some means of setting build-time
|
||||
configuration options before compilation.
|
||||
Typically, setting these options is accomplished by running a
|
||||
configure script with some options, or by modifying a build
|
||||
configure script with options, or by modifying a build
|
||||
configuration file.
|
||||
<note>
|
||||
As of Yocto Project Release 1.7, some of the core recipes
|
||||
@@ -2388,6 +2388,7 @@
|
||||
software is built using Autotools.
|
||||
If this is the case, you just need to worry about
|
||||
modifying the configuration.</para>
|
||||
|
||||
<para>When using Autotools, your recipe needs to inherit
|
||||
the
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-autotools'><filename>autotools</filename></ulink>
|
||||
@@ -2400,13 +2401,15 @@
|
||||
or
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGECONFIG_CONFARGS'><filename>PACKAGECONFIG_CONFARGS</filename></ulink>
|
||||
to pass any needed configure options that are specific
|
||||
to the recipe.</para></listitem>
|
||||
to the recipe.
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>CMake:</emphasis>
|
||||
If your source files have a
|
||||
<filename>CMakeLists.txt</filename> file, then your
|
||||
software is built using CMake.
|
||||
If this is the case, you just need to worry about
|
||||
modifying the configuration.</para>
|
||||
|
||||
<para>When you use CMake, your recipe needs to inherit
|
||||
the
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-cmake'><filename>cmake</filename></ulink>
|
||||
@@ -2416,7 +2419,16 @@
|
||||
You can make some adjustments by setting
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OECMAKE'><filename>EXTRA_OECMAKE</filename></ulink>
|
||||
to pass any needed configure options that are specific
|
||||
to the recipe.</para></listitem>
|
||||
to the recipe.
|
||||
<note>
|
||||
If you need to install one or more custom CMake
|
||||
toolchain files that are supplied by the
|
||||
application you are building, install the files to
|
||||
<filename>${D}${datadir}/cmake/</filename> Modules
|
||||
during
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink>.
|
||||
</note>
|
||||
</para></listitem>
|
||||
<listitem><para><emphasis>Other:</emphasis>
|
||||
If your source files do not have a
|
||||
<filename>configure.ac</filename> or
|
||||
@@ -2779,6 +2791,14 @@
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKEINST'><filename>PARALLEL_MAKEINST</filename></ulink>
|
||||
for additional information.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
If you need to install one or more custom CMake
|
||||
toolchain files that are supplied by the
|
||||
application you are building, install the files to
|
||||
<filename>${D}${datadir}/cmake/</filename> Modules
|
||||
during
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink>.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</note>
|
||||
</section>
|
||||
@@ -10809,6 +10829,47 @@
|
||||
features that are used by many distributions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
By default, the Yocto Project uses SysVinit as the initialization
|
||||
manager.
|
||||
However, support also exists for systemd,
|
||||
which is a full replacement for init with
|
||||
parallel starting of services, reduced shell overhead and other
|
||||
features that are used by many distributions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Within the system, SysVinit treats system components as services.
|
||||
These services are maintained as shell scripts stored in the
|
||||
<filename>/etc/init.d/</filename> directory.
|
||||
Services organize into different run levels.
|
||||
This organization is maintained by putting links to the services
|
||||
in the <filename>/etc/rcN.d/</filename> directories, where
|
||||
<replaceable>N/</replaceable> is one of the following options:
|
||||
"S", "0", "1", "2", "3", "4", "5", or "6".
|
||||
<note>
|
||||
Each runlevel has a dependency on the previous runlevel.
|
||||
This dependency allows the services to work properly.
|
||||
</note>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In comparison, systemd treats components as units.
|
||||
Using units is a broader concept as compared to using a service.
|
||||
A unit includes several different types of entities.
|
||||
Service is one of the types of entities.
|
||||
The runlevel concept in SysVinit corresponds to the concept of a
|
||||
target in systemd, where target is also a type of supported unit.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In a SysVinit-based system, services load sequentially (i.e. one
|
||||
by one) during and parallelization is not supported.
|
||||
With systemd, services start in parallel.
|
||||
Needless to say, the method can have an impact on system startup
|
||||
performance.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you want to use SysVinit, you do
|
||||
not have to do anything.
|
||||
|
||||
@@ -113,9 +113,19 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -549,9 +549,9 @@
|
||||
<literallayout class='monospaced'>
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI_append += "file://<replaceable>patch-file-one</replaceable>"
|
||||
SRC_URI_append += "file://<replaceable>patch-file-two</replaceable>"
|
||||
SRC_URI_append += "file://<replaceable>patch-file-three</replaceable>"
|
||||
SRC_URI_append = " file://<replaceable>patch-file-one</replaceable>"
|
||||
SRC_URI_append = " file://<replaceable>patch-file-two</replaceable>"
|
||||
SRC_URI_append = " file://<replaceable>patch-file-three</replaceable>"
|
||||
</literallayout>
|
||||
The
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#var-FILESEXTRAPATHS'><filename>FILESEXTRAPATHS</filename></ulink>
|
||||
|
||||
@@ -98,9 +98,19 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -84,9 +84,19 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -38,9 +38,24 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>November 2018</date>
|
||||
<revremark>Released with the Yocto Project 2.6 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<!ENTITY DISTRO "2.7">
|
||||
<!ENTITY DISTRO_COMPRESSED "27">
|
||||
<!ENTITY DISTRO "2.7.2">
|
||||
<!ENTITY DISTRO_COMPRESSED "272">
|
||||
<!ENTITY DISTRO_NAME_NO_CAP "warrior">
|
||||
<!ENTITY DISTRO_NAME "Warrior">
|
||||
<!ENTITY DISTRO_NAME_NO_CAP_MINUS_ONE "thud">
|
||||
<!ENTITY DISTRO_NAME_MINUS_ONE "Thud">
|
||||
<!ENTITY YOCTO_DOC_VERSION "2.7">
|
||||
<!ENTITY YOCTO_DOC_VERSION "2.7.2">
|
||||
<!ENTITY YOCTO_DOC_VERSION_MINUS_ONE "2.6">
|
||||
<!ENTITY DISTRO_REL_TAG "yocto-2.7">
|
||||
<!ENTITY DISTRO_REL_TAG "yocto-2.7.2">
|
||||
<!ENTITY METAINTELVERSION "11.0">
|
||||
<!ENTITY REL_MONTH_YEAR "May 2019">
|
||||
<!ENTITY REL_MONTH_YEAR "November 2019">
|
||||
<!ENTITY META_INTEL_REL_TAG "&METAINTELVERSION;-&DISTRO_NAME_NO_CAP;-&YOCTO_DOC_VERSION;">
|
||||
<!ENTITY POKYVERSION "21.0.0">
|
||||
<!ENTITY POKYVERSION_COMPRESSED "2100">
|
||||
|
||||
@@ -98,9 +98,19 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -2103,10 +2103,9 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Additionally, a
|
||||
<link linkend='ref-classes-bluetooth'><filename>bluetooth</filename></link>
|
||||
class has been added to make selection of the appropriate bluetooth
|
||||
support within a recipe a little easier.
|
||||
Additionally, a <filename>bluetooth</filename> class has been added
|
||||
to make selection of the appropriate bluetooth support within a
|
||||
recipe a little easier.
|
||||
If you wish to make use of this class in a recipe, add something
|
||||
such as the following:
|
||||
<literallayout class='monospaced'>
|
||||
|
||||
@@ -445,6 +445,14 @@
|
||||
variable to specify additional configuration options to be passed
|
||||
using the <filename>cmake</filename> command line.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
On the occasion that you would be installing custom CMake toolchain
|
||||
files supplied by the application being built, you should install them
|
||||
to the preferred CMake Module directory:
|
||||
<filename>${D}${datadir}/cmake/</filename> Modules during
|
||||
<ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id='ref-classes-cml1'>
|
||||
|
||||
@@ -629,18 +629,18 @@
|
||||
<title>Building Your Recipe</title>
|
||||
|
||||
<para>
|
||||
Use the <filename>devtool build</filename> command to cause the
|
||||
OpenEmbedded build system to build your recipe.
|
||||
Use the <filename>devtool build</filename> command to build your
|
||||
recipe.
|
||||
The <filename>devtool build</filename> command is equivalent to
|
||||
<filename>bitbake -c populate_sysroot</filename>.
|
||||
the <filename>bitbake -c populate_sysroot</filename> command.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When you use the <filename>devtool build</filename> command,
|
||||
you must supply the root name of the recipe (i.e. no version,
|
||||
paths, or extensions).
|
||||
you must supply the root name of the recipe (i.e. do not provide
|
||||
versions, paths, or extensions).
|
||||
You can use either the "-s" or the "--disable-parallel-make"
|
||||
option to disable parallel makes during the build.
|
||||
options to disable parallel makes during the build.
|
||||
Here is an example:
|
||||
<literallayout class='monospaced'>
|
||||
$ devtool build <replaceable>recipe</replaceable>
|
||||
|
||||
@@ -129,9 +129,19 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -335,7 +335,7 @@
|
||||
<glossdef>
|
||||
<para role="glossdeffirst">
|
||||
<!-- <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> -->
|
||||
The minimal command and arguments used to run the
|
||||
Minimal command and arguments needed to run the
|
||||
assembler.
|
||||
</para>
|
||||
</glossdef>
|
||||
@@ -1358,7 +1358,7 @@
|
||||
For example, the following line specifies three
|
||||
configuration files:
|
||||
<literallayout class='monospaced'>
|
||||
BBMULTIFONFIG = "configA configB configC"
|
||||
BBMULTICONFIG = "configA configB configC"
|
||||
</literallayout>
|
||||
Each configuration file you use must reside in the
|
||||
<link linkend='build-directory'>Build Directory</link>
|
||||
@@ -2182,9 +2182,10 @@
|
||||
|
||||
<para>
|
||||
The <filename>BUSYBOX_SPLIT_SUID</filename> variable
|
||||
defaults to "1", which results in a single output
|
||||
defaults to "1", which results in splitting the output
|
||||
executable file.
|
||||
Set the variable to "0" to split the output file.
|
||||
Set the variable to "0" to get a single output executable
|
||||
file.
|
||||
</para>
|
||||
</glossdef>
|
||||
</glossentry>
|
||||
|
||||
@@ -63,9 +63,19 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -73,9 +73,19 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>May 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.1</revnumber>
|
||||
<date>July 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.7.1 Release.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.7.2</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<revremark>Released with the Yocto Project 2.7.2 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
<copyright>
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
# Processes bitbake-user-manual (<word>-<word>-<word> style).
|
||||
# This style is for manual three-word folders, which currently is only the BitBake User Manual.
|
||||
# We used to have the "yocto-project-qs" and "poky-ref-manual" folders but no longer do.
|
||||
# s@"ulink" href="http://www.yoctoproject.org/docs/2.7/[a-z]*-[a-z]*-[a-z]*/[a-z]*-[a-z]*-[a-z]*.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/bitbake-user-manual/bitbake-user-manual.html#@"link" href="#@g
|
||||
# s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/[a-z]*-[a-z]*-[a-z]*/[a-z]*-[a-z]*-[a-z]*.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/bitbake-user-manual/bitbake-user-manual.html#@"link" href="#@g
|
||||
|
||||
# Processes all other manuals (<word>-<word> style).
|
||||
# This style is for manual folders that use two word, which is the standard now (e.g. "ref-manual").
|
||||
# Here is the one-liner:
|
||||
# s@"ulink" href="http://www.yoctoproject.org/docs/2.7/[a-z]*-[a-z]*/[a-z]*-[a-z]*.html#@"link" href="#@g
|
||||
# s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/[a-z]*-[a-z]*/[a-z]*-[a-z]*.html#@"link" href="#@g
|
||||
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/sdk-manual/sdk-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/bsp-guide/bsp-guide.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/dev-manual/dev-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/overview-manual/overview-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/brief-yoctoprojectqs/brief-yoctoprojectqs.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/kernel-dev/kernel-dev.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/profile-manual/profile-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/ref-manual/ref-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7/toaster-manual/toaster-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/sdk-manual/sdk-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/bsp-guide/bsp-guide.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/dev-manual/dev-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/overview-manual/overview-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/brief-yoctoprojectqs/brief-yoctoprojectqs.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/kernel-dev/kernel-dev.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/profile-manual/profile-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/ref-manual/ref-manual.html#@"link" href="#@g
|
||||
s@"ulink" href="http://www.yoctoproject.org/docs/2.7.2/toaster-manual/toaster-manual.html#@"link" href="#@g
|
||||
|
||||
# Process cases where just an external manual is referenced without an id anchor
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/brief-yoctoprojectqs/brief-yoctoprojectqs.html" target="_top">Yocto Project Quick Build</a>@Yocto Project Quick Build@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/bitbake-user-manual/bitbake-user-manual.html" target="_top">BitBake User Manual</a>@BitBake User Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/dev-manual/dev-manual.html" target="_top">Yocto Project Development Tasks Manual</a>@Yocto Project Development Tasks Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/overview-manual/overview-manual.html" target="_top">Yocto Project Overview and Concepts Manual</a>@Yocto project Overview and Concepts Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/sdk-manual/sdk-manual.html" target="_top">Yocto Project Application Development and the Extensible Software Development Kit (eSDK)</a>@Yocto Project Application Development and the Extensible Software Development Kit (eSDK)@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/bsp-guide/bsp-guide.html" target="_top">Yocto Project Board Support Package (BSP) Developer's Guide</a>@Yocto Project Board Support Package (BSP) Developer's Guide@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/profile-manual/profile-manual.html" target="_top">Yocto Project Profiling and Tracing Manual</a>@Yocto Project Profiling and Tracing Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/kernel-dev/kernel-dev.html" target="_top">Yocto Project Linux Kernel Development Manual</a>@Yocto Project Linux Kernel Development Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/ref-manual/ref-manual.html" target="_top">Yocto Project Reference Manual</a>@Yocto Project Reference Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/toaster-manual/toaster-manual.html" target="_top">Toaster User Manual</a>@Toaster User Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/brief-yoctoprojectqs/brief-yoctoprojectqs.html" target="_top">Yocto Project Quick Build</a>@Yocto Project Quick Build@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/bitbake-user-manual/bitbake-user-manual.html" target="_top">BitBake User Manual</a>@BitBake User Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/dev-manual/dev-manual.html" target="_top">Yocto Project Development Tasks Manual</a>@Yocto Project Development Tasks Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/overview-manual/overview-manual.html" target="_top">Yocto Project Overview and Concepts Manual</a>@Yocto project Overview and Concepts Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/sdk-manual/sdk-manual.html" target="_top">Yocto Project Application Development and the Extensible Software Development Kit (eSDK)</a>@Yocto Project Application Development and the Extensible Software Development Kit (eSDK)@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/bsp-guide/bsp-guide.html" target="_top">Yocto Project Board Support Package (BSP) Developer's Guide</a>@Yocto Project Board Support Package (BSP) Developer's Guide@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/profile-manual/profile-manual.html" target="_top">Yocto Project Profiling and Tracing Manual</a>@Yocto Project Profiling and Tracing Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/kernel-dev/kernel-dev.html" target="_top">Yocto Project Linux Kernel Development Manual</a>@Yocto Project Linux Kernel Development Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/ref-manual/ref-manual.html" target="_top">Yocto Project Reference Manual</a>@Yocto Project Reference Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/toaster-manual/toaster-manual.html" target="_top">Toaster User Manual</a>@Toaster User Manual@g
|
||||
|
||||
# Process a single, rouge occurrence of a linked reference to the Mega-Manual.
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7/mega-manual/mega-manual.html" target="_top">Yocto Project Mega-Manual</a>@Yocto Project Mega-Manual@g
|
||||
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.7.2/mega-manual/mega-manual.html" target="_top">Yocto Project Mega-Manual</a>@Yocto Project Mega-Manual@g
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
DISTRO_VERSION = "2.7.1"
|
||||
DISTRO_VERSION = "2.7.2"
|
||||
DISTRO_CODENAME = "warrior"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
|
||||
@@ -56,10 +56,13 @@ SANITY_TESTED_DISTROS ?= " \
|
||||
ubuntu-18.04 \n \
|
||||
fedora-28 \n \
|
||||
fedora-29 \n \
|
||||
fedora-30 \n \
|
||||
centos-7 \n \
|
||||
debian-8 \n \
|
||||
debian-9 \n \
|
||||
debian-10 \n \
|
||||
opensuse-42.3 \n \
|
||||
opensuseleap-15.1 \n \
|
||||
"
|
||||
#
|
||||
# OELAYOUT_ABI allows us to notify users when the format of TMPDIR changes in
|
||||
|
||||
@@ -8,11 +8,11 @@ KMACHINE_genericx86 ?= "common-pc"
|
||||
KMACHINE_genericx86-64 ?= "common-pc-64"
|
||||
KMACHINE_beaglebone-yocto ?= "beaglebone"
|
||||
|
||||
SRCREV_machine_genericx86 ?= "11e0e616ed095bb8012e1b4a231254c9656a0193"
|
||||
SRCREV_machine_genericx86-64 ?= "11e0e616ed095bb8012e1b4a231254c9656a0193"
|
||||
SRCREV_machine_edgerouter ?= "eebb51300a07804a020ec468b5f8c5bf720198d9"
|
||||
SRCREV_machine_beaglebone-yocto ?= "eebb51300a07804a020ec468b5f8c5bf720198d9"
|
||||
SRCREV_machine_mpc8315e-rdb ?= "8b60f968823256f5d2889c4520d70299ca21411b"
|
||||
SRCREV_machine_genericx86 ?= "5664dc14399edcaad210bbeb6343d84561fb3ea8"
|
||||
SRCREV_machine_genericx86-64 ?= "5664dc14399edcaad210bbeb6343d84561fb3ea8"
|
||||
SRCREV_machine_edgerouter ?= "5664dc14399edcaad210bbeb6343d84561fb3ea8"
|
||||
SRCREV_machine_beaglebone-yocto ?= "5664dc14399edcaad210bbeb6343d84561fb3ea8"
|
||||
SRCREV_machine_mpc8315e-rdb ?= "d419f4ca6ba4b097b8ad710a93b89510f5b2998c"
|
||||
|
||||
COMPATIBLE_MACHINE_genericx86 = "genericx86"
|
||||
COMPATIBLE_MACHINE_genericx86-64 = "genericx86-64"
|
||||
@@ -20,8 +20,8 @@ COMPATIBLE_MACHINE_edgerouter = "edgerouter"
|
||||
COMPATIBLE_MACHINE_beaglebone-yocto = "beaglebone-yocto"
|
||||
COMPATIBLE_MACHINE_mpc8315e-rdb = "mpc8315e-rdb"
|
||||
|
||||
LINUX_VERSION_genericx86 = "4.19.19"
|
||||
LINUX_VERSION_genericx86-64 = "4.19.19"
|
||||
LINUX_VERSION_edgerouter = "4.19.14"
|
||||
LINUX_VERSION_beaglebone-yocto = "4.19.14"
|
||||
LINUX_VERSION_mpc8315e-rdb = "4.19.14"
|
||||
LINUX_VERSION_genericx86 = "4.19.34"
|
||||
LINUX_VERSION_genericx86-64 = "4.19.34"
|
||||
LINUX_VERSION_edgerouter = "4.19.34"
|
||||
LINUX_VERSION_beaglebone-yocto = "4.19.34"
|
||||
LINUX_VERSION_mpc8315e-rdb = "4.19.34"
|
||||
|
||||
@@ -8,11 +8,11 @@ KMACHINE_genericx86 ?= "common-pc"
|
||||
KMACHINE_genericx86-64 ?= "common-pc-64"
|
||||
KMACHINE_beaglebone-yocto ?= "beaglebone"
|
||||
|
||||
SRCREV_machine_genericx86 ?= "3df4aae6074e94e794e27fe7f17451d9353cdf3d"
|
||||
SRCREV_machine_genericx86-64 ?= "3df4aae6074e94e794e27fe7f17451d9353cdf3d"
|
||||
SRCREV_machine_edgerouter ?= "3df4aae6074e94e794e27fe7f17451d9353cdf3d"
|
||||
SRCREV_machine_beaglebone-yocto ?= "3df4aae6074e94e794e27fe7f17451d9353cdf3d"
|
||||
SRCREV_machine_mpc8315e-rdb ?= "8b62af7f252af10588276802c4c6d7c502e875be"
|
||||
SRCREV_machine_genericx86 ?= "f990fd0ce123aa6035042efad09b2ddc3e7d48f4"
|
||||
SRCREV_machine_genericx86-64 ?= "f990fd0ce123aa6035042efad09b2ddc3e7d48f4"
|
||||
SRCREV_machine_edgerouter ?= "f990fd0ce123aa6035042efad09b2ddc3e7d48f4"
|
||||
SRCREV_machine_beaglebone-yocto ?= "f990fd0ce123aa6035042efad09b2ddc3e7d48f4"
|
||||
SRCREV_machine_mpc8315e-rdb ?= "670ce7e9db627d0c2067cfdb571ddc1f117818d8"
|
||||
|
||||
COMPATIBLE_MACHINE_genericx86 = "genericx86"
|
||||
COMPATIBLE_MACHINE_genericx86-64 = "genericx86-64"
|
||||
@@ -20,8 +20,8 @@ COMPATIBLE_MACHINE_edgerouter = "edgerouter"
|
||||
COMPATIBLE_MACHINE_beaglebone-yocto = "beaglebone-yocto"
|
||||
COMPATIBLE_MACHINE_mpc8315e-rdb = "mpc8315e-rdb"
|
||||
|
||||
LINUX_VERSION_genericx86 = "5.0.3"
|
||||
LINUX_VERSION_genericx86-64 = "5.0.3"
|
||||
LINUX_VERSION_edgerouter = "5.0.3"
|
||||
LINUX_VERSION_beaglebone-yocto = "5.0.3"
|
||||
LINUX_VERSION_mpc8315e-rdb = "5.0.3"
|
||||
LINUX_VERSION_genericx86 = "5.0.13"
|
||||
LINUX_VERSION_genericx86-64 = "5.0.13"
|
||||
LINUX_VERSION_edgerouter = "5.0.13"
|
||||
LINUX_VERSION_beaglebone-yocto = "5.0.13"
|
||||
LINUX_VERSION_mpc8315e-rdb = "5.0.13"
|
||||
|
||||
@@ -26,7 +26,7 @@ CVE_PRODUCT ??= "${BPN}"
|
||||
CVE_VERSION ??= "${PV}"
|
||||
|
||||
CVE_CHECK_DB_DIR ?= "${DL_DIR}/CVE_CHECK"
|
||||
CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/nvd.db"
|
||||
CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/nvdcve_1.0.db"
|
||||
|
||||
CVE_CHECK_LOG ?= "${T}/cve.log"
|
||||
CVE_CHECK_TMP_FILE ?= "${TMPDIR}/cve_check"
|
||||
@@ -37,32 +37,33 @@ CVE_CHECK_COPY_FILES ??= "1"
|
||||
CVE_CHECK_CREATE_MANIFEST ??= "1"
|
||||
|
||||
# Whitelist for packages (PN)
|
||||
CVE_CHECK_PN_WHITELIST = "\
|
||||
glibc-locale \
|
||||
"
|
||||
CVE_CHECK_PN_WHITELIST ?= ""
|
||||
|
||||
# Whitelist for CVE and version of package
|
||||
CVE_CHECK_CVE_WHITELIST = "{\
|
||||
'CVE-2014-2524': ('6.3','5.2',), \
|
||||
}"
|
||||
# Whitelist for CVE. If a CVE is found, then it is considered patched.
|
||||
# The value is a string containing space separated CVE values:
|
||||
#
|
||||
# CVE_CHECK_WHITELIST = 'CVE-2014-2524 CVE-2018-1234'
|
||||
#
|
||||
CVE_CHECK_WHITELIST ?= ""
|
||||
|
||||
python do_cve_check () {
|
||||
"""
|
||||
Check recipe for patched and unpatched CVEs
|
||||
"""
|
||||
|
||||
if os.path.exists(d.getVar("CVE_CHECK_TMP_FILE")):
|
||||
if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
|
||||
patched_cves = get_patches_cves(d)
|
||||
patched, unpatched = check_cves(d, patched_cves)
|
||||
if patched or unpatched:
|
||||
cve_data = get_cve_info(d, patched + unpatched)
|
||||
cve_write_data(d, patched, unpatched, cve_data)
|
||||
else:
|
||||
bb.note("Failed to update CVE database, skipping CVE check")
|
||||
bb.note("No CVE database found, skipping CVE check")
|
||||
|
||||
}
|
||||
|
||||
addtask cve_check after do_unpack before do_build
|
||||
do_cve_check[depends] = "cve-check-tool-native:do_populate_sysroot cve-check-tool-native:do_populate_cve_db"
|
||||
do_cve_check[depends] = "cve-update-db-native:do_populate_cve_db"
|
||||
do_cve_check[nostamp] = "1"
|
||||
|
||||
python cve_check_cleanup () {
|
||||
@@ -163,65 +164,94 @@ def get_patches_cves(d):
|
||||
|
||||
def check_cves(d, patched_cves):
|
||||
"""
|
||||
Run cve-check-tool looking for patched and unpatched CVEs.
|
||||
Connect to the NVD database and find unpatched cves.
|
||||
"""
|
||||
|
||||
import ast, csv, tempfile, subprocess, io
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
cves_patched = []
|
||||
cves_unpatched = []
|
||||
bpn = d.getVar("CVE_PRODUCT")
|
||||
# CVE_PRODUCT can contain more than one product (eg. curl/libcurl)
|
||||
products = d.getVar("CVE_PRODUCT").split()
|
||||
# If this has been unset then we're not scanning for CVEs here (for example, image recipes)
|
||||
if not bpn:
|
||||
if not products:
|
||||
return ([], [])
|
||||
pv = d.getVar("CVE_VERSION").split("+git")[0]
|
||||
cves = " ".join(patched_cves)
|
||||
cve_db_dir = d.getVar("CVE_CHECK_DB_DIR")
|
||||
cve_whitelist = ast.literal_eval(d.getVar("CVE_CHECK_CVE_WHITELIST"))
|
||||
cve_cmd = "cve-check-tool"
|
||||
cmd = [cve_cmd, "--no-html", "--skip-update", "--csv", "--not-affected", "-t", "faux", "-d", cve_db_dir]
|
||||
|
||||
# If the recipe has been whitlisted we return empty lists
|
||||
if d.getVar("PN") in d.getVar("CVE_CHECK_PN_WHITELIST").split():
|
||||
bb.note("Recipe has been whitelisted, skipping check")
|
||||
return ([], [])
|
||||
|
||||
try:
|
||||
# Write the faux CSV file to be used with cve-check-tool
|
||||
fd, faux = tempfile.mkstemp(prefix="cve-faux-")
|
||||
with os.fdopen(fd, "w") as f:
|
||||
for pn in bpn.split():
|
||||
f.write("%s,%s,%s,\n" % (pn, pv, cves))
|
||||
cmd.append(faux)
|
||||
old_cve_whitelist = d.getVar("CVE_CHECK_CVE_WHITELIST")
|
||||
if old_cve_whitelist:
|
||||
bb.warn("CVE_CHECK_CVE_WHITELIST is deprecated, please use CVE_CHECK_WHITELIST.")
|
||||
cve_whitelist = d.getVar("CVE_CHECK_WHITELIST").split()
|
||||
|
||||
output = subprocess.check_output(cmd).decode("utf-8")
|
||||
bb.debug(2, "Output of command %s:\n%s" % ("\n".join(cmd), output))
|
||||
except subprocess.CalledProcessError as e:
|
||||
bb.warn("Couldn't check for CVEs: %s (output %s)" % (e, e.output))
|
||||
finally:
|
||||
os.remove(faux)
|
||||
import sqlite3
|
||||
db_file = d.getVar("CVE_CHECK_DB_FILE")
|
||||
conn = sqlite3.connect(db_file)
|
||||
|
||||
for row in csv.reader(io.StringIO(output)):
|
||||
# Third row has the unpatched CVEs
|
||||
if row[2]:
|
||||
for cve in row[2].split():
|
||||
# Skip if the CVE has been whitlisted for the current version
|
||||
if pv in cve_whitelist.get(cve,[]):
|
||||
bb.note("%s-%s has been whitelisted for %s" % (bpn, pv, cve))
|
||||
else:
|
||||
for product in products:
|
||||
c = conn.cursor()
|
||||
if ":" in product:
|
||||
vendor, product = product.split(":", 1)
|
||||
c.execute("SELECT * FROM PRODUCTS WHERE PRODUCT IS ? AND VENDOR IS ?", (product, vendor))
|
||||
else:
|
||||
c.execute("SELECT * FROM PRODUCTS WHERE PRODUCT IS ?", (product,))
|
||||
|
||||
for row in c:
|
||||
cve = row[0]
|
||||
version_start = row[3]
|
||||
operator_start = row[4]
|
||||
version_end = row[5]
|
||||
operator_end = row[6]
|
||||
|
||||
if cve in cve_whitelist:
|
||||
bb.note("%s-%s has been whitelisted for %s" % (product, pv, cve))
|
||||
elif cve in patched_cves:
|
||||
bb.note("%s has been patched" % (cve))
|
||||
else:
|
||||
to_append = False
|
||||
if (operator_start == '=' and pv == version_start):
|
||||
cves_unpatched.append(cve)
|
||||
bb.debug(2, "%s-%s is not patched for %s" % (bpn, pv, cve))
|
||||
# Fourth row has patched CVEs
|
||||
if row[3]:
|
||||
for cve in row[3].split():
|
||||
cves_patched.append(cve)
|
||||
bb.debug(2, "%s-%s is patched for %s" % (bpn, pv, cve))
|
||||
else:
|
||||
if operator_start:
|
||||
try:
|
||||
to_append_start = (operator_start == '>=' and LooseVersion(pv) >= LooseVersion(version_start))
|
||||
to_append_start |= (operator_start == '>' and LooseVersion(pv) > LooseVersion(version_start))
|
||||
except:
|
||||
bb.note("%s: Failed to compare %s %s %s for %s" %
|
||||
(product, pv, operator_start, version_start, cve))
|
||||
to_append_start = False
|
||||
else:
|
||||
to_append_start = False
|
||||
|
||||
return (cves_patched, cves_unpatched)
|
||||
if operator_end:
|
||||
try:
|
||||
to_append_end = (operator_end == '<=' and LooseVersion(pv) <= LooseVersion(version_end))
|
||||
to_append_end |= (operator_end == '<' and LooseVersion(pv) < LooseVersion(version_end))
|
||||
except:
|
||||
bb.note("%s: Failed to compare %s %s %s for %s" %
|
||||
(product, pv, operator_end, version_end, cve))
|
||||
to_append_end = False
|
||||
else:
|
||||
to_append_end = False
|
||||
|
||||
if operator_start and operator_end:
|
||||
to_append = to_append_start and to_append_end
|
||||
else:
|
||||
to_append = to_append_start or to_append_end
|
||||
|
||||
if to_append:
|
||||
cves_unpatched.append(cve)
|
||||
bb.debug(2, "%s-%s is not patched for %s" % (product, pv, cve))
|
||||
conn.close()
|
||||
|
||||
return (list(patched_cves), cves_unpatched)
|
||||
|
||||
def get_cve_info(d, cves):
|
||||
"""
|
||||
Get CVE information from the database used by cve-check-tool.
|
||||
Get CVE information from the database.
|
||||
|
||||
Unfortunately the only way to get CVE info is set the output to
|
||||
html (hard to parse) or query directly the database.
|
||||
@@ -241,9 +271,10 @@ def get_cve_info(d, cves):
|
||||
for row in cur.execute(query, tuple(cves)):
|
||||
cve_data[row[0]] = {}
|
||||
cve_data[row[0]]["summary"] = row[1]
|
||||
cve_data[row[0]]["score"] = row[2]
|
||||
cve_data[row[0]]["modified"] = row[3]
|
||||
cve_data[row[0]]["vector"] = row[4]
|
||||
cve_data[row[0]]["scorev2"] = row[2]
|
||||
cve_data[row[0]]["scorev3"] = row[3]
|
||||
cve_data[row[0]]["modified"] = row[4]
|
||||
cve_data[row[0]]["vector"] = row[5]
|
||||
conn.close()
|
||||
|
||||
return cve_data
|
||||
@@ -270,7 +301,8 @@ def cve_write_data(d, patched, unpatched, cve_data):
|
||||
unpatched_cves.append(cve)
|
||||
write_string += "CVE STATUS: Unpatched\n"
|
||||
write_string += "CVE SUMMARY: %s\n" % cve_data[cve]["summary"]
|
||||
write_string += "CVSS v2 BASE SCORE: %s\n" % cve_data[cve]["score"]
|
||||
write_string += "CVSS v2 BASE SCORE: %s\n" % cve_data[cve]["scorev2"]
|
||||
write_string += "CVSS v3 BASE SCORE: %s\n" % cve_data[cve]["scorev3"]
|
||||
write_string += "VECTOR: %s\n" % cve_data[cve]["vector"]
|
||||
write_string += "MORE INFORMATION: %s%s\n\n" % (nvd_link, cve)
|
||||
|
||||
|
||||
@@ -243,7 +243,11 @@ def icecc_get_external_tool(bb, d, tool):
|
||||
|
||||
def icecc_get_tool_link(tool, d):
|
||||
import subprocess
|
||||
return subprocess.check_output("readlink -f %s" % tool, shell=True).decode("utf-8")[:-1]
|
||||
try:
|
||||
return subprocess.check_output("readlink -f %s" % tool, shell=True).decode("utf-8")[:-1]
|
||||
except subprocess.CalledProcessError as e:
|
||||
bb.note("icecc: one of the tools probably disappeared during recipe parsing, cmd readlink -f %s returned %d:\n%s" % (tool, e.returncode, e.output.decode("utf-8")))
|
||||
return tool
|
||||
|
||||
def icecc_get_path_tool(tool, d):
|
||||
# This is a little ugly, but we want to make sure we add an actual
|
||||
|
||||
@@ -37,7 +37,7 @@ do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
|
||||
LABELS_LIVE ?= "boot install"
|
||||
ROOT_LIVE ?= "root=/dev/ram0"
|
||||
INITRD_IMAGE_LIVE ?= "${MLPREFIX}core-image-minimal-initramfs"
|
||||
INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.cpio.gz"
|
||||
INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.${INITRAMFS_FSTYPES}"
|
||||
|
||||
LIVE_ROOTFS_TYPE ?= "ext4"
|
||||
ROOTFS ?= "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${LIVE_ROOTFS_TYPE}"
|
||||
|
||||
@@ -3,10 +3,6 @@ uboot_prep_kimage() {
|
||||
vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
|
||||
linux_suffix=""
|
||||
linux_comp="none"
|
||||
elif [ -e arch/${ARCH}/boot/Image ] ; then
|
||||
vmlinux_path="vmlinux"
|
||||
linux_suffix=""
|
||||
linux_comp="none"
|
||||
elif [ -e arch/${ARCH}/boot/vmlinuz.bin ]; then
|
||||
rm -f linux.bin
|
||||
cp -l arch/${ARCH}/boot/vmlinuz.bin linux.bin
|
||||
|
||||
@@ -453,7 +453,7 @@ do_shared_workdir () {
|
||||
cp .config $kerneldir/
|
||||
mkdir -p $kerneldir/include/config
|
||||
cp include/config/kernel.release $kerneldir/include/config/kernel.release
|
||||
if [ -e certs/signing_key.pem ]; then
|
||||
if [ -e certs/signing_key.x509 ]; then
|
||||
# The signing_key.* files are stored in the certs/ dir in
|
||||
# newer Linux kernels
|
||||
mkdir -p $kerneldir/certs
|
||||
|
||||
@@ -123,8 +123,55 @@ python __anonymous () {
|
||||
clsextend.map_variable("USERADD_PACKAGES")
|
||||
clsextend.map_variable("SYSTEMD_PACKAGES")
|
||||
clsextend.map_variable("UPDATERCPN")
|
||||
|
||||
reset_alternative_priority(d)
|
||||
}
|
||||
|
||||
def reset_alternative_priority(d):
|
||||
if not bb.data.inherits_class('update-alternatives', d):
|
||||
return
|
||||
|
||||
# There might be multiple multilibs at the same time, e.g., lib32 and
|
||||
# lib64, each of them should have a different priority.
|
||||
multilib_variants = d.getVar('MULTILIB_VARIANTS')
|
||||
bbextendvariant = d.getVar('BBEXTENDVARIANT')
|
||||
reset_gap = multilib_variants.split().index(bbextendvariant) + 1
|
||||
|
||||
# ALTERNATIVE_PRIORITY = priority
|
||||
alt_priority_recipe = d.getVar('ALTERNATIVE_PRIORITY')
|
||||
# Reset ALTERNATIVE_PRIORITY when found
|
||||
if alt_priority_recipe:
|
||||
reset_priority = int(alt_priority_recipe) - reset_gap
|
||||
bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY to %s' % (d.getVar('PN'), reset_priority))
|
||||
d.setVar('ALTERNATIVE_PRIORITY', reset_priority)
|
||||
|
||||
handled_pkgs = []
|
||||
for pkg in (d.getVar('PACKAGES') or "").split():
|
||||
# ALTERNATIVE_PRIORITY_pkg = priority
|
||||
alt_priority_pkg = d.getVar('ALTERNATIVE_PRIORITY_%s' % pkg)
|
||||
# Reset ALTERNATIVE_PRIORITY_pkg when found
|
||||
if alt_priority_pkg:
|
||||
reset_priority = int(alt_priority_pkg) - reset_gap
|
||||
if not pkg in handled_pkgs:
|
||||
handled_pkgs.append(pkg)
|
||||
bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY_%s to %s' % (pkg, pkg, reset_priority))
|
||||
d.setVar('ALTERNATIVE_PRIORITY_%s' % pkg, reset_priority)
|
||||
|
||||
for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split():
|
||||
# ALTERNATIVE_PRIORITY_pkg[tool] = priority
|
||||
alt_priority_pkg_name = d.getVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name)
|
||||
# ALTERNATIVE_PRIORITY[tool] = priority
|
||||
alt_priority_name = d.getVarFlag('ALTERNATIVE_PRIORITY', alt_name)
|
||||
|
||||
if alt_priority_pkg_name:
|
||||
reset_priority = int(alt_priority_pkg_name) - reset_gap
|
||||
bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY_%s[%s] to %s' % (pkg, pkg, alt_name, reset_priority))
|
||||
d.setVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name, reset_priority)
|
||||
elif alt_priority_name:
|
||||
reset_priority = int(alt_priority_name) - reset_gap
|
||||
bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY[%s] to %s' % (pkg, alt_name, reset_priority))
|
||||
d.setVarFlag('ALTERNATIVE_PRIORITY', alt_name, reset_priority)
|
||||
|
||||
PACKAGEFUNCS_append = " do_package_qa_multilib"
|
||||
|
||||
python do_package_qa_multilib() {
|
||||
|
||||
@@ -1210,7 +1210,8 @@ python populate_packages () {
|
||||
src = os.path.join(src, p)
|
||||
dest = os.path.join(dest, p)
|
||||
fstat = cpath.stat(src)
|
||||
os.mkdir(dest, fstat.st_mode)
|
||||
os.mkdir(dest)
|
||||
os.chmod(dest, fstat.st_mode)
|
||||
os.chown(dest, fstat.st_uid, fstat.st_gid)
|
||||
if p not in seen:
|
||||
seen.append(p)
|
||||
@@ -1918,7 +1919,7 @@ python package_do_pkgconfig () {
|
||||
for dir in reversed(shlibs_dirs):
|
||||
if not os.path.exists(dir):
|
||||
continue
|
||||
for file in os.listdir(dir):
|
||||
for file in sorted(os.listdir(dir)):
|
||||
m = re.match(r'^(.*)\.pclist$', file)
|
||||
if m:
|
||||
pkg = m.group(1)
|
||||
|
||||
@@ -167,7 +167,7 @@ def staging_processfixme(fixme, target, recipesysroot, recipesysrootnative, d):
|
||||
if not fixme:
|
||||
return
|
||||
cmd = "sed -e 's:^[^/]*/:%s/:g' %s | xargs sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIRHOST:%s:g'" % (target, " ".join(fixme), recipesysroot, recipesysrootnative)
|
||||
for fixmevar in ['COMPONENTS_DIR', 'HOSTTOOLS_DIR', 'PKGDATA_DIR', 'PSEUDO_LOCALSTATEDIR', 'LOGFIFO']:
|
||||
for fixmevar in ['PSEUDO_SYSROOT', 'HOSTTOOLS_DIR', 'PKGDATA_DIR', 'PSEUDO_LOCALSTATEDIR', 'LOGFIFO']:
|
||||
fixme_path = d.getVar(fixmevar)
|
||||
cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
|
||||
bb.debug(2, cmd)
|
||||
|
||||
@@ -104,13 +104,16 @@ python do_create_extlinux_config() {
|
||||
if default:
|
||||
cfgfile.write('DEFAULT %s\n' % (default))
|
||||
|
||||
# Need to deconflict the labels with existing overrides
|
||||
label_overrides = labels.split()
|
||||
default_overrides = localdata.getVar('OVERRIDES').split(':')
|
||||
# We're keeping all the existing overrides that aren't used as a label
|
||||
# an override for that label will be added back in while we're processing that label
|
||||
keep_overrides = list(filter(lambda x: x not in label_overrides, default_overrides))
|
||||
|
||||
for label in labels.split():
|
||||
|
||||
overrides = localdata.getVar('OVERRIDES')
|
||||
if not overrides:
|
||||
bb.fatal('OVERRIDES not defined')
|
||||
|
||||
localdata.setVar('OVERRIDES', label + ':' + overrides)
|
||||
localdata.setVar('OVERRIDES', ':'.join(keep_overrides + [label]))
|
||||
|
||||
extlinux_console = localdata.getVar('UBOOT_EXTLINUX_CONSOLE')
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ concat_dtb_helper() {
|
||||
install ${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
|
||||
elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then
|
||||
cd ${DEPLOYDIR}
|
||||
cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${UBOOT_BINARY} > ${UBOOT_IMAGE}
|
||||
cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${UBOOT_BINARY} > ${UBOOT_IMAGE}
|
||||
else
|
||||
bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
|
||||
fi
|
||||
@@ -77,10 +77,12 @@ concat_dtb() {
|
||||
mkdir -p ${DEPLOYDIR}
|
||||
if [ -n "${UBOOT_CONFIG}" ]; then
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
CONFIG_B_PATH="${config}"
|
||||
cd ${B}/${config}
|
||||
concat_dtb_helper
|
||||
done
|
||||
else
|
||||
CONFIG_B_PATH=""
|
||||
cd ${B}
|
||||
concat_dtb_helper
|
||||
fi
|
||||
|
||||
@@ -100,6 +100,8 @@ useradd_sysroot () {
|
||||
# Pseudo may (do_prepare_recipe_sysroot) or may not (do_populate_sysroot_setscene) be running
|
||||
# at this point so we're explicit about the environment so pseudo can load if
|
||||
# not already present.
|
||||
# PSEUDO_SYSROOT can contain references to the build architecture and COMPONENT_DIR
|
||||
# so needs the STAGING_FIXME below
|
||||
export PSEUDO="${FAKEROOTENV} ${PSEUDO_SYSROOT}${bindir_native}/pseudo"
|
||||
|
||||
# Explicitly set $D since it isn't set to anything
|
||||
@@ -134,10 +136,10 @@ useradd_sysroot () {
|
||||
}
|
||||
|
||||
# The export of PSEUDO in useradd_sysroot() above contains references to
|
||||
# ${COMPONENTS_DIR} and ${PSEUDO_LOCALSTATEDIR}. Additionally, the logging
|
||||
# ${PSEUDO_SYSROOT} and ${PSEUDO_LOCALSTATEDIR}. Additionally, the logging
|
||||
# shell functions use ${LOGFIFO}. These need to be handled when restoring
|
||||
# postinst-useradd-${PN} from the sstate cache.
|
||||
EXTRA_STAGING_FIXMES += "COMPONENTS_DIR PSEUDO_LOCALSTATEDIR LOGFIFO"
|
||||
EXTRA_STAGING_FIXMES += "PSEUDO_SYSROOT PSEUDO_LOCALSTATEDIR LOGFIFO"
|
||||
|
||||
python useradd_sysroot_sstate () {
|
||||
scriptfile = None
|
||||
@@ -182,6 +184,7 @@ def update_useradd_after_parse(d):
|
||||
bb.fatal("%s inherits useradd but doesn't set USERADD_PACKAGES" % d.getVar('FILE', False))
|
||||
|
||||
for pkg in useradd_packages.split():
|
||||
d.appendVarFlag("do_populate_sysroot", "vardeps", "USERADD_PARAM_%s GROUPADD_PARAM_%s GROUPMEMS_PARAM_%s" % (pkg, pkg, pkg))
|
||||
if not d.getVar('USERADD_PARAM_%s' % pkg) and not d.getVar('GROUPADD_PARAM_%s' % pkg) and not d.getVar('GROUPMEMS_PARAM_%s' % pkg):
|
||||
bb.fatal("%s inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or GROUPMEMS_PARAM for package %s" % (d.getVar('FILE', False), pkg))
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ RECIPE_MAINTAINER_pn-cryptodev-tests = "Robert Yang <liezhi.yang@windriver.com>"
|
||||
RECIPE_MAINTAINER_pn-cups = "Chen Qi <Qi.Chen@windriver.com>"
|
||||
RECIPE_MAINTAINER_pn-curl = "Armin Kuster <akuster808@gmail.com>"
|
||||
RECIPE_MAINTAINER_pn-cve-check-tool = "Ross Burton <ross.burton@intel.com>"
|
||||
RECIPE_MAINTAINER_pn-cve-update-db-native = "Ross Burton <ross.burton@intel.com>"
|
||||
RECIPE_MAINTAINER_pn-cwautomacros = "Ross Burton <ross.burton@intel.com>"
|
||||
RECIPE_MAINTAINER_pn-db = "Mark Hatle <mark.hatle@windriver.com>"
|
||||
RECIPE_MAINTAINER_pn-dbus = "Chen Qi <Qi.Chen@windriver.com>"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# to the distro running on the build machine.
|
||||
#
|
||||
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.29"
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.30"
|
||||
|
||||
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/2.6/"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "a37118fc8b423f48146120707b81dd15017512c3e8ef9e6ca2cb3a033f4f4046"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "3234fc3ded810225071f23a0e9a99f4f8c2480059945a848eff076ce78122ade"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "133387753a9acf3e1b788103c59fac91e968e2ee331d7a4b9498e926ada7be57"
|
||||
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/2.7/"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "e76a45886ee8a0b3904b761c17ac8ff91edf9811ee455f1832d10763ba794dfc"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "810d027dfb1c7675226afbcec07808770516c969ee7378f6d8240281083f8924"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "9498d8bba047499999a7310ac2576d0796461184965351a56f6d32c888a1f216"
|
||||
|
||||
@@ -14,6 +14,7 @@ QB_SYSTEM_NAME = "qemu-system-aarch64"
|
||||
QB_MEM = "-m 512"
|
||||
QB_MACHINE = "-machine virt"
|
||||
QB_CPU = "-cpu cortex-a57"
|
||||
QB_CPU_KVM = "-cpu host"
|
||||
# Standard Serial console
|
||||
QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0"
|
||||
# For graphics to work we need to define the VGA device as well as the necessary USB devices
|
||||
|
||||
@@ -265,7 +265,7 @@ def read_shlib_providers(d):
|
||||
bb.debug(2, "Reading shlib providers in %s" % (dir))
|
||||
if not os.path.exists(dir):
|
||||
continue
|
||||
for file in os.listdir(dir):
|
||||
for file in sorted(os.listdir(dir)):
|
||||
m = list_re.match(file)
|
||||
if m:
|
||||
dep_pkg = m.group(1)
|
||||
|
||||
@@ -148,7 +148,7 @@ do_install_append_class-native () {
|
||||
OPENSSL_CONF=${libdir}/ssl-1.1/openssl.cnf \
|
||||
SSL_CERT_DIR=${libdir}/ssl-1.1/certs \
|
||||
SSL_CERT_FILE=${libdir}/ssl-1.1/cert.pem \
|
||||
OPENSSL_ENGINES=${libdir}/ssl-1.1/engines
|
||||
OPENSSL_ENGINES=${libdir}/engines-1.1
|
||||
}
|
||||
|
||||
do_install_append_class-nativesdk () {
|
||||
|
||||
26
meta/recipes-core/expat/expat/CVE-2018-20843.patch
Normal file
26
meta/recipes-core/expat/expat/CVE-2018-20843.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From 11f8838bf99ea0a6f0b76f9760c43704d00c4ff6 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Pipping <sebastian@pipping.org>
|
||||
Date: Wed, 12 Jun 2019 15:42:22 +0200
|
||||
Subject: [PATCH] xmlparse.c: Fix extraction of namespace prefix from XML name
|
||||
(#186)
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2018-20843
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
expat/lib/xmlparse.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c
|
||||
index 30d55c5c..737d7cd2 100644
|
||||
--- a/expat/lib/xmlparse.c
|
||||
+++ b/expat/lib/xmlparse.c
|
||||
@@ -6071,7 +6071,7 @@ setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
|
||||
else
|
||||
poolDiscard(&dtd->pool);
|
||||
elementType->prefix = prefix;
|
||||
-
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5b8620d98e49772d95fc1d291c26aa79"
|
||||
SRC_URI = "${SOURCEFORGE_MIRROR}/expat/expat-${PV}.tar.bz2 \
|
||||
file://autotools.patch \
|
||||
file://libtool-tag.patch \
|
||||
file://CVE-2018-20843.patch;striplevel=2 \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "ca047ae951b40020ac831c28859161b2"
|
||||
|
||||
40
meta/recipes-core/glib-2.0/glib-2.0/CVE-2019-13012.patch
Normal file
40
meta/recipes-core/glib-2.0/glib-2.0/CVE-2019-13012.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From 9fd6b4b21891adc318784f6a141f40d767b0d73c Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Clasen <mclasen@redhat.com>
|
||||
Date: Tue, 22 Jan 2019 13:26:31 -0500
|
||||
Subject: [PATCH] keyfile settings: Use tighter permissions
|
||||
|
||||
When creating directories, create them with 700 permissions,
|
||||
instead of 777.
|
||||
|
||||
Closes: #1658
|
||||
CVE: CVE-2019-13012
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/commit/5e4da714f00f6bfb2ccd6d73d61329c6f3a08429]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
|
||||
---
|
||||
gio/gkeyfilesettingsbackend.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
|
||||
index a37978e..580a0b0 100644
|
||||
--- a/gio/gkeyfilesettingsbackend.c
|
||||
+++ b/gio/gkeyfilesettingsbackend.c
|
||||
@@ -89,7 +89,8 @@ g_keyfile_settings_backend_keyfile_write (GKeyfileSettingsBackend *kfsb)
|
||||
|
||||
contents = g_key_file_to_data (kfsb->keyfile, &length, NULL);
|
||||
g_file_replace_contents (kfsb->file, contents, length, NULL, FALSE,
|
||||
- G_FILE_CREATE_REPLACE_DESTINATION,
|
||||
+ G_FILE_CREATE_REPLACE_DESTINATION |
|
||||
+ G_FILE_CREATE_PRIVATE,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
compute_checksum (kfsb->digest, contents, length);
|
||||
@@ -640,7 +641,7 @@ g_keyfile_settings_backend_new (const gchar *filename,
|
||||
|
||||
kfsb->file = g_file_new_for_path (filename);
|
||||
kfsb->dir = g_file_get_parent (kfsb->file);
|
||||
- g_file_make_directory_with_parents (kfsb->dir, NULL, NULL);
|
||||
+ g_mkdir_with_parents (g_file_peek_path (kfsb->dir), 0700);
|
||||
|
||||
kfsb->file_monitor = g_file_monitor (kfsb->file, 0, NULL, NULL);
|
||||
kfsb->dir_monitor = g_file_monitor (kfsb->dir, 0, NULL, NULL);
|
||||
@@ -18,6 +18,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
|
||||
file://0001-meson.build-do-not-hardcode-linux-as-the-host-system.patch \
|
||||
file://0001-meson-do-a-build-time-check-for-strlcpy-before-attem.patch \
|
||||
file://glib-meson.cross \
|
||||
file://CVE-2019-13012.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-native = " file://relocate-modules.patch"
|
||||
|
||||
@@ -89,6 +89,9 @@ do_install() {
|
||||
if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
|
||||
copy_locale_files ${libdir}/gconv 0755
|
||||
copy_locale_files ${datadir}/i18n 0644
|
||||
else
|
||||
# Remove the libdir if it is empty when gconv is not copied
|
||||
find ${D}${libdir} -type d -empty -delete
|
||||
fi
|
||||
copy_locale_files ${datadir}/locale 0644
|
||||
install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
|
||||
@@ -97,3 +100,6 @@ do_install() {
|
||||
inherit libc-package
|
||||
|
||||
BBCLASSEXTEND = "nativesdk"
|
||||
|
||||
# Don't scan for CVEs as glibc will be scanned
|
||||
CVE_PRODUCT = ""
|
||||
|
||||
@@ -11,3 +11,6 @@ do_install() {
|
||||
install -d -m 0755 ${D}${bindir}
|
||||
install -m 0755 ${SRC}/mtrace ${D}${bindir}/
|
||||
}
|
||||
|
||||
# Don't scan for CVEs as glibc will be scanned
|
||||
CVE_PRODUCT = ""
|
||||
|
||||
@@ -162,21 +162,28 @@ bashscripts = "mtrace sotruss xtrace"
|
||||
do_stash_locale () {
|
||||
dest=${LOCALESTASH}
|
||||
install -d ${dest}${base_libdir} ${dest}${bindir} ${dest}${libdir} ${dest}${datadir}
|
||||
# Hide away the locale data from the deployment
|
||||
if [ -e ${D}${bindir}/localedef ]; then
|
||||
cp -a ${D}${bindir}/localedef ${dest}${bindir}
|
||||
fi
|
||||
if [ -e ${D}${libdir}/gconv ]; then
|
||||
cp -a ${D}${libdir}/gconv ${dest}${libdir}
|
||||
fi
|
||||
if [ -e ${D}${datadir}/i18n ]; then
|
||||
cp -a ${D}${datadir}/i18n ${dest}${datadir}
|
||||
fi
|
||||
|
||||
# Make a copy of all the libraries into the locale stash
|
||||
cp -fpPR ${D}${libdir}/* ${dest}${libdir}
|
||||
if [ "${base_libdir}" != "${libdir}" ]; then
|
||||
cp -fpPR ${D}${base_libdir}/* ${dest}${base_libdir}
|
||||
fi
|
||||
if [ -e ${D}${bindir}/localedef ]; then
|
||||
mv -f ${D}${bindir}/localedef ${dest}${bindir}
|
||||
fi
|
||||
if [ -e ${D}${libdir}/gconv ]; then
|
||||
mv -f ${D}${libdir}/gconv ${dest}${libdir}
|
||||
fi
|
||||
if [ -e ${D}${exec_prefix}/lib ]; then
|
||||
cp -fpPR ${D}${exec_prefix}/lib ${dest}${exec_prefix}
|
||||
fi
|
||||
if [ -e ${D}${datadir}/i18n ]; then
|
||||
mv ${D}${datadir}/i18n ${dest}${datadir}
|
||||
if [ ${exec_prefix}/lib != ${base_libdir} ] && [ ${exec_prefix}/lib != ${libdir} ]; then
|
||||
cp -fpPR ${D}${exec_prefix}/lib ${dest}${exec_prefix}
|
||||
fi
|
||||
fi
|
||||
|
||||
cp -fpPR ${D}${datadir}/* ${dest}${datadir}
|
||||
rm -rf ${D}${datadir}/locale/
|
||||
cp -fpPR ${WORKDIR}/SUPPORTED ${dest}
|
||||
@@ -203,30 +210,38 @@ python do_stash_locale_setscene () {
|
||||
}
|
||||
addtask do_stash_locale_setscene
|
||||
|
||||
do_poststash_install_cleanup () {
|
||||
# Remove all files which do_stash_locale would remove (mv)
|
||||
# since that task could have come from sstate and not get run.
|
||||
PACKAGE_PREPROCESS_FUNCS += "stash_locale_package_cleanup"
|
||||
SYSROOT_PREPROCESS_FUNCS += "stash_locale_sysroot_cleanup"
|
||||
stash_locale_cleanup () {
|
||||
cleanupdir=$1
|
||||
# Remove all files which do_stash_locale() copies
|
||||
for i in ${bashscripts}; do
|
||||
rm -f ${D}${bindir}/$i
|
||||
rm -f ${cleanupdir}${bindir}/$i
|
||||
done
|
||||
rm -f ${D}${bindir}/localedef
|
||||
rm -rf ${D}${datadir}/i18n
|
||||
rm -rf ${D}${libdir}/gconv
|
||||
rm -rf ${D}/${localedir}
|
||||
rm -rf ${D}${datadir}/locale
|
||||
if [ "${libdir}" != "${exec_prefix}/lib" ]; then
|
||||
if [ -d "${D}${exec_prefix}/lib" ]; then
|
||||
rm -f ${cleanupdir}${bindir}/localedef
|
||||
rm -rf ${cleanupdir}${datadir}/i18n
|
||||
rm -rf ${cleanupdir}${libdir}/gconv
|
||||
rm -rf ${cleanupdir}/${localedir}
|
||||
rm -rf ${cleanupdir}${datadir}/locale
|
||||
if [ "${libdir}" != "${exec_prefix}/lib" ] && [ "${root_prefix}/lib" != "${exec_prefix}/lib" ]; then
|
||||
if [ -d "${cleanupdir}${exec_prefix}/lib" ]; then
|
||||
if [ -z "${ARCH_DYNAMIC_LOADER}" -o \
|
||||
! -e "${D}${exec_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then
|
||||
! -e "${cleanupdir}${exec_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then
|
||||
# error out if directory isn't empty
|
||||
# this dir should only contain locale dir
|
||||
# which has been deleted in the previous step
|
||||
rmdir ${D}${exec_prefix}/lib
|
||||
rmdir ${cleanupdir}${exec_prefix}/lib
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
addtask do_poststash_install_cleanup after do_stash_locale do_install before do_populate_sysroot do_package
|
||||
|
||||
stash_locale_sysroot_cleanup() {
|
||||
stash_locale_cleanup ${SYSROOT_DESTDIR}
|
||||
}
|
||||
stash_locale_package_cleanup() {
|
||||
stash_locale_cleanup ${PKGD}
|
||||
}
|
||||
|
||||
pkg_postinst_nscd () {
|
||||
if [ -z "$D" ]; then
|
||||
|
||||
@@ -18,3 +18,6 @@ do_install() {
|
||||
# sotruss script requires sotruss-lib.so (given by libsotruss package),
|
||||
# to produce trace of the library calls.
|
||||
RDEPENDS_${PN} += "libsotruss"
|
||||
|
||||
# Don't scan for CVEs as glibc will be scanned
|
||||
CVE_PRODUCT = ""
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
CVE: CVE-2019-9169
|
||||
CVE: CVE-2018-20796
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||
|
||||
|
||||
@@ -121,7 +121,6 @@ do_compile () {
|
||||
echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\""
|
||||
sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
require glibc-package.inc
|
||||
|
||||
@@ -24,7 +24,7 @@ FILES_${PN} = "${libdir}/libcrypt*.so.* ${libdir}/libcrypt-*.so ${libdir}/libowc
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE} -std=gnu99"
|
||||
TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir} -Wno-error=missing-attributes"
|
||||
CPPFLAGS_append_class-nativesdk = " -Wno-error=missing-attributes"
|
||||
TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir} -Wno-error"
|
||||
CPPFLAGS_append_class-nativesdk = " -Wno-error"
|
||||
|
||||
BBCLASSEXTEND = "nativesdk"
|
||||
|
||||
195
meta/recipes-core/meta/cve-update-db-native.bb
Normal file
195
meta/recipes-core/meta/cve-update-db-native.bb
Normal file
@@ -0,0 +1,195 @@
|
||||
SUMMARY = "Updates the NVD CVE database"
|
||||
LICENSE = "MIT"
|
||||
|
||||
INHIBIT_DEFAULT_DEPS = "1"
|
||||
|
||||
inherit native
|
||||
|
||||
deltask do_unpack
|
||||
deltask do_patch
|
||||
deltask do_configure
|
||||
deltask do_compile
|
||||
deltask do_install
|
||||
deltask do_populate_sysroot
|
||||
|
||||
python () {
|
||||
if not d.getVar("CVE_CHECK_DB_FILE"):
|
||||
raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.")
|
||||
}
|
||||
|
||||
python do_populate_cve_db() {
|
||||
"""
|
||||
Update NVD database with json data feed
|
||||
"""
|
||||
|
||||
import sqlite3, urllib, urllib.parse, shutil, gzip
|
||||
from datetime import date
|
||||
|
||||
BASE_URL = "https://nvd.nist.gov/feeds/json/cve/1.0/nvdcve-1.0-"
|
||||
YEAR_START = 2002
|
||||
|
||||
db_dir = os.path.join(d.getVar("DL_DIR"), 'CVE_CHECK')
|
||||
db_file = os.path.join(db_dir, 'nvdcve_1.0.db')
|
||||
json_tmpfile = os.path.join(db_dir, 'nvd.json.gz')
|
||||
proxy = d.getVar("https_proxy")
|
||||
|
||||
if proxy:
|
||||
# instantiate an opener but do not install it as the global
|
||||
# opener unless if we're really sure it's applicable for all
|
||||
# urllib requests
|
||||
proxy_handler = urllib.request.ProxyHandler({'https': proxy})
|
||||
proxy_opener = urllib.request.build_opener(proxy_handler)
|
||||
else:
|
||||
proxy_opener = None
|
||||
|
||||
cve_f = open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a')
|
||||
|
||||
if not os.path.isdir(db_dir):
|
||||
os.mkdir(db_dir)
|
||||
|
||||
# Connect to database
|
||||
conn = sqlite3.connect(db_file)
|
||||
c = conn.cursor()
|
||||
|
||||
initialize_db(c)
|
||||
|
||||
for year in range(YEAR_START, date.today().year + 1):
|
||||
year_url = BASE_URL + str(year)
|
||||
meta_url = year_url + ".meta"
|
||||
json_url = year_url + ".json.gz"
|
||||
|
||||
# Retrieve meta last modified date
|
||||
|
||||
response = None
|
||||
|
||||
if proxy_opener:
|
||||
response = proxy_opener.open(meta_url)
|
||||
else:
|
||||
req = urllib.request.Request(meta_url)
|
||||
response = urllib.request.urlopen(req)
|
||||
|
||||
if response:
|
||||
for l in response.read().decode("utf-8").splitlines():
|
||||
key, value = l.split(":", 1)
|
||||
if key == "lastModifiedDate":
|
||||
last_modified = value
|
||||
break
|
||||
else:
|
||||
bb.warn("Cannot parse CVE metadata, update failed")
|
||||
return
|
||||
|
||||
# Compare with current db last modified date
|
||||
c.execute("select DATE from META where YEAR = ?", (year,))
|
||||
meta = c.fetchone()
|
||||
if not meta or meta[0] != last_modified:
|
||||
# Clear products table entries corresponding to current year
|
||||
c.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,))
|
||||
|
||||
# Update db with current year json file
|
||||
try:
|
||||
if proxy_opener:
|
||||
response = proxy_opener.open(json_url)
|
||||
else:
|
||||
req = urllib.request.Request(json_url)
|
||||
response = urllib.request.urlopen(req)
|
||||
|
||||
if response:
|
||||
update_db(c, gzip.decompress(response.read()).decode('utf-8'))
|
||||
c.execute("insert or replace into META values (?, ?)", [year, last_modified])
|
||||
except urllib.error.URLError as e:
|
||||
cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n')
|
||||
bb.warn("Cannot parse CVE data (%s), update failed" % e.reason)
|
||||
return
|
||||
|
||||
# Update success, set the date to cve_check file.
|
||||
if year == date.today().year:
|
||||
cve_f.write('CVE database update : %s\n\n' % date.today())
|
||||
|
||||
cve_f.close()
|
||||
conn.commit()
|
||||
conn.close()
|
||||
}
|
||||
|
||||
def initialize_db(c):
|
||||
c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
|
||||
c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \
|
||||
SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)")
|
||||
c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \
|
||||
VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \
|
||||
VERSION_END TEXT, OPERATOR_END TEXT)")
|
||||
|
||||
def parse_node_and_insert(c, node, cveId):
|
||||
# Parse children node if needed
|
||||
for child in node.get('children', ()):
|
||||
parse_node_and_insert(c, child, cveId)
|
||||
|
||||
def cpe_generator():
|
||||
for cpe in node.get('cpe_match', ()):
|
||||
if not cpe['vulnerable']:
|
||||
return
|
||||
cpe23 = cpe['cpe23Uri'].split(':')
|
||||
vendor = cpe23[3]
|
||||
product = cpe23[4]
|
||||
version = cpe23[5]
|
||||
|
||||
if version != '*':
|
||||
# Version is defined, this is a '=' match
|
||||
yield [cveId, vendor, product, version, '=', '', '']
|
||||
else:
|
||||
# Parse start version, end version and operators
|
||||
op_start = ''
|
||||
op_end = ''
|
||||
v_start = ''
|
||||
v_end = ''
|
||||
|
||||
if 'versionStartIncluding' in cpe:
|
||||
op_start = '>='
|
||||
v_start = cpe['versionStartIncluding']
|
||||
|
||||
if 'versionStartExcluding' in cpe:
|
||||
op_start = '>'
|
||||
v_start = cpe['versionStartExcluding']
|
||||
|
||||
if 'versionEndIncluding' in cpe:
|
||||
op_end = '<='
|
||||
v_end = cpe['versionEndIncluding']
|
||||
|
||||
if 'versionEndExcluding' in cpe:
|
||||
op_end = '<'
|
||||
v_end = cpe['versionEndExcluding']
|
||||
|
||||
yield [cveId, vendor, product, v_start, op_start, v_end, op_end]
|
||||
|
||||
c.executemany("insert into PRODUCTS values (?, ?, ?, ?, ?, ?, ?)", cpe_generator())
|
||||
|
||||
def update_db(c, jsondata):
|
||||
import json
|
||||
root = json.loads(jsondata)
|
||||
|
||||
for elt in root['CVE_Items']:
|
||||
if not elt['impact']:
|
||||
continue
|
||||
|
||||
cveId = elt['cve']['CVE_data_meta']['ID']
|
||||
cveDesc = elt['cve']['description']['description_data'][0]['value']
|
||||
date = elt['lastModifiedDate']
|
||||
accessVector = elt['impact']['baseMetricV2']['cvssV2']['accessVector']
|
||||
cvssv2 = elt['impact']['baseMetricV2']['cvssV2']['baseScore']
|
||||
|
||||
try:
|
||||
cvssv3 = elt['impact']['baseMetricV3']['cvssV3']['baseScore']
|
||||
except:
|
||||
cvssv3 = 0.0
|
||||
|
||||
c.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?)",
|
||||
[cveId, cveDesc, cvssv2, cvssv3, date, accessVector])
|
||||
|
||||
configurations = elt['configurations']['nodes']
|
||||
for config in configurations:
|
||||
parse_node_and_insert(c, config, cveId)
|
||||
|
||||
|
||||
addtask do_populate_cve_db before do_fetch
|
||||
do_populate_cve_db[nostamp] = "1"
|
||||
|
||||
EXCLUDE_FROM_WORLD = "1"
|
||||
@@ -14,7 +14,7 @@ LICENSE = "GPLv2 & LGPLv2.1"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
|
||||
file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
|
||||
|
||||
SRCREV = "c1f8ff8d0de7e303b8004b02a0a47d4cc103a7f8"
|
||||
SRCREV = "511646b8ac5c82f210b16920044465756913d238"
|
||||
SRCBRANCH = "v241-stable"
|
||||
SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}"
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@ SRC_URI = "\
|
||||
file://CVE-2019-9075.patch \
|
||||
file://CVE-2019-9076.patch \
|
||||
file://CVE-2019-9077.patch \
|
||||
file://CVE-2019-9071.patch \
|
||||
file://CVE-2019-12972.patch \
|
||||
file://CVE-2019-14250.patch \
|
||||
file://CVE-2019-14444.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From d540e95d05cd7c4b8924ac7b257c14ae0105d0ab Mon Sep 17 00:00:00 2001
|
||||
From 958a49749b772660d3bafb80748829cba6bed065 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 2 Mar 2015 01:44:14 +0000
|
||||
Subject: [PATCH 10/15] Change default emulation for mips64*-*-linux
|
||||
@@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
2 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/bfd/config.bfd b/bfd/config.bfd
|
||||
index 0e1ddb659c..cc65547588 100644
|
||||
index 0e1ddb659c..d4f50f0a8d 100644
|
||||
--- a/bfd/config.bfd
|
||||
+++ b/bfd/config.bfd
|
||||
@@ -919,12 +919,12 @@ case "${targ}" in
|
||||
@@ -30,7 +30,7 @@ index 0e1ddb659c..cc65547588 100644
|
||||
- targ_defvec=mips_elf32_ntrad_be_vec
|
||||
- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
|
||||
+ targ_defvec=mips_elf64_trad_be_vec
|
||||
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_be_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
|
||||
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
|
||||
;;
|
||||
mips*el-*-linux*)
|
||||
targ_defvec=mips_elf32_trad_le_vec
|
||||
@@ -54,6 +54,3 @@ index beba17ef51..917be6f8eb 100644
|
||||
targ_extra_libpath=$targ_extra_emuls ;;
|
||||
mips*el-*-linux-*) targ_emul=elf32ltsmip
|
||||
targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
51
meta/recipes-devtools/binutils/binutils/CVE-2019-12972.patch
Normal file
51
meta/recipes-devtools/binutils/binutils/CVE-2019-12972.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
From 30bcc01478433a1cb05b36dc5c4beef7d2c89b5b Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Fri, 21 Jun 2019 11:51:38 +0930
|
||||
Subject: [PATCH] PR24689, string table corruption
|
||||
|
||||
The testcase in the PR had a e_shstrndx section of type SHT_GROUP.
|
||||
hdr->contents were initialized by setup_group rather than being read
|
||||
from the file, thus last byte was not zero and string dereference ran
|
||||
off the end of the buffer.
|
||||
|
||||
PR 24689
|
||||
* elfcode.h (elf_object_p): Check type of e_shstrndx section.
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2019-12972
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
bfd/ChangeLog | 5 +++++
|
||||
bfd/elfcode.h | 3 ++-
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
|
||||
index 91f09e6346..e66fb40a2c 100644
|
||||
--- a/bfd/ChangeLog
|
||||
+++ b/bfd/ChangeLog
|
||||
@@ -1,3 +1,8 @@
|
||||
+2019-06-21 Alan Modra <amodra@gmail.com>
|
||||
+
|
||||
+ PR 24689
|
||||
+ * elfcode.h (elf_object_p): Check type of e_shstrndx section.
|
||||
+
|
||||
2019-02-20 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR 24236
|
||||
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
|
||||
index ec5ea766de..a35a629087 100644
|
||||
--- a/bfd/elfcode.h
|
||||
+++ b/bfd/elfcode.h
|
||||
@@ -755,7 +755,8 @@ elf_object_p (bfd *abfd)
|
||||
/* A further sanity check. */
|
||||
if (i_ehdrp->e_shnum != 0)
|
||||
{
|
||||
- if (i_ehdrp->e_shstrndx >= elf_numsections (abfd))
|
||||
+ if (i_ehdrp->e_shstrndx >= elf_numsections (abfd)
|
||||
+ || i_shdrp[i_ehdrp->e_shstrndx].sh_type != SHT_STRTAB)
|
||||
{
|
||||
/* PR 2257:
|
||||
We used to just goto got_wrong_format_error here
|
||||
--
|
||||
2.20.1
|
||||
|
||||
33
meta/recipes-devtools/binutils/binutils/CVE-2019-14250.patch
Normal file
33
meta/recipes-devtools/binutils/binutils/CVE-2019-14250.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From df78be05daf4eb07f60f50ec1080cb979af32ec0 Mon Sep 17 00:00:00 2001
|
||||
From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Tue, 23 Jul 2019 07:33:32 +0000
|
||||
Subject: [PATCH] libiberty: Check zero value shstrndx in simple-object-elf.c
|
||||
|
||||
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@273718 138bc75d-0d04-0410-961f-82ee72b054a4
|
||||
|
||||
CVE: CVE-2019-14250
|
||||
Upstream-Status: Backport [from gcc: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=273718]
|
||||
[Removed Changelog entry]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c
|
||||
index 502388991a08..bdee963634d6 100644
|
||||
--- a/libiberty/simple-object-elf.c
|
||||
+++ b/libiberty/simple-object-elf.c
|
||||
@@ -548,7 +548,15 @@ simple_object_elf_match (unsigned char header[SIMPLE_OBJECT_MATCH_HEADER_LEN],
|
||||
XDELETE (eor);
|
||||
return NULL;
|
||||
}
|
||||
-
|
||||
+
|
||||
+ if (eor->shstrndx == 0)
|
||||
+ {
|
||||
+ *errmsg = "invalid ELF shstrndx == 0";
|
||||
+ *err = 0;
|
||||
+ XDELETE (eor);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
return (void *) eor;
|
||||
}
|
||||
|
||||
28
meta/recipes-devtools/binutils/binutils/CVE-2019-14444.patch
Normal file
28
meta/recipes-devtools/binutils/binutils/CVE-2019-14444.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From e17869db99195849826eaaf5d2d0eb2cfdd7a2a7 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Mon, 5 Aug 2019 10:40:35 +0100
|
||||
Subject: [PATCH] Catch potential integer overflow in readelf when processing
|
||||
corrupt binaries.
|
||||
|
||||
PR 24829
|
||||
* readelf.c (apply_relocations): Catch potential integer overflow
|
||||
whilst checking reloc location against section size.
|
||||
|
||||
CVE: CVE-2019-14444
|
||||
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e17869db99195849826eaaf5d2d0eb2cfdd7a2a7]
|
||||
[Removed Changelog entry]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
diff --git a/binutils/readelf.c b/binutils/readelf.c
|
||||
index b896ad9f406..e785fde43e7 100644
|
||||
--- a/binutils/readelf.c
|
||||
+++ b/binutils/readelf.c
|
||||
@@ -13366,7 +13366,7 @@ apply_relocations (Filedata * filedata,
|
||||
}
|
||||
|
||||
rloc = start + rp->r_offset;
|
||||
- if ((rloc + reloc_size) > end || (rloc < start))
|
||||
+ if (rloc >= end || (rloc + reloc_size) > end || (rloc < start))
|
||||
{
|
||||
warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
|
||||
(unsigned long) rp->r_offset,
|
||||
165
meta/recipes-devtools/binutils/binutils/CVE-2019-9071.patch
Normal file
165
meta/recipes-devtools/binutils/binutils/CVE-2019-9071.patch
Normal file
@@ -0,0 +1,165 @@
|
||||
From c1202057eb9161a86af27d867703235fee7b7555 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 10 Apr 2019 15:49:36 +0100
|
||||
Subject: [PATCH] Pull in patch for libiberty that fixes a stack exhaustion bug
|
||||
when demangling a pathalogically constructed mangled name.
|
||||
|
||||
PR 89394
|
||||
* cp-demangle.c (cplus_demangle_fill_name): Reject negative
|
||||
lengths.
|
||||
(d_count_templates_scopes): Replace num_templates and num_scopes
|
||||
parameters with a struct d_print_info pointer parameter. Adjust
|
||||
body of the function accordingly. Add recursion counter and check
|
||||
that the recursion limit is not reached.
|
||||
(d_print_init): Pass dpi parameter to d_count_templates_scopes.
|
||||
Reset recursion counter afterwards, unless the recursion limit was
|
||||
reached.
|
||||
|
||||
CVE: CVE-2019-9071
|
||||
CVE: CVE-2019-9070
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
ChangeLog | 16 ++++++++++++++
|
||||
libiberty/cp-demangle.c | 48 ++++++++++++++++++++++-------------------
|
||||
2 files changed, 42 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index cd631a15b6..4df3aaa62c 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,3 +1,19 @@
|
||||
+2019-04-10 Nick Clifton <nickc@redhat.com>
|
||||
+
|
||||
+ * libiberty: Sync with gcc. Bring in:
|
||||
+ 2019-04-10 Nick Clifton <nickc@redhat.com>
|
||||
+
|
||||
+ PR 89394
|
||||
+ * cp-demangle.c (cplus_demangle_fill_name): Reject negative
|
||||
+ lengths.
|
||||
+ (d_count_templates_scopes): Replace num_templates and num_scopes
|
||||
+ parameters with a struct d_print_info pointer parameter. Adjust
|
||||
+ body of the function accordingly. Add recursion counter and check
|
||||
+ that the recursion limit is not reached.
|
||||
+ (d_print_init): Pass dpi parameter to d_count_templates_scopes.
|
||||
+ Reset recursion counter afterwards, unless the recursion limit was
|
||||
+ reached.
|
||||
+
|
||||
2018-06-24 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
2.32 branch created.
|
||||
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
|
||||
index b34b485692..779b4e763a 100644
|
||||
--- a/libiberty/cp-demangle.c
|
||||
+++ b/libiberty/cp-demangle.c
|
||||
@@ -861,7 +861,7 @@ CP_STATIC_IF_GLIBCPP_V3
|
||||
int
|
||||
cplus_demangle_fill_name (struct demangle_component *p, const char *s, int len)
|
||||
{
|
||||
- if (p == NULL || s == NULL || len == 0)
|
||||
+ if (p == NULL || s == NULL || len <= 0)
|
||||
return 0;
|
||||
p->d_printing = 0;
|
||||
p->type = DEMANGLE_COMPONENT_NAME;
|
||||
@@ -4061,7 +4061,7 @@ d_growable_string_callback_adapter (const char *s, size_t l, void *opaque)
|
||||
are larger than the actual numbers encountered. */
|
||||
|
||||
static void
|
||||
-d_count_templates_scopes (int *num_templates, int *num_scopes,
|
||||
+d_count_templates_scopes (struct d_print_info *dpi,
|
||||
const struct demangle_component *dc)
|
||||
{
|
||||
if (dc == NULL)
|
||||
@@ -4081,13 +4081,13 @@ d_count_templates_scopes (int *num_templates, int *num_scopes,
|
||||
break;
|
||||
|
||||
case DEMANGLE_COMPONENT_TEMPLATE:
|
||||
- (*num_templates)++;
|
||||
+ dpi->num_copy_templates++;
|
||||
goto recurse_left_right;
|
||||
|
||||
case DEMANGLE_COMPONENT_REFERENCE:
|
||||
case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
|
||||
if (d_left (dc)->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM)
|
||||
- (*num_scopes)++;
|
||||
+ dpi->num_saved_scopes++;
|
||||
goto recurse_left_right;
|
||||
|
||||
case DEMANGLE_COMPONENT_QUAL_NAME:
|
||||
@@ -4152,42 +4152,42 @@ d_count_templates_scopes (int *num_templates, int *num_scopes,
|
||||
case DEMANGLE_COMPONENT_TAGGED_NAME:
|
||||
case DEMANGLE_COMPONENT_CLONE:
|
||||
recurse_left_right:
|
||||
- d_count_templates_scopes (num_templates, num_scopes,
|
||||
- d_left (dc));
|
||||
- d_count_templates_scopes (num_templates, num_scopes,
|
||||
- d_right (dc));
|
||||
+ /* PR 89394 - Check for too much recursion. */
|
||||
+ if (dpi->recursion > DEMANGLE_RECURSION_LIMIT)
|
||||
+ /* FIXME: There ought to be a way to report to the
|
||||
+ user that the recursion limit has been reached. */
|
||||
+ return;
|
||||
+
|
||||
+ ++ dpi->recursion;
|
||||
+ d_count_templates_scopes (dpi, d_left (dc));
|
||||
+ d_count_templates_scopes (dpi, d_right (dc));
|
||||
+ -- dpi->recursion;
|
||||
break;
|
||||
|
||||
case DEMANGLE_COMPONENT_CTOR:
|
||||
- d_count_templates_scopes (num_templates, num_scopes,
|
||||
- dc->u.s_ctor.name);
|
||||
+ d_count_templates_scopes (dpi, dc->u.s_ctor.name);
|
||||
break;
|
||||
|
||||
case DEMANGLE_COMPONENT_DTOR:
|
||||
- d_count_templates_scopes (num_templates, num_scopes,
|
||||
- dc->u.s_dtor.name);
|
||||
+ d_count_templates_scopes (dpi, dc->u.s_dtor.name);
|
||||
break;
|
||||
|
||||
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
|
||||
- d_count_templates_scopes (num_templates, num_scopes,
|
||||
- dc->u.s_extended_operator.name);
|
||||
+ d_count_templates_scopes (dpi, dc->u.s_extended_operator.name);
|
||||
break;
|
||||
|
||||
case DEMANGLE_COMPONENT_FIXED_TYPE:
|
||||
- d_count_templates_scopes (num_templates, num_scopes,
|
||||
- dc->u.s_fixed.length);
|
||||
+ d_count_templates_scopes (dpi, dc->u.s_fixed.length);
|
||||
break;
|
||||
|
||||
case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:
|
||||
case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:
|
||||
- d_count_templates_scopes (num_templates, num_scopes,
|
||||
- d_left (dc));
|
||||
+ d_count_templates_scopes (dpi, d_left (dc));
|
||||
break;
|
||||
|
||||
case DEMANGLE_COMPONENT_LAMBDA:
|
||||
case DEMANGLE_COMPONENT_DEFAULT_ARG:
|
||||
- d_count_templates_scopes (num_templates, num_scopes,
|
||||
- dc->u.s_unary_num.sub);
|
||||
+ d_count_templates_scopes (dpi, dc->u.s_unary_num.sub);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4222,8 +4222,12 @@ d_print_init (struct d_print_info *dpi, demangle_callbackref callback,
|
||||
dpi->next_copy_template = 0;
|
||||
dpi->num_copy_templates = 0;
|
||||
|
||||
- d_count_templates_scopes (&dpi->num_copy_templates,
|
||||
- &dpi->num_saved_scopes, dc);
|
||||
+ d_count_templates_scopes (dpi, dc);
|
||||
+ /* If we did not reach the recursion limit, then reset the
|
||||
+ current recursion value back to 0, so that we can print
|
||||
+ the templates. */
|
||||
+ if (dpi->recursion < DEMANGLE_RECURSION_LIMIT)
|
||||
+ dpi->recursion = 0;
|
||||
dpi->num_copy_templates *= dpi->num_saved_scopes;
|
||||
|
||||
dpi->current_template = NULL;
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
SUMMARY = "cve-check-tool"
|
||||
DESCRIPTION = "cve-check-tool is a tool for checking known (public) CVEs.\
|
||||
The tool will identify potentially vunlnerable software packages within Linux distributions through version matching."
|
||||
HOMEPAGE = "https://github.com/ikeydoherty/cve-check-tool"
|
||||
SECTION = "Development/Tools"
|
||||
LICENSE = "GPL-2.0+"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=e8c1458438ead3c34974bc0be3a03ed6"
|
||||
|
||||
SRC_URI = "https://github.com/ikeydoherty/${BPN}/releases/download/v${PV}/${BP}.tar.xz \
|
||||
file://check-for-malloc_trim-before-using-it.patch \
|
||||
file://0001-print-progress-in-percent-when-downloading-CVE-db.patch \
|
||||
file://0001-curl-allow-overriding-default-CA-certificate-file.patch \
|
||||
file://0001-update-Compare-computed-vs-expected-sha256-digit-str.patch \
|
||||
file://0001-Fix-freeing-memory-allocated-by-sqlite.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "c5f4247140fc9be3bf41491d31a34155"
|
||||
SRC_URI[sha256sum] = "b8f283be718af8d31232ac1bfc10a0378fb958aaaa49af39168f8acf501e6a5b"
|
||||
|
||||
UPSTREAM_CHECK_URI = "https://github.com/ikeydoherty/cve-check-tool/releases"
|
||||
|
||||
DEPENDS = "libcheck glib-2.0 json-glib curl libxml2 sqlite3 openssl ca-certificates"
|
||||
|
||||
RDEPENDS_${PN} = "ca-certificates"
|
||||
|
||||
inherit pkgconfig autotools
|
||||
|
||||
EXTRA_OECONF = "--disable-coverage --enable-relative-plugins"
|
||||
CFLAGS_append = " -Wno-error=pedantic"
|
||||
|
||||
do_populate_cve_db() {
|
||||
if [ "${BB_NO_NETWORK}" = "1" ] ; then
|
||||
bbwarn "BB_NO_NETWORK is set; Can't update cve-check-tool database, new CVEs won't be detected"
|
||||
return
|
||||
fi
|
||||
|
||||
# In case we don't inherit cve-check class, use default values defined in the class.
|
||||
cve_dir="${CVE_CHECK_DB_DIR}"
|
||||
cve_file="${CVE_CHECK_TMP_FILE}"
|
||||
|
||||
[ -z "${cve_dir}" ] && cve_dir="${DL_DIR}/CVE_CHECK"
|
||||
[ -z "${cve_file}" ] && cve_file="${TMPDIR}/cve_check"
|
||||
|
||||
unused="${@bb.utils.export_proxies(d)}"
|
||||
bbdebug 2 "Updating cve-check-tool database located in $cve_dir"
|
||||
# --cacert works around curl-native not finding the CA bundle
|
||||
if cve-check-update --cacert ${sysconfdir}/ssl/certs/ca-certificates.crt -d "$cve_dir" ; then
|
||||
printf "CVE database was updated on %s UTC\n\n" "$(LANG=C date --utc +'%F %T')" > "$cve_file"
|
||||
else
|
||||
bbwarn "Error in executing cve-check-update"
|
||||
if [ "${@'1' if bb.data.inherits_class('cve-check', d) else '0'}" -ne 0 ] ; then
|
||||
bbwarn "Failed to update cve-check-tool database, CVEs won't be checked"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
addtask populate_cve_db after do_populate_sysroot
|
||||
do_populate_cve_db[depends] = "cve-check-tool-native:do_populate_sysroot"
|
||||
do_populate_cve_db[nostamp] = "1"
|
||||
do_populate_cve_db[progress] = "percent"
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
@@ -1,50 +0,0 @@
|
||||
From a3353429652f83bb8b0316500faa88fa2555542d Mon Sep 17 00:00:00 2001
|
||||
From: Peter Marko <peter.marko@siemens.com>
|
||||
Date: Thu, 13 Apr 2017 23:09:52 +0200
|
||||
Subject: [PATCH] Fix freeing memory allocated by sqlite
|
||||
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
---
|
||||
src/core.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/core.c b/src/core.c
|
||||
index 6263031..6788f16 100644
|
||||
--- a/src/core.c
|
||||
+++ b/src/core.c
|
||||
@@ -82,7 +82,7 @@ static bool ensure_table(CveDB *self)
|
||||
rc = sqlite3_exec(self->db, query, NULL, NULL, &err);
|
||||
if (rc != SQLITE_OK) {
|
||||
fprintf(stderr, "ensure_table(): %s\n", err);
|
||||
- free(err);
|
||||
+ sqlite3_free(err);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ static bool ensure_table(CveDB *self)
|
||||
rc = sqlite3_exec(self->db, query, NULL, NULL, &err);
|
||||
if (rc != SQLITE_OK) {
|
||||
fprintf(stderr, "ensure_table(): %s\n", err);
|
||||
- free(err);
|
||||
+ sqlite3_free(err);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ static bool ensure_table(CveDB *self)
|
||||
rc = sqlite3_exec(self->db, query, NULL, NULL, &err);
|
||||
if (rc != SQLITE_OK) {
|
||||
fprintf(stderr, "ensure_table(): %s\n", err);
|
||||
- free(err);
|
||||
+ sqlite3_free(err);
|
||||
return false;
|
||||
}
|
||||
if (err) {
|
||||
- free(err);
|
||||
+ sqlite3_free(err);
|
||||
}
|
||||
|
||||
return true;
|
||||
--
|
||||
2.1.4
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
From 825a9969dea052b02ba868bdf39e676349f10dce Mon Sep 17 00:00:00 2001
|
||||
From: Jussi Kukkonen <jussi.kukkonen@intel.com>
|
||||
Date: Thu, 9 Feb 2017 14:51:28 +0200
|
||||
Subject: [PATCH] curl: allow overriding default CA certificate file
|
||||
|
||||
Similar to curl, --cacert can now be used in cve-check-tool and
|
||||
cve-check-update to override the default CA certificate file. Useful
|
||||
in cases where the system default is unsuitable (for example,
|
||||
out-dated) or broken (as in OE's current native libcurl, which embeds
|
||||
a path string from one build host and then uses it on another although
|
||||
the right path may have become something different).
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/ikeydoherty/cve-check-tool/pull/45]
|
||||
|
||||
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
|
||||
|
||||
|
||||
Took Patrick Ohlys original patch from meta-security-isafw, rebased
|
||||
on top of other patches.
|
||||
|
||||
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
|
||||
---
|
||||
src/library/cve-check-tool.h | 1 +
|
||||
src/library/fetch.c | 10 +++++++++-
|
||||
src/library/fetch.h | 3 ++-
|
||||
src/main.c | 5 ++++-
|
||||
src/update-main.c | 4 +++-
|
||||
src/update.c | 12 +++++++-----
|
||||
src/update.h | 2 +-
|
||||
7 files changed, 27 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/library/cve-check-tool.h b/src/library/cve-check-tool.h
|
||||
index e4bb5b1..f89eade 100644
|
||||
--- a/src/library/cve-check-tool.h
|
||||
+++ b/src/library/cve-check-tool.h
|
||||
@@ -43,6 +43,7 @@ typedef struct CveCheckTool {
|
||||
bool bugs; /**<Whether bug tracking is enabled */
|
||||
GHashTable *mapping; /**<CVE Mapping */
|
||||
const char *output_file; /**<Output file, if any */
|
||||
+ const char *cacert_file; /**<Non-default SSL certificate file, if any */
|
||||
} CveCheckTool;
|
||||
|
||||
/**
|
||||
diff --git a/src/library/fetch.c b/src/library/fetch.c
|
||||
index 0fe6d76..8f998c3 100644
|
||||
--- a/src/library/fetch.c
|
||||
+++ b/src/library/fetch.c
|
||||
@@ -60,7 +60,8 @@ static int progress_callback_new(void *ptr, curl_off_t dltotal, curl_off_t dlnow
|
||||
}
|
||||
|
||||
FetchStatus fetch_uri(const char *uri, const char *target, bool verbose,
|
||||
- unsigned int start_percent, unsigned int end_percent)
|
||||
+ unsigned int start_percent, unsigned int end_percent,
|
||||
+ const char *cacert_file)
|
||||
{
|
||||
FetchStatus ret = FETCH_STATUS_FAIL;
|
||||
CURLcode res;
|
||||
@@ -74,6 +75,13 @@ FetchStatus fetch_uri(const char *uri, const char *target, bool verbose,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ if (cacert_file) {
|
||||
+ res = curl_easy_setopt(curl, CURLOPT_CAINFO, cacert_file);
|
||||
+ if (res != CURLE_OK) {
|
||||
+ goto bail;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (stat(target, &st) == 0) {
|
||||
res = curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
|
||||
if (res != CURLE_OK) {
|
||||
diff --git a/src/library/fetch.h b/src/library/fetch.h
|
||||
index 4cce5d1..836c7d7 100644
|
||||
--- a/src/library/fetch.h
|
||||
+++ b/src/library/fetch.h
|
||||
@@ -29,7 +29,8 @@ typedef enum {
|
||||
* @return A FetchStatus, indicating the operation taken
|
||||
*/
|
||||
FetchStatus fetch_uri(const char *uri, const char *target, bool verbose,
|
||||
- unsigned int this_percent, unsigned int next_percent);
|
||||
+ unsigned int this_percent, unsigned int next_percent,
|
||||
+ const char *cacert_file);
|
||||
|
||||
/**
|
||||
* Attempt to extract the given gzipped file
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 8e6f158..ae69d47 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -280,6 +280,7 @@ static bool csv_mode = false;
|
||||
static char *modified_stamp = NULL;
|
||||
static gchar *mapping_file = NULL;
|
||||
static gchar *output_file = NULL;
|
||||
+static gchar *cacert_file = NULL;
|
||||
|
||||
static GOptionEntry _entries[] = {
|
||||
{ "not-patched", 'n', 0, G_OPTION_ARG_NONE, &hide_patched, "Hide patched/addressed CVEs", NULL },
|
||||
@@ -294,6 +295,7 @@ static GOptionEntry _entries[] = {
|
||||
{ "csv", 'c', 0, G_OPTION_ARG_NONE, &csv_mode, "Output CSV formatted data only", NULL },
|
||||
{ "mapping", 'M', 0, G_OPTION_ARG_STRING, &mapping_file, "Path to a mapping file", NULL},
|
||||
{ "output-file", 'o', 0, G_OPTION_ARG_STRING, &output_file, "Path to the output file (output plugin specific)", NULL},
|
||||
+ { "cacert", 'C', 0, G_OPTION_ARG_STRING, &cacert_file, "Path to the combined SSL certificates file (system default is used if not set)", NULL},
|
||||
{ .short_name = 0 }
|
||||
};
|
||||
|
||||
@@ -492,6 +494,7 @@ int main(int argc, char **argv)
|
||||
|
||||
quiet = csv_mode || !no_html;
|
||||
self->output_file = output_file;
|
||||
+ self->cacert_file = cacert_file;
|
||||
|
||||
if (!csv_mode && self->output_file) {
|
||||
quiet = false;
|
||||
@@ -530,7 +533,7 @@ int main(int argc, char **argv)
|
||||
if (status) {
|
||||
fprintf(stderr, "Update of db forced\n");
|
||||
cve_db_unlock();
|
||||
- if (!update_db(quiet, db_path->str)) {
|
||||
+ if (!update_db(quiet, db_path->str, self->cacert_file)) {
|
||||
fprintf(stderr, "DB update failure\n");
|
||||
goto cleanup;
|
||||
}
|
||||
diff --git a/src/update-main.c b/src/update-main.c
|
||||
index 2379cfa..c52d9d0 100644
|
||||
--- a/src/update-main.c
|
||||
+++ b/src/update-main.c
|
||||
@@ -43,11 +43,13 @@ the Free Software Foundation; either version 2 of the License, or\n\
|
||||
static gchar *nvds = NULL;
|
||||
static bool _show_version = false;
|
||||
static bool _quiet = false;
|
||||
+static const char *_cacert_file = NULL;
|
||||
|
||||
static GOptionEntry _entries[] = {
|
||||
{ "nvd-dir", 'd', 0, G_OPTION_ARG_STRING, &nvds, "NVD directory in filesystem", NULL },
|
||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &_show_version, "Show version", NULL },
|
||||
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &_quiet, "Run silently", NULL },
|
||||
+ { "cacert", 'C', 0, G_OPTION_ARG_STRING, &_cacert_file, "Path to the combined SSL certificates file (system default is used if not set)", NULL},
|
||||
{ .short_name = 0 }
|
||||
};
|
||||
|
||||
@@ -88,7 +90,7 @@ int main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
- if (update_db(_quiet, db_path->str)) {
|
||||
+ if (update_db(_quiet, db_path->str, _cacert_file)) {
|
||||
ret = EXIT_SUCCESS;
|
||||
} else {
|
||||
fprintf(stderr, "Failed to update database\n");
|
||||
diff --git a/src/update.c b/src/update.c
|
||||
index 070560a..8cb4a39 100644
|
||||
--- a/src/update.c
|
||||
+++ b/src/update.c
|
||||
@@ -267,7 +267,8 @@ static inline void update_end(int fd, const char *update_fname, bool ok)
|
||||
|
||||
static int do_fetch_update(int year, const char *db_dir, CveDB *cve_db,
|
||||
bool db_exist, bool verbose,
|
||||
- unsigned int this_percent, unsigned int next_percent)
|
||||
+ unsigned int this_percent, unsigned int next_percent,
|
||||
+ const char *cacert_file)
|
||||
{
|
||||
const char nvd_uri[] = URI_PREFIX;
|
||||
autofree(cve_string) *uri_meta = NULL;
|
||||
@@ -331,14 +332,14 @@ refetch:
|
||||
}
|
||||
|
||||
/* Fetch NVD META file */
|
||||
- st = fetch_uri(uri_meta->str, nvdcve_meta->str, verbose, this_percent, this_percent);
|
||||
+ st = fetch_uri(uri_meta->str, nvdcve_meta->str, verbose, this_percent, this_percent, cacert_file);
|
||||
if (st == FETCH_STATUS_FAIL) {
|
||||
fprintf(stderr, "Failed to fetch %s\n", uri_meta->str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Fetch NVD XML file */
|
||||
- st = fetch_uri(uri_data_gz->str, nvdcve_data_gz->str, verbose, this_percent, next_percent);
|
||||
+ st = fetch_uri(uri_data_gz->str, nvdcve_data_gz->str, verbose, this_percent, next_percent, cacert_file);
|
||||
switch (st) {
|
||||
case FETCH_STATUS_FAIL:
|
||||
fprintf(stderr, "Failed to fetch %s\n", uri_data_gz->str);
|
||||
@@ -391,7 +392,7 @@ refetch:
|
||||
return 0;
|
||||
}
|
||||
|
||||
-bool update_db(bool quiet, const char *db_file)
|
||||
+bool update_db(bool quiet, const char *db_file, const char *cacert_file)
|
||||
{
|
||||
autofree(char) *db_dir = NULL;
|
||||
autofree(CveDB) *cve_db = NULL;
|
||||
@@ -466,7 +467,8 @@ bool update_db(bool quiet, const char *db_file)
|
||||
if (!quiet)
|
||||
fprintf(stderr, "completed: %u%%\r", start_percent);
|
||||
rc = do_fetch_update(y, db_dir, cve_db, db_exist, !quiet,
|
||||
- start_percent, end_percent);
|
||||
+ start_percent, end_percent,
|
||||
+ cacert_file);
|
||||
switch (rc) {
|
||||
case 0:
|
||||
if (!quiet)
|
||||
diff --git a/src/update.h b/src/update.h
|
||||
index b8e9911..ceea0c3 100644
|
||||
--- a/src/update.h
|
||||
+++ b/src/update.h
|
||||
@@ -15,7 +15,7 @@ cve_string *get_db_path(const char *path);
|
||||
|
||||
int update_required(const char *db_file);
|
||||
|
||||
-bool update_db(bool quiet, const char *db_file);
|
||||
+bool update_db(bool quiet, const char *db_file, const char *cacert_file);
|
||||
|
||||
|
||||
/*
|
||||
--
|
||||
2.1.4
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
From e9ed26cde63f8ca7607a010a518329339f8c02d3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net>
|
||||
Date: Mon, 26 Sep 2016 12:12:41 +0100
|
||||
Subject: [PATCH] print progress in percent when downloading CVE db
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: André Draszik <git@andred.net>
|
||||
---
|
||||
src/library/fetch.c | 28 +++++++++++++++++++++++++++-
|
||||
src/library/fetch.h | 3 ++-
|
||||
src/update.c | 16 ++++++++++++----
|
||||
3 files changed, 41 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/library/fetch.c b/src/library/fetch.c
|
||||
index 06d4b30..0fe6d76 100644
|
||||
--- a/src/library/fetch.c
|
||||
+++ b/src/library/fetch.c
|
||||
@@ -37,13 +37,37 @@ static size_t write_func(void *ptr, size_t size, size_t nmemb, struct fetch_t *f
|
||||
return fwrite(ptr, size, nmemb, f->f);
|
||||
}
|
||||
|
||||
-FetchStatus fetch_uri(const char *uri, const char *target, bool verbose)
|
||||
+struct percent_t {
|
||||
+ unsigned int start;
|
||||
+ unsigned int end;
|
||||
+};
|
||||
+
|
||||
+static int progress_callback_new(void *ptr, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
+{
|
||||
+ (void) ultotal;
|
||||
+ (void) ulnow;
|
||||
+
|
||||
+ struct percent_t *percent = (struct percent_t *) ptr;
|
||||
+
|
||||
+ if (dltotal && percent && percent->end >= percent->start) {
|
||||
+ unsigned int diff = percent->end - percent->start;
|
||||
+ if (diff) {
|
||||
+ fprintf(stderr,"completed: %"CURL_FORMAT_CURL_OFF_T"%%\r", percent->start + (diff * dlnow / dltotal));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+FetchStatus fetch_uri(const char *uri, const char *target, bool verbose,
|
||||
+ unsigned int start_percent, unsigned int end_percent)
|
||||
{
|
||||
FetchStatus ret = FETCH_STATUS_FAIL;
|
||||
CURLcode res;
|
||||
struct stat st;
|
||||
CURL *curl = NULL;
|
||||
struct fetch_t *f = NULL;
|
||||
+ struct percent_t percent = { .start = start_percent, .end = end_percent };
|
||||
|
||||
curl = curl_easy_init();
|
||||
if (!curl) {
|
||||
@@ -67,6 +91,8 @@ FetchStatus fetch_uri(const char *uri, const char *target, bool verbose)
|
||||
}
|
||||
if (verbose) {
|
||||
(void)curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
|
||||
+ (void)curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &percent);
|
||||
+ (void)curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback_new);
|
||||
}
|
||||
res = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, (curl_write_callback)write_func);
|
||||
if (res != CURLE_OK) {
|
||||
diff --git a/src/library/fetch.h b/src/library/fetch.h
|
||||
index 70c3779..4cce5d1 100644
|
||||
--- a/src/library/fetch.h
|
||||
+++ b/src/library/fetch.h
|
||||
@@ -28,7 +28,8 @@ typedef enum {
|
||||
* @param verbose Whether to be verbose
|
||||
* @return A FetchStatus, indicating the operation taken
|
||||
*/
|
||||
-FetchStatus fetch_uri(const char *uri, const char *target, bool verbose);
|
||||
+FetchStatus fetch_uri(const char *uri, const char *target, bool verbose,
|
||||
+ unsigned int this_percent, unsigned int next_percent);
|
||||
|
||||
/**
|
||||
* Attempt to extract the given gzipped file
|
||||
diff --git a/src/update.c b/src/update.c
|
||||
index 30fbe96..eaeeefd 100644
|
||||
--- a/src/update.c
|
||||
+++ b/src/update.c
|
||||
@@ -266,7 +266,8 @@ static inline void update_end(int fd, const char *update_fname, bool ok)
|
||||
}
|
||||
|
||||
static int do_fetch_update(int year, const char *db_dir, CveDB *cve_db,
|
||||
- bool db_exist, bool verbose)
|
||||
+ bool db_exist, bool verbose,
|
||||
+ unsigned int this_percent, unsigned int next_percent)
|
||||
{
|
||||
const char nvd_uri[] = URI_PREFIX;
|
||||
autofree(cve_string) *uri_meta = NULL;
|
||||
@@ -330,14 +331,14 @@ refetch:
|
||||
}
|
||||
|
||||
/* Fetch NVD META file */
|
||||
- st = fetch_uri(uri_meta->str, nvdcve_meta->str, verbose);
|
||||
+ st = fetch_uri(uri_meta->str, nvdcve_meta->str, verbose, this_percent, this_percent);
|
||||
if (st == FETCH_STATUS_FAIL) {
|
||||
fprintf(stderr, "Failed to fetch %s\n", uri_meta->str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Fetch NVD XML file */
|
||||
- st = fetch_uri(uri_data_gz->str, nvdcve_data_gz->str, verbose);
|
||||
+ st = fetch_uri(uri_data_gz->str, nvdcve_data_gz->str, verbose, this_percent, next_percent);
|
||||
switch (st) {
|
||||
case FETCH_STATUS_FAIL:
|
||||
fprintf(stderr, "Failed to fetch %s\n", uri_data_gz->str);
|
||||
@@ -459,10 +460,17 @@ bool update_db(bool quiet, const char *db_file)
|
||||
for (int i = YEAR_START; i <= year+1; i++) {
|
||||
int y = i > year ? -1 : i;
|
||||
int rc;
|
||||
+ unsigned int start_percent = ((i+0 - YEAR_START) * 100) / (year+2 - YEAR_START);
|
||||
+ unsigned int end_percent = ((i+1 - YEAR_START) * 100) / (year+2 - YEAR_START);
|
||||
|
||||
- rc = do_fetch_update(y, db_dir, cve_db, db_exist, !quiet);
|
||||
+ if (!quiet)
|
||||
+ fprintf(stderr, "completed: %u%%\r", start_percent);
|
||||
+ rc = do_fetch_update(y, db_dir, cve_db, db_exist, !quiet,
|
||||
+ start_percent, end_percent);
|
||||
switch (rc) {
|
||||
case 0:
|
||||
+ if (!quiet)
|
||||
+ fprintf(stderr,"completed: %u%%\r", end_percent);
|
||||
continue;
|
||||
case ENOMEM:
|
||||
goto oom;
|
||||
--
|
||||
2.9.3
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
From b0426e63c9ac61657e029f689bcb8dd051e752c6 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Popovich <popovich_sergei@mail.ua>
|
||||
Date: Fri, 21 Apr 2017 07:32:23 -0700
|
||||
Subject: [PATCH] update: Compare computed vs expected sha256 digit string
|
||||
ignoring case
|
||||
|
||||
We produce sha256 digest string using %x snprintf()
|
||||
qualifier for each byte of digest which uses alphabetic
|
||||
characters from "a" to "f" in lower case to represent
|
||||
integer values from 10 to 15.
|
||||
|
||||
Previously all of the NVD META files supply sha256
|
||||
digest string for corresponding XML file in lower case.
|
||||
|
||||
However due to some reason this changed recently to
|
||||
provide digest digits in upper case causing fetched
|
||||
data consistency checks to fail. This prevents database
|
||||
from being updated periodically.
|
||||
|
||||
While commit c4f6e94 (update: Do not treat sha256 failure
|
||||
as fatal if requested) adds useful option to skip
|
||||
digest validation at all and thus provides workaround for
|
||||
this situation, it might be unacceptable for some
|
||||
deployments where we need to ensure that downloaded
|
||||
data is consistent before start parsing it and update
|
||||
SQLite database.
|
||||
|
||||
Use strcasecmp() to compare two digest strings case
|
||||
insensitively and addressing this case.
|
||||
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Sergey Popovich <popovich_sergei@mail.ua>
|
||||
---
|
||||
src/update.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/update.c b/src/update.c
|
||||
index 8588f38..3cc6b67 100644
|
||||
--- a/src/update.c
|
||||
+++ b/src/update.c
|
||||
@@ -187,7 +187,7 @@ static bool nvdcve_data_ok(const char *meta, const char *data)
|
||||
snprintf(&csum_data[idx], len, "%02hhx", digest[i]);
|
||||
}
|
||||
|
||||
- ret = streq(csum_meta, csum_data);
|
||||
+ ret = !strcasecmp(csum_meta, csum_data);
|
||||
|
||||
err_unmap:
|
||||
munmap(buffer, length);
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From ce64633b9733e962b8d8482244301f614d8b5845 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 22 Aug 2016 22:54:24 -0700
|
||||
Subject: [PATCH] Check for malloc_trim before using it
|
||||
|
||||
malloc_trim is gnu specific and not all libc
|
||||
implement it, threfore write a configure check
|
||||
to poke for it first and use the define to
|
||||
guard its use.
|
||||
|
||||
Helps in compiling on musl based systems
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
Upstream-Status: Submitted [https://github.com/ikeydoherty/cve-check-tool/pull/48]
|
||||
configure.ac | 2 ++
|
||||
src/core.c | 4 ++--
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d3b66ce..79c3542 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -19,6 +19,8 @@ m4_define([json_required_version], [0.16.0])
|
||||
m4_define([openssl_required_version],[1.0.0])
|
||||
# TODO: Set minimum sqlite
|
||||
|
||||
+AC_CHECK_FUNCS_ONCE(malloc_trim)
|
||||
+
|
||||
PKG_CHECK_MODULES(CVE_CHECK_TOOL,
|
||||
[
|
||||
glib-2.0 >= glib_required_version,
|
||||
diff --git a/src/core.c b/src/core.c
|
||||
index 6263031..0d5df29 100644
|
||||
--- a/src/core.c
|
||||
+++ b/src/core.c
|
||||
@@ -498,9 +498,9 @@ bool cve_db_load(CveDB *self, const char *fname)
|
||||
}
|
||||
|
||||
b = true;
|
||||
-
|
||||
+#ifdef HAVE_MALLOC_TRIM
|
||||
malloc_trim(0);
|
||||
-
|
||||
+#endif
|
||||
xmlFreeTextReader(r);
|
||||
if (fd) {
|
||||
close(fd);
|
||||
--
|
||||
2.9.3
|
||||
|
||||
21
meta/recipes-devtools/dpkg/dpkg/pager.patch
Normal file
21
meta/recipes-devtools/dpkg/dpkg/pager.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
pager: Use less instead of pager
|
||||
|
||||
pager is a Debianism. Istead use directly pager.
|
||||
|
||||
Upstream-Status: Inappropriate [OE-Core integration specific]
|
||||
|
||||
Suggested-by: Burton, Ross <ross.burton@intel.com>
|
||||
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
|
||||
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
|
||||
index 2bb067a..6cbce80 100644
|
||||
--- a/lib/dpkg/dpkg.h
|
||||
+++ b/lib/dpkg/dpkg.h
|
||||
@@ -95,7 +95,7 @@ DPKG_BEGIN_DECLS
|
||||
#define MAXUPDATES 250
|
||||
|
||||
#define DEFAULTSHELL "sh"
|
||||
-#define DEFAULTPAGER "pager"
|
||||
+#define DEFAULTPAGER "less"
|
||||
|
||||
#define MD5HASHLEN 32
|
||||
#define MAXTRIGDIRECTIVE 256
|
||||
@@ -13,6 +13,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/d/${BPN}/${BPN}_${PV}.tar.xz \
|
||||
file://0006-add-musleabi-to-known-target-tripets.patch \
|
||||
file://0007-dpkg-deb-build.c-Remove-usage-of-clamp-mtime-in-tar.patch \
|
||||
file://0001-dpkg-Support-muslx32-build.patch \
|
||||
file://pager.patch \
|
||||
"
|
||||
SRC_URI_append_class-native = " file://glibc2.5-sync_file_range.patch \
|
||||
file://tweak-options-require-tar-1.27.patch \
|
||||
|
||||
@@ -72,6 +72,12 @@ SRC_URI = "\
|
||||
file://0039-riscv-Disable-multilib-for-OE.patch \
|
||||
file://0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch \
|
||||
file://0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch \
|
||||
file://0042-PR-debug-86964.patch \
|
||||
file://0043-PR85434-Prevent-spilling-of-stack-protector-guard-s-.patch \
|
||||
file://CVE-2019-14250.patch \
|
||||
file://CVE-2019-15847_p1.patch \
|
||||
file://CVE-2019-15847_p2.patch \
|
||||
file://CVE-2019-15847_p3.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "65b210b4bfe7e060051f799e0f994896"
|
||||
SRC_URI[sha256sum] = "64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c"
|
||||
|
||||
94
meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch
Normal file
94
meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch
Normal file
@@ -0,0 +1,94 @@
|
||||
From beb921e1106b5bcbb0c6e2be84b241327e2ffc51 Mon Sep 17 00:00:00 2001
|
||||
From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Mon, 25 Mar 2019 21:19:09 +0000
|
||||
Subject: [PATCH] PR debug/86964 * dwarf2out.c
|
||||
(premark_used_variables): New function. (prune_unused_types_walk): Do
|
||||
not mark not premarked external variables. (prune_unused_types):
|
||||
Call premark_used_variables.
|
||||
|
||||
* gcc.dg/debug/dwarf2/pr86964.c: New testcase.
|
||||
|
||||
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269925 138bc75d-0d04-0410-961f-82ee72b054a4
|
||||
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
|
||||
---
|
||||
gcc/ChangeLog | 8 ++++++
|
||||
gcc/dwarf2out.c | 32 +++++++++++++++++++++
|
||||
2 files changed, 40 insertions(+)
|
||||
|
||||
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
|
||||
index 2075480ca2b..cdce539ac6f 100644
|
||||
--- a/gcc/ChangeLog
|
||||
+++ b/gcc/ChangeLog
|
||||
@@ -1,3 +1,11 @@
|
||||
+2019-03-25 Johan Karlsson <johan.karlsson@enea.com>
|
||||
+
|
||||
+ PR debug/86964
|
||||
+ * dwarf2out.c (premark_used_variables): New function.
|
||||
+ (prune_unused_types_walk): Do not mark not premarked external
|
||||
+ variables.
|
||||
+ (prune_unused_types): Call premark_used_variables.
|
||||
+
|
||||
2019-02-22 Release Manager
|
||||
|
||||
* GCC 8.3.0 released.
|
||||
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
|
||||
index ae8bdee9981..b9a624e1ac7 100644
|
||||
--- a/gcc/dwarf2out.c
|
||||
+++ b/gcc/dwarf2out.c
|
||||
@@ -22658,6 +22658,21 @@ premark_types_used_by_global_vars (void)
|
||||
->traverse<void *, premark_types_used_by_global_vars_helper> (NULL);
|
||||
}
|
||||
|
||||
+/* Mark all variables used by the symtab as perennial. */
|
||||
+
|
||||
+static void
|
||||
+premark_used_variables (void)
|
||||
+{
|
||||
+ /* Mark DIEs in the symtab as used. */
|
||||
+ varpool_node *var;
|
||||
+ FOR_EACH_VARIABLE (var)
|
||||
+ {
|
||||
+ dw_die_ref die = lookup_decl_die (var->decl);
|
||||
+ if (die)
|
||||
+ die->die_perennial_p = 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Generate a DW_TAG_call_site DIE in function DECL under SUBR_DIE
|
||||
for CA_LOC call arg loc node. */
|
||||
|
||||
@@ -29264,6 +29279,19 @@ prune_unused_types_walk (dw_die_ref die)
|
||||
|
||||
return;
|
||||
|
||||
+ case DW_TAG_variable:
|
||||
+ if (flag_debug_only_used_symbols)
|
||||
+ {
|
||||
+ if (die->die_perennial_p)
|
||||
+ break;
|
||||
+
|
||||
+ /* premark_used_variables marks external variables --- don't mark
|
||||
+ them here. */
|
||||
+ if (get_AT (die, DW_AT_external))
|
||||
+ return;
|
||||
+ }
|
||||
+ /* FALLTHROUGH */
|
||||
+
|
||||
default:
|
||||
/* Mark everything else. */
|
||||
break;
|
||||
@@ -29390,6 +29418,10 @@ prune_unused_types (void)
|
||||
/* Mark types that are used in global variables. */
|
||||
premark_types_used_by_global_vars ();
|
||||
|
||||
+ /* Mark variables used in the symtab. */
|
||||
+ if (flag_debug_only_used_symbols)
|
||||
+ premark_used_variables ();
|
||||
+
|
||||
/* Set the mark on nodes that are actually used. */
|
||||
prune_unused_types_walk (comp_unit_die ());
|
||||
for (node = limbo_die_list; node; node = node->next)
|
||||
--
|
||||
2.21.0
|
||||
@@ -0,0 +1,813 @@
|
||||
From f98495d90ba66f67fe922a4b9229ea787041c418 Mon Sep 17 00:00:00 2001
|
||||
From: thopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Thu, 22 Nov 2018 14:46:17 +0000
|
||||
Subject: [PATCH] PR85434: Prevent spilling of stack protector guard's address
|
||||
on ARM
|
||||
|
||||
In case of high register pressure in PIC mode, address of the stack
|
||||
protector's guard can be spilled on ARM targets as shown in PR85434,
|
||||
thus allowing an attacker to control what the canary would be compared
|
||||
against. ARM does lack stack_protect_set and stack_protect_test insn
|
||||
patterns, defining them does not help as the address is expanded
|
||||
regularly and the patterns only deal with the copy and test of the
|
||||
guard with the canary.
|
||||
|
||||
This problem does not occur for x86 targets because the PIC access and
|
||||
the test can be done in the same instruction. Aarch64 is exempt too
|
||||
because PIC access insn pattern are mov of UNSPEC which prevents it from
|
||||
the second access in the epilogue being CSEd in cse_local pass with the
|
||||
first access in the prologue.
|
||||
|
||||
The approach followed here is to create new "combined" set and test
|
||||
standard pattern names that take the unexpanded guard and do the set or
|
||||
test. This allows the target to use an opaque pattern (eg. using UNSPEC)
|
||||
to hide the individual instructions being generated to the compiler and
|
||||
split the pattern into generic load, compare and branch instruction
|
||||
after register allocator, therefore avoiding any spilling. This is here
|
||||
implemented for the ARM targets. For targets not implementing these new
|
||||
standard pattern names, the existing stack_protect_set and
|
||||
stack_protect_test pattern names are used.
|
||||
|
||||
To be able to split PIC access after register allocation, the functions
|
||||
had to be augmented to force a new PIC register load and to control
|
||||
which register it loads into. This is because sharing the PIC register
|
||||
between prologue and epilogue could lead to spilling due to CSE again
|
||||
which an attacker could use to control what the canary gets compared
|
||||
against.
|
||||
|
||||
2018-11-22 Thomas Preud'homme <thomas.preudhomme@linaro.org>
|
||||
|
||||
gcc/
|
||||
PR target/85434
|
||||
* target-insns.def (stack_protect_combined_set): Define new standard
|
||||
pattern name.
|
||||
(stack_protect_combined_test): Likewise.
|
||||
* cfgexpand.c (stack_protect_prologue): Try new
|
||||
stack_protect_combined_set pattern first.
|
||||
* function.c (stack_protect_epilogue): Try new
|
||||
stack_protect_combined_test pattern first.
|
||||
* config/arm/arm.c (require_pic_register): Add pic_reg and compute_now
|
||||
parameters to control which register to use as PIC register and force
|
||||
reloading PIC register respectively. Insert in the stream of insns if
|
||||
possible.
|
||||
(legitimize_pic_address): Expose above new parameters in prototype and
|
||||
adapt recursive calls accordingly. Use pic_reg if non null instead of
|
||||
cached one.
|
||||
(arm_load_pic_register): Add pic_reg parameter and use it if non null.
|
||||
(arm_legitimize_address): Adapt to new legitimize_pic_address
|
||||
prototype.
|
||||
(thumb_legitimize_address): Likewise.
|
||||
(arm_emit_call_insn): Adapt to require_pic_register prototype change.
|
||||
(arm_expand_prologue): Adapt to arm_load_pic_register prototype change.
|
||||
(thumb1_expand_prologue): Likewise.
|
||||
* config/arm/arm-protos.h (legitimize_pic_address): Adapt to prototype
|
||||
change.
|
||||
(arm_load_pic_register): Likewise.
|
||||
* config/arm/predicated.md (guard_addr_operand): New predicate.
|
||||
(guard_operand): New predicate.
|
||||
* config/arm/arm.md (movsi expander): Adapt to legitimize_pic_address
|
||||
prototype change.
|
||||
(builtin_setjmp_receiver expander): Adapt to thumb1_expand_prologue
|
||||
prototype change.
|
||||
(stack_protect_combined_set): New expander..
|
||||
(stack_protect_combined_set_insn): New insn_and_split pattern.
|
||||
(stack_protect_set_insn): New insn pattern.
|
||||
(stack_protect_combined_test): New expander.
|
||||
(stack_protect_combined_test_insn): New insn_and_split pattern.
|
||||
(arm_stack_protect_test_insn): New insn pattern.
|
||||
* config/arm/thumb1.md (thumb1_stack_protect_test_insn): New insn pattern.
|
||||
* config/arm/unspecs.md (UNSPEC_SP_SET): New unspec.
|
||||
(UNSPEC_SP_TEST): Likewise.
|
||||
* doc/md.texi (stack_protect_combined_set): Document new standard
|
||||
pattern name.
|
||||
(stack_protect_set): Clarify that the operand for guard's address is
|
||||
legal.
|
||||
(stack_protect_combined_test): Document new standard pattern name.
|
||||
(stack_protect_test): Clarify that the operand for guard's address is
|
||||
legal.
|
||||
|
||||
|
||||
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266379 138bc75d-0d04-0410-961f-82ee72b054a4
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2018-12886
|
||||
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
|
||||
---
|
||||
gcc/ChangeLog | 49 ++++++
|
||||
gcc/cfgexpand.c | 17 +++
|
||||
gcc/config/arm/arm-protos.h | 4 +-
|
||||
gcc/config/arm/arm.c | 87 ++++++++---
|
||||
gcc/config/arm/arm.md | 163 +++++++++++++++++++-
|
||||
gcc/config/arm/predicates.md | 17 +++
|
||||
gcc/config/arm/thumb1.md | 13 ++
|
||||
gcc/config/arm/unspecs.md | 3 +
|
||||
gcc/doc/md.texi | 55 ++++++-
|
||||
gcc/function.c | 32 +++-
|
||||
gcc/target-insns.def | 2 +
|
||||
11 files changed, 399 insertions(+), 43 deletions(-)
|
||||
create mode 100644 gcc/testsuite/gcc.target/arm/pr85434.c
|
||||
|
||||
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
|
||||
index e2ebfd34214..fa41e7112e0 100644
|
||||
--- a/gcc/ChangeLog
|
||||
+++ b/gcc/ChangeLog
|
||||
@@ -1537,6 +1537,55 @@
|
||||
* config/arm/neon.md (movv4hf, movv8hf): Refactored to..
|
||||
(mov<mov>): ..this and enable unconditionally.
|
||||
|
||||
+2018-11-22 Thomas Preud'homme <thomas.preudhomme@linaro.org>
|
||||
+
|
||||
+ * target-insns.def (stack_protect_combined_set): Define new standard
|
||||
+ pattern name.
|
||||
+ (stack_protect_combined_test): Likewise.
|
||||
+ * cfgexpand.c (stack_protect_prologue): Try new
|
||||
+ stack_protect_combined_set pattern first.
|
||||
+ * function.c (stack_protect_epilogue): Try new
|
||||
+ stack_protect_combined_test pattern first.
|
||||
+ * config/arm/arm.c (require_pic_register): Add pic_reg and compute_now
|
||||
+ parameters to control which register to use as PIC register and force
|
||||
+ reloading PIC register respectively. Insert in the stream of insns if
|
||||
+ possible.
|
||||
+ (legitimize_pic_address): Expose above new parameters in prototype and
|
||||
+ adapt recursive calls accordingly. Use pic_reg if non null instead of
|
||||
+ cached one.
|
||||
+ (arm_load_pic_register): Add pic_reg parameter and use it if non null.
|
||||
+ (arm_legitimize_address): Adapt to new legitimize_pic_address
|
||||
+ prototype.
|
||||
+ (thumb_legitimize_address): Likewise.
|
||||
+ (arm_emit_call_insn): Adapt to require_pic_register prototype change.
|
||||
+ (arm_expand_prologue): Adapt to arm_load_pic_register prototype change.
|
||||
+ (thumb1_expand_prologue): Likewise.
|
||||
+ * config/arm/arm-protos.h (legitimize_pic_address): Adapt to prototype
|
||||
+ change.
|
||||
+ (arm_load_pic_register): Likewise.
|
||||
+ * config/arm/predicated.md (guard_addr_operand): New predicate.
|
||||
+ (guard_operand): New predicate.
|
||||
+ * config/arm/arm.md (movsi expander): Adapt to legitimize_pic_address
|
||||
+ prototype change.
|
||||
+ (builtin_setjmp_receiver expander): Adapt to thumb1_expand_prologue
|
||||
+ prototype change.
|
||||
+ (stack_protect_combined_set): New expander..
|
||||
+ (stack_protect_combined_set_insn): New insn_and_split pattern.
|
||||
+ (stack_protect_set_insn): New insn pattern.
|
||||
+ (stack_protect_combined_test): New expander.
|
||||
+ (stack_protect_combined_test_insn): New insn_and_split pattern.
|
||||
+ (arm_stack_protect_test_insn): New insn pattern.
|
||||
+ * config/arm/thumb1.md (thumb1_stack_protect_test_insn): New insn pattern.
|
||||
+ * config/arm/unspecs.md (UNSPEC_SP_SET): New unspec.
|
||||
+ (UNSPEC_SP_TEST): Likewise.
|
||||
+ * doc/md.texi (stack_protect_combined_set): Document new standard
|
||||
+ pattern name.
|
||||
+ (stack_protect_set): Clarify that the operand for guard's address is
|
||||
+ legal.
|
||||
+ (stack_protect_combined_test): Document new standard pattern name.
|
||||
+ (stack_protect_test): Clarify that the operand for guard's address is
|
||||
+ legal.
|
||||
+
|
||||
2018-11-22 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
Backport from mainline
|
||||
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
|
||||
index 8fa392fcd8a..21bdcdaeaa3 100644
|
||||
--- a/gcc/cfgexpand.c
|
||||
+++ b/gcc/cfgexpand.c
|
||||
@@ -6185,6 +6185,23 @@ stack_protect_prologue (void)
|
||||
rtx x, y;
|
||||
|
||||
x = expand_normal (crtl->stack_protect_guard);
|
||||
+
|
||||
+ if (targetm.have_stack_protect_combined_set () && guard_decl)
|
||||
+ {
|
||||
+ gcc_assert (DECL_P (guard_decl));
|
||||
+ y = DECL_RTL (guard_decl);
|
||||
+
|
||||
+ /* Allow the target to compute address of Y and copy it to X without
|
||||
+ leaking Y into a register. This combined address + copy pattern
|
||||
+ allows the target to prevent spilling of any intermediate results by
|
||||
+ splitting it after register allocator. */
|
||||
+ if (rtx_insn *insn = targetm.gen_stack_protect_combined_set (x, y))
|
||||
+ {
|
||||
+ emit_insn (insn);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (guard_decl)
|
||||
y = expand_normal (guard_decl);
|
||||
else
|
||||
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
|
||||
index 8d6d2395b84..00f5f16ed02 100644
|
||||
--- a/gcc/config/arm/arm-protos.h
|
||||
+++ b/gcc/config/arm/arm-protos.h
|
||||
@@ -28,7 +28,7 @@ extern enum unwind_info_type arm_except_unwind_info (struct gcc_options *);
|
||||
extern int use_return_insn (int, rtx);
|
||||
extern bool use_simple_return_p (void);
|
||||
extern enum reg_class arm_regno_class (int);
|
||||
-extern void arm_load_pic_register (unsigned long);
|
||||
+extern void arm_load_pic_register (unsigned long, rtx);
|
||||
extern int arm_volatile_func (void);
|
||||
extern void arm_expand_prologue (void);
|
||||
extern void arm_expand_epilogue (bool);
|
||||
@@ -69,7 +69,7 @@ extern int const_ok_for_dimode_op (HOST_WIDE_INT, enum rtx_code);
|
||||
extern int arm_split_constant (RTX_CODE, machine_mode, rtx,
|
||||
HOST_WIDE_INT, rtx, rtx, int);
|
||||
extern int legitimate_pic_operand_p (rtx);
|
||||
-extern rtx legitimize_pic_address (rtx, machine_mode, rtx);
|
||||
+extern rtx legitimize_pic_address (rtx, machine_mode, rtx, rtx, bool);
|
||||
extern rtx legitimize_tls_address (rtx, rtx);
|
||||
extern bool arm_legitimate_address_p (machine_mode, rtx, bool);
|
||||
extern int arm_legitimate_address_outer_p (machine_mode, rtx, RTX_CODE, int);
|
||||
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
|
||||
index 8393f0b87f3..12417de5102 100644
|
||||
--- a/gcc/config/arm/arm.c
|
||||
+++ b/gcc/config/arm/arm.c
|
||||
@@ -7379,21 +7379,34 @@ legitimate_pic_operand_p (rtx x)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-/* Record that the current function needs a PIC register. Initialize
|
||||
- cfun->machine->pic_reg if we have not already done so. */
|
||||
+/* Record that the current function needs a PIC register. If PIC_REG is null,
|
||||
+ a new pseudo is allocated as PIC register, otherwise PIC_REG is used. In
|
||||
+ both case cfun->machine->pic_reg is initialized if we have not already done
|
||||
+ so. COMPUTE_NOW decide whether and where to set the PIC register. If true,
|
||||
+ PIC register is reloaded in the current position of the instruction stream
|
||||
+ irregardless of whether it was loaded before. Otherwise, it is only loaded
|
||||
+ if not already done so (crtl->uses_pic_offset_table is null). Note that
|
||||
+ nonnull PIC_REG is only supported iff COMPUTE_NOW is true and null PIC_REG
|
||||
+ is only supported iff COMPUTE_NOW is false. */
|
||||
|
||||
static void
|
||||
-require_pic_register (void)
|
||||
+require_pic_register (rtx pic_reg, bool compute_now)
|
||||
{
|
||||
+ gcc_assert (compute_now == (pic_reg != NULL_RTX));
|
||||
+
|
||||
/* A lot of the logic here is made obscure by the fact that this
|
||||
routine gets called as part of the rtx cost estimation process.
|
||||
We don't want those calls to affect any assumptions about the real
|
||||
function; and further, we can't call entry_of_function() until we
|
||||
start the real expansion process. */
|
||||
- if (!crtl->uses_pic_offset_table)
|
||||
+ if (!crtl->uses_pic_offset_table || compute_now)
|
||||
{
|
||||
- gcc_assert (can_create_pseudo_p ());
|
||||
+ gcc_assert (can_create_pseudo_p ()
|
||||
+ || (pic_reg != NULL_RTX
|
||||
+ && REG_P (pic_reg)
|
||||
+ && GET_MODE (pic_reg) == Pmode));
|
||||
if (arm_pic_register != INVALID_REGNUM
|
||||
+ && !compute_now
|
||||
&& !(TARGET_THUMB1 && arm_pic_register > LAST_LO_REGNUM))
|
||||
{
|
||||
if (!cfun->machine->pic_reg)
|
||||
@@ -7409,8 +7422,10 @@ require_pic_register (void)
|
||||
{
|
||||
rtx_insn *seq, *insn;
|
||||
|
||||
+ if (pic_reg == NULL_RTX)
|
||||
+ pic_reg = gen_reg_rtx (Pmode);
|
||||
if (!cfun->machine->pic_reg)
|
||||
- cfun->machine->pic_reg = gen_reg_rtx (Pmode);
|
||||
+ cfun->machine->pic_reg = pic_reg;
|
||||
|
||||
/* Play games to avoid marking the function as needing pic
|
||||
if we are being called as part of the cost-estimation
|
||||
@@ -7421,11 +7436,12 @@ require_pic_register (void)
|
||||
start_sequence ();
|
||||
|
||||
if (TARGET_THUMB1 && arm_pic_register != INVALID_REGNUM
|
||||
- && arm_pic_register > LAST_LO_REGNUM)
|
||||
+ && arm_pic_register > LAST_LO_REGNUM
|
||||
+ && !compute_now)
|
||||
emit_move_insn (cfun->machine->pic_reg,
|
||||
gen_rtx_REG (Pmode, arm_pic_register));
|
||||
else
|
||||
- arm_load_pic_register (0UL);
|
||||
+ arm_load_pic_register (0UL, pic_reg);
|
||||
|
||||
seq = get_insns ();
|
||||
end_sequence ();
|
||||
@@ -7438,16 +7454,33 @@ require_pic_register (void)
|
||||
we can't yet emit instructions directly in the final
|
||||
insn stream. Queue the insns on the entry edge, they will
|
||||
be committed after everything else is expanded. */
|
||||
- insert_insn_on_edge (seq,
|
||||
- single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
|
||||
+ if (currently_expanding_to_rtl)
|
||||
+ insert_insn_on_edge (seq,
|
||||
+ single_succ_edge
|
||||
+ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
|
||||
+ else
|
||||
+ emit_insn (seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+/* Legitimize PIC load to ORIG into REG. If REG is NULL, a new pseudo is
|
||||
+ created to hold the result of the load. If not NULL, PIC_REG indicates
|
||||
+ which register to use as PIC register, otherwise it is decided by register
|
||||
+ allocator. COMPUTE_NOW forces the PIC register to be loaded at the current
|
||||
+ location in the instruction stream, irregardless of whether it was loaded
|
||||
+ previously. Note that nonnull PIC_REG is only supported iff COMPUTE_NOW is
|
||||
+ true and null PIC_REG is only supported iff COMPUTE_NOW is false.
|
||||
+
|
||||
+ Returns the register REG into which the PIC load is performed. */
|
||||
+
|
||||
rtx
|
||||
-legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
|
||||
+legitimize_pic_address (rtx orig, machine_mode mode, rtx reg, rtx pic_reg,
|
||||
+ bool compute_now)
|
||||
{
|
||||
+ gcc_assert (compute_now == (pic_reg != NULL_RTX));
|
||||
+
|
||||
if (GET_CODE (orig) == SYMBOL_REF
|
||||
|| GET_CODE (orig) == LABEL_REF)
|
||||
{
|
||||
@@ -7480,9 +7513,12 @@ legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
|
||||
rtx mem;
|
||||
|
||||
/* If this function doesn't have a pic register, create one now. */
|
||||
- require_pic_register ();
|
||||
+ require_pic_register (pic_reg, compute_now);
|
||||
+
|
||||
+ if (pic_reg == NULL_RTX)
|
||||
+ pic_reg = cfun->machine->pic_reg;
|
||||
|
||||
- pat = gen_calculate_pic_address (reg, cfun->machine->pic_reg, orig);
|
||||
+ pat = gen_calculate_pic_address (reg, pic_reg, orig);
|
||||
|
||||
/* Make the MEM as close to a constant as possible. */
|
||||
mem = SET_SRC (pat);
|
||||
@@ -7531,9 +7567,11 @@ legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
|
||||
|
||||
gcc_assert (GET_CODE (XEXP (orig, 0)) == PLUS);
|
||||
|
||||
- base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
|
||||
+ base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg,
|
||||
+ pic_reg, compute_now);
|
||||
offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
|
||||
- base == reg ? 0 : reg);
|
||||
+ base == reg ? 0 : reg, pic_reg,
|
||||
+ compute_now);
|
||||
|
||||
if (CONST_INT_P (offset))
|
||||
{
|
||||
@@ -7633,16 +7671,17 @@ static GTY(()) int pic_labelno;
|
||||
low register. */
|
||||
|
||||
void
|
||||
-arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED)
|
||||
+arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED, rtx pic_reg)
|
||||
{
|
||||
- rtx l1, labelno, pic_tmp, pic_rtx, pic_reg;
|
||||
+ rtx l1, labelno, pic_tmp, pic_rtx;
|
||||
|
||||
if (crtl->uses_pic_offset_table == 0 || TARGET_SINGLE_PIC_BASE)
|
||||
return;
|
||||
|
||||
gcc_assert (flag_pic);
|
||||
|
||||
- pic_reg = cfun->machine->pic_reg;
|
||||
+ if (pic_reg == NULL_RTX)
|
||||
+ pic_reg = cfun->machine->pic_reg;
|
||||
if (TARGET_VXWORKS_RTP)
|
||||
{
|
||||
pic_rtx = gen_rtx_SYMBOL_REF (Pmode, VXWORKS_GOTT_BASE);
|
||||
@@ -8718,7 +8757,8 @@ arm_legitimize_address (rtx x, rtx orig_x, machine_mode mode)
|
||||
{
|
||||
/* We need to find and carefully transform any SYMBOL and LABEL
|
||||
references; so go back to the original address expression. */
|
||||
- rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX);
|
||||
+ rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX, NULL_RTX,
|
||||
+ false /*compute_now*/);
|
||||
|
||||
if (new_x != orig_x)
|
||||
x = new_x;
|
||||
@@ -8786,7 +8826,8 @@ thumb_legitimize_address (rtx x, rtx orig_x, machine_mode mode)
|
||||
{
|
||||
/* We need to find and carefully transform any SYMBOL and LABEL
|
||||
references; so go back to the original address expression. */
|
||||
- rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX);
|
||||
+ rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX, NULL_RTX,
|
||||
+ false /*compute_now*/);
|
||||
|
||||
if (new_x != orig_x)
|
||||
x = new_x;
|
||||
@@ -18074,7 +18115,7 @@ arm_emit_call_insn (rtx pat, rtx addr, bool sibcall)
|
||||
? !targetm.binds_local_p (SYMBOL_REF_DECL (addr))
|
||||
: !SYMBOL_REF_LOCAL_P (addr)))
|
||||
{
|
||||
- require_pic_register ();
|
||||
+ require_pic_register (NULL_RTX, false /*compute_now*/);
|
||||
use_reg (&CALL_INSN_FUNCTION_USAGE (insn), cfun->machine->pic_reg);
|
||||
}
|
||||
|
||||
@@ -22006,7 +22047,7 @@ arm_expand_prologue (void)
|
||||
mask &= THUMB2_WORK_REGS;
|
||||
if (!IS_NESTED (func_type))
|
||||
mask |= (1 << IP_REGNUM);
|
||||
- arm_load_pic_register (mask);
|
||||
+ arm_load_pic_register (mask, NULL_RTX);
|
||||
}
|
||||
|
||||
/* If we are profiling, make sure no instructions are scheduled before
|
||||
@@ -25237,7 +25278,7 @@ thumb1_expand_prologue (void)
|
||||
/* Load the pic register before setting the frame pointer,
|
||||
so we can use r7 as a temporary work register. */
|
||||
if (flag_pic && arm_pic_register != INVALID_REGNUM)
|
||||
- arm_load_pic_register (live_regs_mask);
|
||||
+ arm_load_pic_register (live_regs_mask, NULL_RTX);
|
||||
|
||||
if (!frame_pointer_needed && CALLER_INTERWORKING_SLOT_SIZE > 0)
|
||||
emit_move_insn (gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM),
|
||||
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
|
||||
index c8dc9474b1b..f6196e93168 100644
|
||||
--- a/gcc/config/arm/arm.md
|
||||
+++ b/gcc/config/arm/arm.md
|
||||
@@ -6021,7 +6021,8 @@
|
||||
operands[1] = legitimize_pic_address (operands[1], SImode,
|
||||
(!can_create_pseudo_p ()
|
||||
? operands[0]
|
||||
- : 0));
|
||||
+ : NULL_RTX), NULL_RTX,
|
||||
+ false /*compute_now*/);
|
||||
}
|
||||
"
|
||||
)
|
||||
@@ -6309,7 +6310,7 @@
|
||||
/* r3 is clobbered by set/longjmp, so we can use it as a scratch
|
||||
register. */
|
||||
if (arm_pic_register != INVALID_REGNUM)
|
||||
- arm_load_pic_register (1UL << 3);
|
||||
+ arm_load_pic_register (1UL << 3, NULL_RTX);
|
||||
DONE;
|
||||
}")
|
||||
|
||||
@@ -8634,6 +8635,164 @@
|
||||
(set_attr "conds" "clob")]
|
||||
)
|
||||
|
||||
+;; Named patterns for stack smashing protection.
|
||||
+(define_expand "stack_protect_combined_set"
|
||||
+ [(parallel
|
||||
+ [(set (match_operand:SI 0 "memory_operand" "")
|
||||
+ (unspec:SI [(match_operand:SI 1 "guard_operand" "")]
|
||||
+ UNSPEC_SP_SET))
|
||||
+ (clobber (match_scratch:SI 2 ""))
|
||||
+ (clobber (match_scratch:SI 3 ""))])]
|
||||
+ ""
|
||||
+ ""
|
||||
+)
|
||||
+
|
||||
+;; Use a separate insn from the above expand to be able to have the mem outside
|
||||
+;; the operand #1 when register allocation comes. This is needed to avoid LRA
|
||||
+;; try to reload the guard since we need to control how PIC access is done in
|
||||
+;; the -fpic/-fPIC case (see COMPUTE_NOW parameter when calling
|
||||
+;; legitimize_pic_address ()).
|
||||
+(define_insn_and_split "*stack_protect_combined_set_insn"
|
||||
+ [(set (match_operand:SI 0 "memory_operand" "=m,m")
|
||||
+ (unspec:SI [(mem:SI (match_operand:SI 1 "guard_addr_operand" "X,X"))]
|
||||
+ UNSPEC_SP_SET))
|
||||
+ (clobber (match_scratch:SI 2 "=&l,&r"))
|
||||
+ (clobber (match_scratch:SI 3 "=&l,&r"))]
|
||||
+ ""
|
||||
+ "#"
|
||||
+ "reload_completed"
|
||||
+ [(parallel [(set (match_dup 0) (unspec:SI [(mem:SI (match_dup 2))]
|
||||
+ UNSPEC_SP_SET))
|
||||
+ (clobber (match_dup 2))])]
|
||||
+ "
|
||||
+{
|
||||
+ if (flag_pic)
|
||||
+ {
|
||||
+ /* Forces recomputing of GOT base now. */
|
||||
+ legitimize_pic_address (operands[1], SImode, operands[2], operands[3],
|
||||
+ true /*compute_now*/);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (address_operand (operands[1], SImode))
|
||||
+ operands[2] = operands[1];
|
||||
+ else
|
||||
+ {
|
||||
+ rtx mem = XEXP (force_const_mem (SImode, operands[1]), 0);
|
||||
+ emit_move_insn (operands[2], mem);
|
||||
+ }
|
||||
+ }
|
||||
+}"
|
||||
+ [(set_attr "arch" "t1,32")]
|
||||
+)
|
||||
+
|
||||
+(define_insn "*stack_protect_set_insn"
|
||||
+ [(set (match_operand:SI 0 "memory_operand" "=m,m")
|
||||
+ (unspec:SI [(mem:SI (match_operand:SI 1 "register_operand" "+&l,&r"))]
|
||||
+ UNSPEC_SP_SET))
|
||||
+ (clobber (match_dup 1))]
|
||||
+ ""
|
||||
+ "@
|
||||
+ ldr\\t%1, [%1]\;str\\t%1, %0\;movs\t%1,#0
|
||||
+ ldr\\t%1, [%1]\;str\\t%1, %0\;mov\t%1,#0"
|
||||
+ [(set_attr "length" "8,12")
|
||||
+ (set_attr "conds" "clob,nocond")
|
||||
+ (set_attr "type" "multiple")
|
||||
+ (set_attr "arch" "t1,32")]
|
||||
+)
|
||||
+
|
||||
+(define_expand "stack_protect_combined_test"
|
||||
+ [(parallel
|
||||
+ [(set (pc)
|
||||
+ (if_then_else
|
||||
+ (eq (match_operand:SI 0 "memory_operand" "")
|
||||
+ (unspec:SI [(match_operand:SI 1 "guard_operand" "")]
|
||||
+ UNSPEC_SP_TEST))
|
||||
+ (label_ref (match_operand 2))
|
||||
+ (pc)))
|
||||
+ (clobber (match_scratch:SI 3 ""))
|
||||
+ (clobber (match_scratch:SI 4 ""))
|
||||
+ (clobber (reg:CC CC_REGNUM))])]
|
||||
+ ""
|
||||
+ ""
|
||||
+)
|
||||
+
|
||||
+;; Use a separate insn from the above expand to be able to have the mem outside
|
||||
+;; the operand #1 when register allocation comes. This is needed to avoid LRA
|
||||
+;; try to reload the guard since we need to control how PIC access is done in
|
||||
+;; the -fpic/-fPIC case (see COMPUTE_NOW parameter when calling
|
||||
+;; legitimize_pic_address ()).
|
||||
+(define_insn_and_split "*stack_protect_combined_test_insn"
|
||||
+ [(set (pc)
|
||||
+ (if_then_else
|
||||
+ (eq (match_operand:SI 0 "memory_operand" "m,m")
|
||||
+ (unspec:SI [(mem:SI (match_operand:SI 1 "guard_addr_operand" "X,X"))]
|
||||
+ UNSPEC_SP_TEST))
|
||||
+ (label_ref (match_operand 2))
|
||||
+ (pc)))
|
||||
+ (clobber (match_scratch:SI 3 "=&l,&r"))
|
||||
+ (clobber (match_scratch:SI 4 "=&l,&r"))
|
||||
+ (clobber (reg:CC CC_REGNUM))]
|
||||
+ ""
|
||||
+ "#"
|
||||
+ "reload_completed"
|
||||
+ [(const_int 0)]
|
||||
+{
|
||||
+ rtx eq;
|
||||
+
|
||||
+ if (flag_pic)
|
||||
+ {
|
||||
+ /* Forces recomputing of GOT base now. */
|
||||
+ legitimize_pic_address (operands[1], SImode, operands[3], operands[4],
|
||||
+ true /*compute_now*/);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (address_operand (operands[1], SImode))
|
||||
+ operands[3] = operands[1];
|
||||
+ else
|
||||
+ {
|
||||
+ rtx mem = XEXP (force_const_mem (SImode, operands[1]), 0);
|
||||
+ emit_move_insn (operands[3], mem);
|
||||
+ }
|
||||
+ }
|
||||
+ if (TARGET_32BIT)
|
||||
+ {
|
||||
+ emit_insn (gen_arm_stack_protect_test_insn (operands[4], operands[0],
|
||||
+ operands[3]));
|
||||
+ rtx cc_reg = gen_rtx_REG (CC_Zmode, CC_REGNUM);
|
||||
+ eq = gen_rtx_EQ (CC_Zmode, cc_reg, const0_rtx);
|
||||
+ emit_jump_insn (gen_arm_cond_branch (operands[2], eq, cc_reg));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ emit_insn (gen_thumb1_stack_protect_test_insn (operands[4], operands[0],
|
||||
+ operands[3]));
|
||||
+ eq = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
|
||||
+ emit_jump_insn (gen_cbranchsi4 (eq, operands[4], const0_rtx,
|
||||
+ operands[2]));
|
||||
+ }
|
||||
+ DONE;
|
||||
+}
|
||||
+ [(set_attr "arch" "t1,32")]
|
||||
+)
|
||||
+
|
||||
+(define_insn "arm_stack_protect_test_insn"
|
||||
+ [(set (reg:CC_Z CC_REGNUM)
|
||||
+ (compare:CC_Z (unspec:SI [(match_operand:SI 1 "memory_operand" "m,m")
|
||||
+ (mem:SI (match_operand:SI 2 "register_operand" "+l,r"))]
|
||||
+ UNSPEC_SP_TEST)
|
||||
+ (const_int 0)))
|
||||
+ (clobber (match_operand:SI 0 "register_operand" "=&l,&r"))
|
||||
+ (clobber (match_dup 2))]
|
||||
+ "TARGET_32BIT"
|
||||
+ "ldr\t%0, [%2]\;ldr\t%2, %1\;eors\t%0, %2, %0"
|
||||
+ [(set_attr "length" "8,12")
|
||||
+ (set_attr "conds" "set")
|
||||
+ (set_attr "type" "multiple")
|
||||
+ (set_attr "arch" "t,32")]
|
||||
+)
|
||||
+
|
||||
(define_expand "casesi"
|
||||
[(match_operand:SI 0 "s_register_operand" "") ; index to jump on
|
||||
(match_operand:SI 1 "const_int_operand" "") ; lower bound
|
||||
diff --git a/gcc/config/arm/predicates.md b/gcc/config/arm/predicates.md
|
||||
index 7e198f9bce4..69718ee9c7a 100644
|
||||
--- a/gcc/config/arm/predicates.md
|
||||
+++ b/gcc/config/arm/predicates.md
|
||||
@@ -31,6 +31,23 @@
|
||||
|| REGNO_REG_CLASS (REGNO (op)) != NO_REGS));
|
||||
})
|
||||
|
||||
+; Predicate for stack protector guard's address in
|
||||
+; stack_protect_combined_set_insn and stack_protect_combined_test_insn patterns
|
||||
+(define_predicate "guard_addr_operand"
|
||||
+ (match_test "true")
|
||||
+{
|
||||
+ return (CONSTANT_ADDRESS_P (op)
|
||||
+ || !targetm.cannot_force_const_mem (mode, op));
|
||||
+})
|
||||
+
|
||||
+; Predicate for stack protector guard in stack_protect_combined_set and
|
||||
+; stack_protect_combined_test patterns
|
||||
+(define_predicate "guard_operand"
|
||||
+ (match_code "mem")
|
||||
+{
|
||||
+ return guard_addr_operand (XEXP (op, 0), mode);
|
||||
+})
|
||||
+
|
||||
(define_predicate "imm_for_neon_inv_logic_operand"
|
||||
(match_code "const_vector")
|
||||
{
|
||||
diff --git a/gcc/config/arm/thumb1.md b/gcc/config/arm/thumb1.md
|
||||
index 19dcdbcdd73..cd199c9c529 100644
|
||||
--- a/gcc/config/arm/thumb1.md
|
||||
+++ b/gcc/config/arm/thumb1.md
|
||||
@@ -1962,4 +1962,17 @@
|
||||
}"
|
||||
[(set_attr "type" "mov_reg")]
|
||||
)
|
||||
+
|
||||
+(define_insn "thumb1_stack_protect_test_insn"
|
||||
+ [(set (match_operand:SI 0 "register_operand" "=&l")
|
||||
+ (unspec:SI [(match_operand:SI 1 "memory_operand" "m")
|
||||
+ (mem:SI (match_operand:SI 2 "register_operand" "+l"))]
|
||||
+ UNSPEC_SP_TEST))
|
||||
+ (clobber (match_dup 2))]
|
||||
+ "TARGET_THUMB1"
|
||||
+ "ldr\t%0, [%2]\;ldr\t%2, %1\;eors\t%0, %2, %0"
|
||||
+ [(set_attr "length" "8")
|
||||
+ (set_attr "conds" "set")
|
||||
+ (set_attr "type" "multiple")]
|
||||
+)
|
||||
|
||||
diff --git a/gcc/config/arm/unspecs.md b/gcc/config/arm/unspecs.md
|
||||
index 19416736ef9..8f9dbcb08dc 100644
|
||||
--- a/gcc/config/arm/unspecs.md
|
||||
+++ b/gcc/config/arm/unspecs.md
|
||||
@@ -86,6 +86,9 @@
|
||||
UNSPEC_PROBE_STACK ; Probe stack memory reference
|
||||
UNSPEC_NONSECURE_MEM ; Represent non-secure memory in ARMv8-M with
|
||||
; security extension
|
||||
+ UNSPEC_SP_SET ; Represent the setting of stack protector's canary
|
||||
+ UNSPEC_SP_TEST ; Represent the testing of stack protector's canary
|
||||
+ ; against the guard.
|
||||
])
|
||||
|
||||
(define_c_enum "unspec" [
|
||||
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
|
||||
index 295fc1f1143..895309b2f3c 100644
|
||||
--- a/gcc/doc/md.texi
|
||||
+++ b/gcc/doc/md.texi
|
||||
@@ -7450,22 +7450,61 @@ builtins.
|
||||
The get/set patterns have a single output/input operand respectively,
|
||||
with @var{mode} intended to be @code{Pmode}.
|
||||
|
||||
+@cindex @code{stack_protect_combined_set} instruction pattern
|
||||
+@item @samp{stack_protect_combined_set}
|
||||
+This pattern, if defined, moves a @code{ptr_mode} value from an address
|
||||
+whose declaration RTX is given in operand 1 to the memory in operand 0
|
||||
+without leaving the value in a register afterward. If several
|
||||
+instructions are needed by the target to perform the operation (eg. to
|
||||
+load the address from a GOT entry then load the @code{ptr_mode} value
|
||||
+and finally store it), it is the backend's responsibility to ensure no
|
||||
+intermediate result gets spilled. This is to avoid leaking the value
|
||||
+some place that an attacker might use to rewrite the stack guard slot
|
||||
+after having clobbered it.
|
||||
+
|
||||
+If this pattern is not defined, then the address declaration is
|
||||
+expanded first in the standard way and a @code{stack_protect_set}
|
||||
+pattern is then generated to move the value from that address to the
|
||||
+address in operand 0.
|
||||
+
|
||||
@cindex @code{stack_protect_set} instruction pattern
|
||||
@item @samp{stack_protect_set}
|
||||
-This pattern, if defined, moves a @code{ptr_mode} value from the memory
|
||||
-in operand 1 to the memory in operand 0 without leaving the value in
|
||||
-a register afterward. This is to avoid leaking the value some place
|
||||
-that an attacker might use to rewrite the stack guard slot after
|
||||
-having clobbered it.
|
||||
+This pattern, if defined, moves a @code{ptr_mode} value from the valid
|
||||
+memory location in operand 1 to the memory in operand 0 without leaving
|
||||
+the value in a register afterward. This is to avoid leaking the value
|
||||
+some place that an attacker might use to rewrite the stack guard slot
|
||||
+after having clobbered it.
|
||||
+
|
||||
+Note: on targets where the addressing modes do not allow to load
|
||||
+directly from stack guard address, the address is expanded in a standard
|
||||
+way first which could cause some spills.
|
||||
|
||||
If this pattern is not defined, then a plain move pattern is generated.
|
||||
|
||||
+@cindex @code{stack_protect_combined_test} instruction pattern
|
||||
+@item @samp{stack_protect_combined_test}
|
||||
+This pattern, if defined, compares a @code{ptr_mode} value from an
|
||||
+address whose declaration RTX is given in operand 1 with the memory in
|
||||
+operand 0 without leaving the value in a register afterward and
|
||||
+branches to operand 2 if the values were equal. If several
|
||||
+instructions are needed by the target to perform the operation (eg. to
|
||||
+load the address from a GOT entry then load the @code{ptr_mode} value
|
||||
+and finally store it), it is the backend's responsibility to ensure no
|
||||
+intermediate result gets spilled. This is to avoid leaking the value
|
||||
+some place that an attacker might use to rewrite the stack guard slot
|
||||
+after having clobbered it.
|
||||
+
|
||||
+If this pattern is not defined, then the address declaration is
|
||||
+expanded first in the standard way and a @code{stack_protect_test}
|
||||
+pattern is then generated to compare the value from that address to the
|
||||
+value at the memory in operand 0.
|
||||
+
|
||||
@cindex @code{stack_protect_test} instruction pattern
|
||||
@item @samp{stack_protect_test}
|
||||
This pattern, if defined, compares a @code{ptr_mode} value from the
|
||||
-memory in operand 1 with the memory in operand 0 without leaving the
|
||||
-value in a register afterward and branches to operand 2 if the values
|
||||
-were equal.
|
||||
+valid memory location in operand 1 with the memory in operand 0 without
|
||||
+leaving the value in a register afterward and branches to operand 2 if
|
||||
+the values were equal.
|
||||
|
||||
If this pattern is not defined, then a plain compare pattern and
|
||||
conditional branch pattern is used.
|
||||
diff --git a/gcc/function.c b/gcc/function.c
|
||||
index 85a5d9f43f7..69523c1d723 100644
|
||||
--- a/gcc/function.c
|
||||
+++ b/gcc/function.c
|
||||
@@ -4937,18 +4937,34 @@ stack_protect_epilogue (void)
|
||||
tree guard_decl = targetm.stack_protect_guard ();
|
||||
rtx_code_label *label = gen_label_rtx ();
|
||||
rtx x, y;
|
||||
- rtx_insn *seq;
|
||||
+ rtx_insn *seq = NULL;
|
||||
|
||||
x = expand_normal (crtl->stack_protect_guard);
|
||||
- if (guard_decl)
|
||||
- y = expand_normal (guard_decl);
|
||||
+
|
||||
+ if (targetm.have_stack_protect_combined_test () && guard_decl)
|
||||
+ {
|
||||
+ gcc_assert (DECL_P (guard_decl));
|
||||
+ y = DECL_RTL (guard_decl);
|
||||
+ /* Allow the target to compute address of Y and compare it with X without
|
||||
+ leaking Y into a register. This combined address + compare pattern
|
||||
+ allows the target to prevent spilling of any intermediate results by
|
||||
+ splitting it after register allocator. */
|
||||
+ seq = targetm.gen_stack_protect_combined_test (x, y, label);
|
||||
+ }
|
||||
else
|
||||
- y = const0_rtx;
|
||||
+ {
|
||||
+ if (guard_decl)
|
||||
+ y = expand_normal (guard_decl);
|
||||
+ else
|
||||
+ y = const0_rtx;
|
||||
+
|
||||
+ /* Allow the target to compare Y with X without leaking either into
|
||||
+ a register. */
|
||||
+ if (targetm.have_stack_protect_test ())
|
||||
+ seq = targetm.gen_stack_protect_test (x, y, label);
|
||||
+ }
|
||||
|
||||
- /* Allow the target to compare Y with X without leaking either into
|
||||
- a register. */
|
||||
- if (targetm.have_stack_protect_test ()
|
||||
- && ((seq = targetm.gen_stack_protect_test (x, y, label)) != NULL_RTX))
|
||||
+ if (seq)
|
||||
emit_insn (seq);
|
||||
else
|
||||
emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
|
||||
diff --git a/gcc/target-insns.def b/gcc/target-insns.def
|
||||
index 9a552c3d11c..d39889b3522 100644
|
||||
--- a/gcc/target-insns.def
|
||||
+++ b/gcc/target-insns.def
|
||||
@@ -96,7 +96,9 @@ DEF_TARGET_INSN (sibcall_value, (rtx x0, rtx x1, rtx opt2, rtx opt3,
|
||||
DEF_TARGET_INSN (simple_return, (void))
|
||||
DEF_TARGET_INSN (split_stack_prologue, (void))
|
||||
DEF_TARGET_INSN (split_stack_space_check, (rtx x0, rtx x1))
|
||||
+DEF_TARGET_INSN (stack_protect_combined_set, (rtx x0, rtx x1))
|
||||
DEF_TARGET_INSN (stack_protect_set, (rtx x0, rtx x1))
|
||||
+DEF_TARGET_INSN (stack_protect_combined_test, (rtx x0, rtx x1, rtx x2))
|
||||
DEF_TARGET_INSN (stack_protect_test, (rtx x0, rtx x1, rtx x2))
|
||||
DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2))
|
||||
DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1))
|
||||
--
|
||||
2.21.0
|
||||
44
meta/recipes-devtools/gcc/gcc-8.3/CVE-2019-14250.patch
Normal file
44
meta/recipes-devtools/gcc/gcc-8.3/CVE-2019-14250.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From a4f1b58eb48b349a5f353bc69c30be553506d33b Mon Sep 17 00:00:00 2001
|
||||
From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Thu, 25 Jul 2019 10:48:26 +0000
|
||||
Subject: [PATCH] 2019-07-25 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR lto/90924
|
||||
Backport from mainline
|
||||
2019-07-12 Ren Kimura <rkx1209dev@gmail.com>
|
||||
|
||||
* simple-object-elf.c (simple_object_elf_match): Check zero value
|
||||
shstrndx.
|
||||
|
||||
|
||||
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273794 138bc75d-0d04-0410-961f-82ee72b054a4
|
||||
|
||||
Upstream-Status: Backport
|
||||
Affectes: < 9.2
|
||||
CVE: CVE-2019-14250
|
||||
Dropped changelog
|
||||
Signed-off-by: Armin Kuster <Akustre@mvista.com>
|
||||
|
||||
---
|
||||
libiberty/simple-object-elf.c | 8 ++++++++
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
Index: gcc-8.2.0/libiberty/simple-object-elf.c
|
||||
===================================================================
|
||||
--- gcc-8.2.0.orig/libiberty/simple-object-elf.c
|
||||
+++ gcc-8.2.0/libiberty/simple-object-elf.c
|
||||
@@ -549,6 +549,14 @@ simple_object_elf_match (unsigned char h
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ if (eor->shstrndx == 0)
|
||||
+ {
|
||||
+ *errmsg = "invalid ELF shstrndx == 0";
|
||||
+ *err = 0;
|
||||
+ XDELETE (eor);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
return (void *) eor;
|
||||
}
|
||||
|
||||
521
meta/recipes-devtools/gcc/gcc-8.3/CVE-2019-15847_p1.patch
Normal file
521
meta/recipes-devtools/gcc/gcc-8.3/CVE-2019-15847_p1.patch
Normal file
@@ -0,0 +1,521 @@
|
||||
From baf7c861e1cc523425029dcf81467f16c734fbd5 Mon Sep 17 00:00:00 2001
|
||||
From: segher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Fri, 30 Aug 2019 14:13:51 +0000
|
||||
Subject: [PATCH 1/3] Backport from trunk 2019-08-22 Segher Boessenkool
|
||||
<segher@kernel.crashing.org>
|
||||
|
||||
* config/rs6000/altivec.md (unspec): Delete UNSPEC_DARN, UNSPEC_DARN_32,
|
||||
UNSPEC_DARN_RAW, UNSPEC_CMPRB, UNSPEC_CMPRB2, UNSPEC_CMPEQB; move to...
|
||||
* config/rs6000/rs6000.md (unspec): ... here.
|
||||
* config/rs6000/altivec.md (darn_32, darn_raw, darn, cmprb,
|
||||
*cmprb_internal, setb_signed, setb_unsigned, cmprb2, *cmprb2_internal,
|
||||
cmpeqb, *cmpeqb_internal): Delete, move to...
|
||||
* config/rs6000/rs6000.md (darn_32, darn_raw, darn, cmprb,
|
||||
*cmprb_internal, setb_signed, setb_unsigned, cmprb2, *cmprb2_internal,
|
||||
cmpeqb, *cmpeqb_internal): ... here.
|
||||
|
||||
|
||||
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275180 138bc75d-0d04-0410-961f-82ee72b054a4
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2019-14847 p1
|
||||
Affects <= 9.2.0
|
||||
Dropped Changelog changes
|
||||
Signed-off-by: Armin Kuster <akuster@mvista.com>
|
||||
|
||||
---
|
||||
gcc/config/rs6000/altivec.md | 223 ------------------------------------------
|
||||
gcc/config/rs6000/rs6000.md | 224 +++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 239 insertions(+), 223 deletions(-)
|
||||
|
||||
Index: gcc-8.3.0/gcc/config/rs6000/altivec.md
|
||||
===================================================================
|
||||
--- gcc-8.3.0.orig/gcc/config/rs6000/altivec.md
|
||||
+++ gcc-8.3.0/gcc/config/rs6000/altivec.md
|
||||
@@ -80,9 +80,6 @@
|
||||
UNSPEC_VUPKHPX
|
||||
UNSPEC_VUPKLPX
|
||||
UNSPEC_CONVERT_4F32_8I16
|
||||
- UNSPEC_DARN
|
||||
- UNSPEC_DARN_32
|
||||
- UNSPEC_DARN_RAW
|
||||
UNSPEC_DST
|
||||
UNSPEC_DSTT
|
||||
UNSPEC_DSTST
|
||||
@@ -161,9 +158,6 @@
|
||||
UNSPEC_BCDADD
|
||||
UNSPEC_BCDSUB
|
||||
UNSPEC_BCD_OVERFLOW
|
||||
- UNSPEC_CMPRB
|
||||
- UNSPEC_CMPRB2
|
||||
- UNSPEC_CMPEQB
|
||||
UNSPEC_VRLMI
|
||||
UNSPEC_VRLNM
|
||||
])
|
||||
@@ -4317,223 +4311,6 @@
|
||||
[(set_attr "length" "4")
|
||||
(set_attr "type" "vecsimple")])
|
||||
|
||||
-(define_insn "darn_32"
|
||||
- [(set (match_operand:SI 0 "register_operand" "=r")
|
||||
- (unspec:SI [(const_int 0)] UNSPEC_DARN_32))]
|
||||
- "TARGET_P9_MISC"
|
||||
- "darn %0,0"
|
||||
- [(set_attr "type" "integer")])
|
||||
-
|
||||
-(define_insn "darn_raw"
|
||||
- [(set (match_operand:DI 0 "register_operand" "=r")
|
||||
- (unspec:DI [(const_int 0)] UNSPEC_DARN_RAW))]
|
||||
- "TARGET_P9_MISC && TARGET_64BIT"
|
||||
- "darn %0,2"
|
||||
- [(set_attr "type" "integer")])
|
||||
-
|
||||
-(define_insn "darn"
|
||||
- [(set (match_operand:DI 0 "register_operand" "=r")
|
||||
- (unspec:DI [(const_int 0)] UNSPEC_DARN))]
|
||||
- "TARGET_P9_MISC && TARGET_64BIT"
|
||||
- "darn %0,1"
|
||||
- [(set_attr "type" "integer")])
|
||||
-
|
||||
-;; Test byte within range.
|
||||
-;;
|
||||
-;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
-;; represents a byte whose value is ignored in this context and
|
||||
-;; vv, the least significant byte, holds the byte value that is to
|
||||
-;; be tested for membership within the range specified by operand 2.
|
||||
-;; The bytes of operand 2 are organized as xx:xx:hi:lo.
|
||||
-;;
|
||||
-;; Return in target register operand 0 a value of 1 if lo <= vv and
|
||||
-;; vv <= hi. Otherwise, set register operand 0 to 0.
|
||||
-;;
|
||||
-;; Though the instructions to which this expansion maps operate on
|
||||
-;; 64-bit registers, the current implementation only operates on
|
||||
-;; SI-mode operands as the high-order bits provide no information
|
||||
-;; that is not already available in the low-order bits. To avoid the
|
||||
-;; costs of data widening operations, future enhancements might allow
|
||||
-;; DI mode for operand 0 and/or might allow operand 1 to be QI mode.
|
||||
-(define_expand "cmprb"
|
||||
- [(set (match_dup 3)
|
||||
- (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
- (match_operand:SI 2 "gpc_reg_operand" "r")]
|
||||
- UNSPEC_CMPRB))
|
||||
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
- (if_then_else:SI (lt (match_dup 3)
|
||||
- (const_int 0))
|
||||
- (const_int -1)
|
||||
- (if_then_else (gt (match_dup 3)
|
||||
- (const_int 0))
|
||||
- (const_int 1)
|
||||
- (const_int 0))))]
|
||||
- "TARGET_P9_MISC"
|
||||
-{
|
||||
- operands[3] = gen_reg_rtx (CCmode);
|
||||
-})
|
||||
-
|
||||
-;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
-;; represents a byte whose value is ignored in this context and
|
||||
-;; vv, the least significant byte, holds the byte value that is to
|
||||
-;; be tested for membership within the range specified by operand 2.
|
||||
-;; The bytes of operand 2 are organized as xx:xx:hi:lo.
|
||||
-;;
|
||||
-;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if
|
||||
-;; lo <= vv and vv <= hi. Otherwise, set the GT bit to 0. The other
|
||||
-;; 3 bits of the target CR register are all set to 0.
|
||||
-(define_insn "*cmprb_internal"
|
||||
- [(set (match_operand:CC 0 "cc_reg_operand" "=y")
|
||||
- (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
- (match_operand:SI 2 "gpc_reg_operand" "r")]
|
||||
- UNSPEC_CMPRB))]
|
||||
- "TARGET_P9_MISC"
|
||||
- "cmprb %0,0,%1,%2"
|
||||
- [(set_attr "type" "logical")])
|
||||
-
|
||||
-;; Set operand 0 register to -1 if the LT bit (0x8) of condition
|
||||
-;; register operand 1 is on. Otherwise, set operand 0 register to 1
|
||||
-;; if the GT bit (0x4) of condition register operand 1 is on.
|
||||
-;; Otherwise, set operand 0 to 0. Note that the result stored into
|
||||
-;; register operand 0 is non-zero iff either the LT or GT bits are on
|
||||
-;; within condition register operand 1.
|
||||
-(define_insn "setb_signed"
|
||||
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
- (if_then_else:SI (lt (match_operand:CC 1 "cc_reg_operand" "y")
|
||||
- (const_int 0))
|
||||
- (const_int -1)
|
||||
- (if_then_else (gt (match_dup 1)
|
||||
- (const_int 0))
|
||||
- (const_int 1)
|
||||
- (const_int 0))))]
|
||||
- "TARGET_P9_MISC"
|
||||
- "setb %0,%1"
|
||||
- [(set_attr "type" "logical")])
|
||||
-
|
||||
-(define_insn "setb_unsigned"
|
||||
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
- (if_then_else:SI (ltu (match_operand:CCUNS 1 "cc_reg_operand" "y")
|
||||
- (const_int 0))
|
||||
- (const_int -1)
|
||||
- (if_then_else (gtu (match_dup 1)
|
||||
- (const_int 0))
|
||||
- (const_int 1)
|
||||
- (const_int 0))))]
|
||||
- "TARGET_P9_MISC"
|
||||
- "setb %0,%1"
|
||||
- [(set_attr "type" "logical")])
|
||||
-
|
||||
-;; Test byte within two ranges.
|
||||
-;;
|
||||
-;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
-;; represents a byte whose value is ignored in this context and
|
||||
-;; vv, the least significant byte, holds the byte value that is to
|
||||
-;; be tested for membership within the range specified by operand 2.
|
||||
-;; The bytes of operand 2 are organized as hi_1:lo_1:hi_2:lo_2.
|
||||
-;;
|
||||
-;; Return in target register operand 0 a value of 1 if (lo_1 <= vv and
|
||||
-;; vv <= hi_1) or if (lo_2 <= vv and vv <= hi_2). Otherwise, set register
|
||||
-;; operand 0 to 0.
|
||||
-;;
|
||||
-;; Though the instructions to which this expansion maps operate on
|
||||
-;; 64-bit registers, the current implementation only operates on
|
||||
-;; SI-mode operands as the high-order bits provide no information
|
||||
-;; that is not already available in the low-order bits. To avoid the
|
||||
-;; costs of data widening operations, future enhancements might allow
|
||||
-;; DI mode for operand 0 and/or might allow operand 1 to be QI mode.
|
||||
-(define_expand "cmprb2"
|
||||
- [(set (match_dup 3)
|
||||
- (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
- (match_operand:SI 2 "gpc_reg_operand" "r")]
|
||||
- UNSPEC_CMPRB2))
|
||||
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
- (if_then_else:SI (lt (match_dup 3)
|
||||
- (const_int 0))
|
||||
- (const_int -1)
|
||||
- (if_then_else (gt (match_dup 3)
|
||||
- (const_int 0))
|
||||
- (const_int 1)
|
||||
- (const_int 0))))]
|
||||
- "TARGET_P9_MISC"
|
||||
-{
|
||||
- operands[3] = gen_reg_rtx (CCmode);
|
||||
-})
|
||||
-
|
||||
-;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
-;; represents a byte whose value is ignored in this context and
|
||||
-;; vv, the least significant byte, holds the byte value that is to
|
||||
-;; be tested for membership within the ranges specified by operand 2.
|
||||
-;; The bytes of operand 2 are organized as hi_1:lo_1:hi_2:lo_2.
|
||||
-;;
|
||||
-;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if
|
||||
-;; (lo_1 <= vv and vv <= hi_1) or if (lo_2 <= vv and vv <= hi_2).
|
||||
-;; Otherwise, set the GT bit to 0. The other 3 bits of the target
|
||||
-;; CR register are all set to 0.
|
||||
-(define_insn "*cmprb2_internal"
|
||||
- [(set (match_operand:CC 0 "cc_reg_operand" "=y")
|
||||
- (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
- (match_operand:SI 2 "gpc_reg_operand" "r")]
|
||||
- UNSPEC_CMPRB2))]
|
||||
- "TARGET_P9_MISC"
|
||||
- "cmprb %0,1,%1,%2"
|
||||
- [(set_attr "type" "logical")])
|
||||
-
|
||||
-;; Test byte membership within set of 8 bytes.
|
||||
-;;
|
||||
-;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
-;; represents a byte whose value is ignored in this context and
|
||||
-;; vv, the least significant byte, holds the byte value that is to
|
||||
-;; be tested for membership within the set specified by operand 2.
|
||||
-;; The bytes of operand 2 are organized as e0:e1:e2:e3:e4:e5:e6:e7.
|
||||
-;;
|
||||
-;; Return in target register operand 0 a value of 1 if vv equals one
|
||||
-;; of the values e0, e1, e2, e3, e4, e5, e6, or e7. Otherwise, set
|
||||
-;; register operand 0 to 0. Note that the 8 byte values held within
|
||||
-;; operand 2 need not be unique.
|
||||
-;;
|
||||
-;; Though the instructions to which this expansion maps operate on
|
||||
-;; 64-bit registers, the current implementation requires that operands
|
||||
-;; 0 and 1 have mode SI as the high-order bits provide no information
|
||||
-;; that is not already available in the low-order bits. To avoid the
|
||||
-;; costs of data widening operations, future enhancements might allow
|
||||
-;; DI mode for operand 0 and/or might allow operand 1 to be QI mode.
|
||||
-(define_expand "cmpeqb"
|
||||
- [(set (match_dup 3)
|
||||
- (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
- (match_operand:DI 2 "gpc_reg_operand" "r")]
|
||||
- UNSPEC_CMPEQB))
|
||||
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
- (if_then_else:SI (lt (match_dup 3)
|
||||
- (const_int 0))
|
||||
- (const_int -1)
|
||||
- (if_then_else (gt (match_dup 3)
|
||||
- (const_int 0))
|
||||
- (const_int 1)
|
||||
- (const_int 0))))]
|
||||
- "TARGET_P9_MISC && TARGET_64BIT"
|
||||
-{
|
||||
- operands[3] = gen_reg_rtx (CCmode);
|
||||
-})
|
||||
-
|
||||
-;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
-;; represents a byte whose value is ignored in this context and
|
||||
-;; vv, the least significant byte, holds the byte value that is to
|
||||
-;; be tested for membership within the set specified by operand 2.
|
||||
-;; The bytes of operand 2 are organized as e0:e1:e2:e3:e4:e5:e6:e7.
|
||||
-;;
|
||||
-;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if vv
|
||||
-;; equals one of the values e0, e1, e2, e3, e4, e5, e6, or e7. Otherwise,
|
||||
-;; set the GT bit to zero. The other 3 bits of the target CR register
|
||||
-;; are all set to 0.
|
||||
-(define_insn "*cmpeqb_internal"
|
||||
- [(set (match_operand:CC 0 "cc_reg_operand" "=y")
|
||||
- (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
- (match_operand:DI 2 "gpc_reg_operand" "r")]
|
||||
- UNSPEC_CMPEQB))]
|
||||
- "TARGET_P9_MISC && TARGET_64BIT"
|
||||
- "cmpeqb %0,%1,%2"
|
||||
- [(set_attr "type" "logical")])
|
||||
-
|
||||
(define_expand "bcd<bcd_add_sub>_<code>"
|
||||
[(parallel [(set (reg:CCFP CR6_REGNO)
|
||||
(compare:CCFP
|
||||
Index: gcc-8.3.0/gcc/config/rs6000/rs6000.md
|
||||
===================================================================
|
||||
--- gcc-8.3.0.orig/gcc/config/rs6000/rs6000.md
|
||||
+++ gcc-8.3.0/gcc/config/rs6000/rs6000.md
|
||||
@@ -136,6 +136,12 @@
|
||||
UNSPEC_LSQ
|
||||
UNSPEC_FUSION_GPR
|
||||
UNSPEC_STACK_CHECK
|
||||
+ UNSPEC_DARN
|
||||
+ UNSPEC_DARN_32
|
||||
+ UNSPEC_DARN_RAW
|
||||
+ UNSPEC_CMPRB
|
||||
+ UNSPEC_CMPRB2
|
||||
+ UNSPEC_CMPEQB
|
||||
UNSPEC_FUSION_P9
|
||||
UNSPEC_FUSION_ADDIS
|
||||
UNSPEC_ADD_ROUND_TO_ODD
|
||||
@@ -14597,7 +14603,225 @@
|
||||
"xscmpuqp %0,%1,%2"
|
||||
[(set_attr "type" "veccmp")
|
||||
(set_attr "size" "128")])
|
||||
+
|
||||
+;; Miscellaneous ISA 3.0 (power9) instructions
|
||||
+
|
||||
+(define_insn "darn_32"
|
||||
+ [(set (match_operand:SI 0 "register_operand" "=r")
|
||||
+ (unspec:SI [(const_int 0)] UNSPEC_DARN_32))]
|
||||
+ "TARGET_P9_MISC"
|
||||
+ "darn %0,0"
|
||||
+ [(set_attr "type" "integer")])
|
||||
+
|
||||
+(define_insn "darn_raw"
|
||||
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
||||
+ (unspec:DI [(const_int 0)] UNSPEC_DARN_RAW))]
|
||||
+ "TARGET_P9_MISC && TARGET_64BIT"
|
||||
+ "darn %0,2"
|
||||
+ [(set_attr "type" "integer")])
|
||||
+
|
||||
+(define_insn "darn"
|
||||
+ [(set (match_operand:DI 0 "register_operand" "=r")
|
||||
+ (unspec:DI [(const_int 0)] UNSPEC_DARN))]
|
||||
+ "TARGET_P9_MISC && TARGET_64BIT"
|
||||
+ "darn %0,1"
|
||||
+ [(set_attr "type" "integer")])
|
||||
|
||||
+;; Test byte within range.
|
||||
+;;
|
||||
+;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
+;; represents a byte whose value is ignored in this context and
|
||||
+;; vv, the least significant byte, holds the byte value that is to
|
||||
+;; be tested for membership within the range specified by operand 2.
|
||||
+;; The bytes of operand 2 are organized as xx:xx:hi:lo.
|
||||
+;;
|
||||
+;; Return in target register operand 0 a value of 1 if lo <= vv and
|
||||
+;; vv <= hi. Otherwise, set register operand 0 to 0.
|
||||
+;;
|
||||
+;; Though the instructions to which this expansion maps operate on
|
||||
+;; 64-bit registers, the current implementation only operates on
|
||||
+;; SI-mode operands as the high-order bits provide no information
|
||||
+;; that is not already available in the low-order bits. To avoid the
|
||||
+;; costs of data widening operations, future enhancements might allow
|
||||
+;; DI mode for operand 0 and/or might allow operand 1 to be QI mode.
|
||||
+(define_expand "cmprb"
|
||||
+ [(set (match_dup 3)
|
||||
+ (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
+ (match_operand:SI 2 "gpc_reg_operand" "r")]
|
||||
+ UNSPEC_CMPRB))
|
||||
+ (set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
+ (if_then_else:SI (lt (match_dup 3)
|
||||
+ (const_int 0))
|
||||
+ (const_int -1)
|
||||
+ (if_then_else (gt (match_dup 3)
|
||||
+ (const_int 0))
|
||||
+ (const_int 1)
|
||||
+ (const_int 0))))]
|
||||
+ "TARGET_P9_MISC"
|
||||
+{
|
||||
+ operands[3] = gen_reg_rtx (CCmode);
|
||||
+})
|
||||
+
|
||||
+;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
+;; represents a byte whose value is ignored in this context and
|
||||
+;; vv, the least significant byte, holds the byte value that is to
|
||||
+;; be tested for membership within the range specified by operand 2.
|
||||
+;; The bytes of operand 2 are organized as xx:xx:hi:lo.
|
||||
+;;
|
||||
+;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if
|
||||
+;; lo <= vv and vv <= hi. Otherwise, set the GT bit to 0. The other
|
||||
+;; 3 bits of the target CR register are all set to 0.
|
||||
+(define_insn "*cmprb_internal"
|
||||
+ [(set (match_operand:CC 0 "cc_reg_operand" "=y")
|
||||
+ (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
+ (match_operand:SI 2 "gpc_reg_operand" "r")]
|
||||
+ UNSPEC_CMPRB))]
|
||||
+ "TARGET_P9_MISC"
|
||||
+ "cmprb %0,0,%1,%2"
|
||||
+ [(set_attr "type" "logical")])
|
||||
+
|
||||
+;; Set operand 0 register to -1 if the LT bit (0x8) of condition
|
||||
+;; register operand 1 is on. Otherwise, set operand 0 register to 1
|
||||
+;; if the GT bit (0x4) of condition register operand 1 is on.
|
||||
+;; Otherwise, set operand 0 to 0. Note that the result stored into
|
||||
+;; register operand 0 is non-zero iff either the LT or GT bits are on
|
||||
+;; within condition register operand 1.
|
||||
+(define_insn "setb_signed"
|
||||
+ [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
+ (if_then_else:SI (lt (match_operand:CC 1 "cc_reg_operand" "y")
|
||||
+ (const_int 0))
|
||||
+ (const_int -1)
|
||||
+ (if_then_else (gt (match_dup 1)
|
||||
+ (const_int 0))
|
||||
+ (const_int 1)
|
||||
+ (const_int 0))))]
|
||||
+ "TARGET_P9_MISC"
|
||||
+ "setb %0,%1"
|
||||
+ [(set_attr "type" "logical")])
|
||||
+
|
||||
+(define_insn "setb_unsigned"
|
||||
+ [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
+ (if_then_else:SI (ltu (match_operand:CCUNS 1 "cc_reg_operand" "y")
|
||||
+ (const_int 0))
|
||||
+ (const_int -1)
|
||||
+ (if_then_else (gtu (match_dup 1)
|
||||
+ (const_int 0))
|
||||
+ (const_int 1)
|
||||
+ (const_int 0))))]
|
||||
+ "TARGET_P9_MISC"
|
||||
+ "setb %0,%1"
|
||||
+ [(set_attr "type" "logical")])
|
||||
+
|
||||
+;; Test byte within two ranges.
|
||||
+;;
|
||||
+;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
+;; represents a byte whose value is ignored in this context and
|
||||
+;; vv, the least significant byte, holds the byte value that is to
|
||||
+;; be tested for membership within the range specified by operand 2.
|
||||
+;; The bytes of operand 2 are organized as hi_1:lo_1:hi_2:lo_2.
|
||||
+;;
|
||||
+;; Return in target register operand 0 a value of 1 if (lo_1 <= vv and
|
||||
+;; vv <= hi_1) or if (lo_2 <= vv and vv <= hi_2). Otherwise, set register
|
||||
+;; operand 0 to 0.
|
||||
+;;
|
||||
+;; Though the instructions to which this expansion maps operate on
|
||||
+;; 64-bit registers, the current implementation only operates on
|
||||
+;; SI-mode operands as the high-order bits provide no information
|
||||
+;; that is not already available in the low-order bits. To avoid the
|
||||
+;; costs of data widening operations, future enhancements might allow
|
||||
+;; DI mode for operand 0 and/or might allow operand 1 to be QI mode.
|
||||
+(define_expand "cmprb2"
|
||||
+ [(set (match_dup 3)
|
||||
+ (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
+ (match_operand:SI 2 "gpc_reg_operand" "r")]
|
||||
+ UNSPEC_CMPRB2))
|
||||
+ (set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
+ (if_then_else:SI (lt (match_dup 3)
|
||||
+ (const_int 0))
|
||||
+ (const_int -1)
|
||||
+ (if_then_else (gt (match_dup 3)
|
||||
+ (const_int 0))
|
||||
+ (const_int 1)
|
||||
+ (const_int 0))))]
|
||||
+ "TARGET_P9_MISC"
|
||||
+{
|
||||
+ operands[3] = gen_reg_rtx (CCmode);
|
||||
+})
|
||||
+
|
||||
+;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
+;; represents a byte whose value is ignored in this context and
|
||||
+;; vv, the least significant byte, holds the byte value that is to
|
||||
+;; be tested for membership within the ranges specified by operand 2.
|
||||
+;; The bytes of operand 2 are organized as hi_1:lo_1:hi_2:lo_2.
|
||||
+;;
|
||||
+;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if
|
||||
+;; (lo_1 <= vv and vv <= hi_1) or if (lo_2 <= vv and vv <= hi_2).
|
||||
+;; Otherwise, set the GT bit to 0. The other 3 bits of the target
|
||||
+;; CR register are all set to 0.
|
||||
+(define_insn "*cmprb2_internal"
|
||||
+ [(set (match_operand:CC 0 "cc_reg_operand" "=y")
|
||||
+ (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
+ (match_operand:SI 2 "gpc_reg_operand" "r")]
|
||||
+ UNSPEC_CMPRB2))]
|
||||
+ "TARGET_P9_MISC"
|
||||
+ "cmprb %0,1,%1,%2"
|
||||
+ [(set_attr "type" "logical")])
|
||||
+
|
||||
+;; Test byte membership within set of 8 bytes.
|
||||
+;;
|
||||
+;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
+;; represents a byte whose value is ignored in this context and
|
||||
+;; vv, the least significant byte, holds the byte value that is to
|
||||
+;; be tested for membership within the set specified by operand 2.
|
||||
+;; The bytes of operand 2 are organized as e0:e1:e2:e3:e4:e5:e6:e7.
|
||||
+;;
|
||||
+;; Return in target register operand 0 a value of 1 if vv equals one
|
||||
+;; of the values e0, e1, e2, e3, e4, e5, e6, or e7. Otherwise, set
|
||||
+;; register operand 0 to 0. Note that the 8 byte values held within
|
||||
+;; operand 2 need not be unique.
|
||||
+;;
|
||||
+;; Though the instructions to which this expansion maps operate on
|
||||
+;; 64-bit registers, the current implementation requires that operands
|
||||
+;; 0 and 1 have mode SI as the high-order bits provide no information
|
||||
+;; that is not already available in the low-order bits. To avoid the
|
||||
+;; costs of data widening operations, future enhancements might allow
|
||||
+;; DI mode for operand 0 and/or might allow operand 1 to be QI mode.
|
||||
+(define_expand "cmpeqb"
|
||||
+ [(set (match_dup 3)
|
||||
+ (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
+ (match_operand:DI 2 "gpc_reg_operand" "r")]
|
||||
+ UNSPEC_CMPEQB))
|
||||
+ (set (match_operand:SI 0 "gpc_reg_operand" "=r")
|
||||
+ (if_then_else:SI (lt (match_dup 3)
|
||||
+ (const_int 0))
|
||||
+ (const_int -1)
|
||||
+ (if_then_else (gt (match_dup 3)
|
||||
+ (const_int 0))
|
||||
+ (const_int 1)
|
||||
+ (const_int 0))))]
|
||||
+ "TARGET_P9_MISC && TARGET_64BIT"
|
||||
+{
|
||||
+ operands[3] = gen_reg_rtx (CCmode);
|
||||
+})
|
||||
+
|
||||
+;; The bytes of operand 1 are organized as xx:xx:xx:vv, where xx
|
||||
+;; represents a byte whose value is ignored in this context and
|
||||
+;; vv, the least significant byte, holds the byte value that is to
|
||||
+;; be tested for membership within the set specified by operand 2.
|
||||
+;; The bytes of operand 2 are organized as e0:e1:e2:e3:e4:e5:e6:e7.
|
||||
+;;
|
||||
+;; Set bit 1 (the GT bit, 0x4) of CR register operand 0 to 1 if vv
|
||||
+;; equals one of the values e0, e1, e2, e3, e4, e5, e6, or e7. Otherwise,
|
||||
+;; set the GT bit to zero. The other 3 bits of the target CR register
|
||||
+;; are all set to 0.
|
||||
+(define_insn "*cmpeqb_internal"
|
||||
+ [(set (match_operand:CC 0 "cc_reg_operand" "=y")
|
||||
+ (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
|
||||
+ (match_operand:DI 2 "gpc_reg_operand" "r")]
|
||||
+ UNSPEC_CMPEQB))]
|
||||
+ "TARGET_P9_MISC && TARGET_64BIT"
|
||||
+ "cmpeqb %0,%1,%2"
|
||||
+ [(set_attr "type" "logical")])
|
||||
|
||||
|
||||
(include "sync.md")
|
||||
77
meta/recipes-devtools/gcc/gcc-8.3/CVE-2019-15847_p2.patch
Normal file
77
meta/recipes-devtools/gcc/gcc-8.3/CVE-2019-15847_p2.patch
Normal file
@@ -0,0 +1,77 @@
|
||||
From 2d7749ba418adde9536baf0d16d50a072b5841de Mon Sep 17 00:00:00 2001
|
||||
From: segher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Fri, 30 Aug 2019 14:15:39 +0000
|
||||
Subject: [PATCH 2/3] Backport from trunk 2019-08-22 Segher Boessenkool
|
||||
<segher@kernel.crashing.org>
|
||||
|
||||
PR target/91481
|
||||
* config/rs6000/rs6000.md (unspec): Delete UNSPEC_DARN, UNSPEC_DARN_32,
|
||||
and UNSPEC_DARN_RAW.
|
||||
(unspecv): New enumerator values UNSPECV_DARN, UNSPECV_DARN_32, and
|
||||
UNSPECV_DARN_RAW.
|
||||
(darn_32): Use an unspec_volatile, and UNSPECV_DARN_32.
|
||||
(darn_raw): Use an unspec_volatile, and UNSPECV_DARN_RAW.
|
||||
(darn): Use an unspec_volatile, and UNSPECV_DARN.
|
||||
|
||||
|
||||
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275181 138bc75d-0d04-0410-961f-82ee72b054a4
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2019-14847 p2
|
||||
Affects <= 9.2.0
|
||||
Dropped Change log changes
|
||||
Signed-off-by: Armin Kuster <akuster@mvista.com>
|
||||
|
||||
---
|
||||
gcc/config/rs6000/rs6000.md | 12 ++++++------
|
||||
2 files changed, 20 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: gcc-8.3.0/gcc/config/rs6000/rs6000.md
|
||||
===================================================================
|
||||
--- gcc-8.3.0.orig/gcc/config/rs6000/rs6000.md
|
||||
+++ gcc-8.3.0/gcc/config/rs6000/rs6000.md
|
||||
@@ -136,9 +136,6 @@
|
||||
UNSPEC_LSQ
|
||||
UNSPEC_FUSION_GPR
|
||||
UNSPEC_STACK_CHECK
|
||||
- UNSPEC_DARN
|
||||
- UNSPEC_DARN_32
|
||||
- UNSPEC_DARN_RAW
|
||||
UNSPEC_CMPRB
|
||||
UNSPEC_CMPRB2
|
||||
UNSPEC_CMPEQB
|
||||
@@ -168,6 +165,9 @@
|
||||
UNSPECV_EH_RR ; eh_reg_restore
|
||||
UNSPECV_ISYNC ; isync instruction
|
||||
UNSPECV_MFTB ; move from time base
|
||||
+ UNSPECV_DARN ; darn 1 (deliver a random number)
|
||||
+ UNSPECV_DARN_32 ; darn 2
|
||||
+ UNSPECV_DARN_RAW ; darn 0
|
||||
UNSPECV_NLGR ; non-local goto receiver
|
||||
UNSPECV_MFFS ; Move from FPSCR
|
||||
UNSPECV_MTFSF ; Move to FPSCR Fields
|
||||
@@ -14608,21 +14608,21 @@
|
||||
|
||||
(define_insn "darn_32"
|
||||
[(set (match_operand:SI 0 "register_operand" "=r")
|
||||
- (unspec:SI [(const_int 0)] UNSPEC_DARN_32))]
|
||||
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_DARN_32))]
|
||||
"TARGET_P9_MISC"
|
||||
"darn %0,0"
|
||||
[(set_attr "type" "integer")])
|
||||
|
||||
(define_insn "darn_raw"
|
||||
[(set (match_operand:DI 0 "register_operand" "=r")
|
||||
- (unspec:DI [(const_int 0)] UNSPEC_DARN_RAW))]
|
||||
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_DARN_RAW))]
|
||||
"TARGET_P9_MISC && TARGET_64BIT"
|
||||
"darn %0,2"
|
||||
[(set_attr "type" "integer")])
|
||||
|
||||
(define_insn "darn"
|
||||
[(set (match_operand:DI 0 "register_operand" "=r")
|
||||
- (unspec:DI [(const_int 0)] UNSPEC_DARN))]
|
||||
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_DARN))]
|
||||
"TARGET_P9_MISC && TARGET_64BIT"
|
||||
"darn %0,1"
|
||||
[(set_attr "type" "integer")])
|
||||
45
meta/recipes-devtools/gcc/gcc-8.3/CVE-2019-15847_p3.patch
Normal file
45
meta/recipes-devtools/gcc/gcc-8.3/CVE-2019-15847_p3.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 5f8cd14f8966f11e8ed10a4c7e35dc01fffe54d8 Mon Sep 17 00:00:00 2001
|
||||
From: segher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Fri, 30 Aug 2019 14:17:20 +0000
|
||||
Subject: [PATCH 3/3] Backport from trunk 2019-08-23 Segher Boessenkool
|
||||
<segher@kernel.crashing.org>
|
||||
|
||||
gcc/testsuite/
|
||||
PR target/91481
|
||||
* gcc.target/powerpc/darn-3.c: New testcase.
|
||||
|
||||
|
||||
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275182 138bc75d-0d04-0410-961f-82ee72b054a4
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2019-14847 p3
|
||||
Affects <= 9.2.0
|
||||
Dropped Change log changes
|
||||
Signed-off-by: Armin Kuster <akuster@mvista.com>
|
||||
|
||||
---
|
||||
gcc/testsuite/gcc.target/powerpc/darn-3.c | 16 ++++++++++++++++
|
||||
2 files changed, 25 insertions(+)
|
||||
create mode 100644 gcc/testsuite/gcc.target/powerpc/darn-3.c
|
||||
|
||||
Index: gcc-8.3.0/gcc/testsuite/gcc.target/powerpc/darn-3.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ gcc-8.3.0/gcc/testsuite/gcc.target/powerpc/darn-3.c
|
||||
@@ -0,0 +1,16 @@
|
||||
+/* { dg-do compile { target { powerpc*-*-* } } } */
|
||||
+/* { dg-skip-if "" { powerpc*-*-aix* } } */
|
||||
+/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
|
||||
+
|
||||
+static int darn32(void) { return __builtin_darn_32(); }
|
||||
+
|
||||
+int four(void)
|
||||
+{
|
||||
+ int sum = 0;
|
||||
+ int i;
|
||||
+ for (i = 0; i < 4; i++)
|
||||
+ sum += darn32();
|
||||
+ return sum;
|
||||
+}
|
||||
+
|
||||
+/* { dg-final { scan-assembler-times {(?n)\mdarn .*,0\M} 4 } } */
|
||||
@@ -16,6 +16,7 @@ SRC_URI += "\
|
||||
file://0006-cmd-dist-separate-host-and-target-builds.patch \
|
||||
file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
|
||||
file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
|
||||
file://0001-release-branch.go1.12-security-net-textproto-don-t-n.patch \
|
||||
"
|
||||
SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
|
||||
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
From 265b691ac440bfb711d8de323346f7d72e620efe Mon Sep 17 00:00:00 2001
|
||||
From: Filippo Valsorda <filippo@golang.org>
|
||||
Date: Thu, 12 Sep 2019 12:37:36 -0400
|
||||
Subject: [PATCH] [release-branch.go1.12-security] net/textproto: don't
|
||||
normalize headers with spaces before the colon
|
||||
|
||||
RFC 7230 is clear about headers with a space before the colon, like
|
||||
|
||||
X-Answer : 42
|
||||
|
||||
being invalid, but we've been accepting and normalizing them for compatibility
|
||||
purposes since CL 5690059 in 2012.
|
||||
|
||||
On the client side, this is harmless and indeed most browsers behave the same
|
||||
to this day. On the server side, this becomes a security issue when the
|
||||
behavior doesn't match that of a reverse proxy sitting in front of the server.
|
||||
|
||||
For example, if a WAF accepts them without normalizing them, it might be
|
||||
possible to bypass its filters, because the Go server would interpret the
|
||||
header differently. Worse, if the reverse proxy coalesces requests onto a
|
||||
single HTTP/1.1 connection to a Go server, the understanding of the request
|
||||
boundaries can get out of sync between them, allowing an attacker to tack an
|
||||
arbitrary method and path onto a request by other clients, including
|
||||
authentication headers unknown to the attacker.
|
||||
|
||||
This was recently presented at multiple security conferences:
|
||||
https://portswigger.net/blog/http-desync-attacks-request-smuggling-reborn
|
||||
|
||||
net/http servers already reject header keys with invalid characters.
|
||||
Simply stop normalizing extra spaces in net/textproto, let it return them
|
||||
unchanged like it does for other invalid headers, and let net/http enforce
|
||||
RFC 7230, which is HTTP specific. This loses us normalization on the client
|
||||
side, but there's no right answer on the client side anyway, and hiding the
|
||||
issue sounds worse than letting the application decide.
|
||||
|
||||
Fixes CVE-2019-16276
|
||||
|
||||
Change-Id: I6d272de827e0870da85d93df770d6a0e161bbcf1
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/549719
|
||||
Reviewed-by: Brad Fitzpatrick <bradfitz@google.com>
|
||||
(cherry picked from commit 1280b868e82bf173ea3e988be3092d160ee66082)
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/558776
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
||||
|
||||
CVE: CVE-2019-16276
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/6e6f4aaf70c8b1cc81e65a26332aa9409de03ad8]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
---
|
||||
src/net/http/serve_test.go | 4 ++++
|
||||
src/net/http/transport_test.go | 27 +++++++++++++++++++++++++++
|
||||
src/net/textproto/reader.go | 10 ++--------
|
||||
src/net/textproto/reader_test.go | 13 ++++++-------
|
||||
4 files changed, 39 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go
|
||||
index 6eb0088a96..89bfdfbb82 100644
|
||||
--- a/src/net/http/serve_test.go
|
||||
+++ b/src/net/http/serve_test.go
|
||||
@@ -4748,6 +4748,10 @@ func TestServerValidatesHeaders(t *testing.T) {
|
||||
{"foo\xffbar: foo\r\n", 400}, // binary in header
|
||||
{"foo\x00bar: foo\r\n", 400}, // binary in header
|
||||
{"Foo: " + strings.Repeat("x", 1<<21) + "\r\n", 431}, // header too large
|
||||
+ // Spaces between the header key and colon are not allowed.
|
||||
+ // See RFC 7230, Section 3.2.4.
|
||||
+ {"Foo : bar\r\n", 400},
|
||||
+ {"Foo\t: bar\r\n", 400},
|
||||
|
||||
{"foo: foo foo\r\n", 200}, // LWS space is okay
|
||||
{"foo: foo\tfoo\r\n", 200}, // LWS tab is okay
|
||||
diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go
|
||||
index 5c329543e2..5e5438a708 100644
|
||||
--- a/src/net/http/transport_test.go
|
||||
+++ b/src/net/http/transport_test.go
|
||||
@@ -5133,3 +5133,30 @@ func TestTransportIgnores408(t *testing.T) {
|
||||
}
|
||||
t.Fatalf("timeout after %v waiting for Transport connections to die off", time.Since(t0))
|
||||
}
|
||||
+
|
||||
+func TestInvalidHeaderResponse(t *testing.T) {
|
||||
+ setParallel(t)
|
||||
+ defer afterTest(t)
|
||||
+ cst := newClientServerTest(t, h1Mode, HandlerFunc(func(w ResponseWriter, r *Request) {
|
||||
+ conn, buf, _ := w.(Hijacker).Hijack()
|
||||
+ buf.Write([]byte("HTTP/1.1 200 OK\r\n" +
|
||||
+ "Date: Wed, 30 Aug 2017 19:09:27 GMT\r\n" +
|
||||
+ "Content-Type: text/html; charset=utf-8\r\n" +
|
||||
+ "Content-Length: 0\r\n" +
|
||||
+ "Foo : bar\r\n\r\n"))
|
||||
+ buf.Flush()
|
||||
+ conn.Close()
|
||||
+ }))
|
||||
+ defer cst.close()
|
||||
+ res, err := cst.c.Get(cst.ts.URL)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ defer res.Body.Close()
|
||||
+ if v := res.Header.Get("Foo"); v != "" {
|
||||
+ t.Errorf(`unexpected "Foo" header: %q`, v)
|
||||
+ }
|
||||
+ if v := res.Header.Get("Foo "); v != "bar" {
|
||||
+ t.Errorf(`bad "Foo " header value: %q, want %q`, v, "bar")
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/net/textproto/reader.go b/src/net/textproto/reader.go
|
||||
index 2c4f25d5ae..1a5e364cf7 100644
|
||||
--- a/src/net/textproto/reader.go
|
||||
+++ b/src/net/textproto/reader.go
|
||||
@@ -493,18 +493,12 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) {
|
||||
return m, err
|
||||
}
|
||||
|
||||
- // Key ends at first colon; should not have trailing spaces
|
||||
- // but they appear in the wild, violating specs, so we remove
|
||||
- // them if present.
|
||||
+ // Key ends at first colon.
|
||||
i := bytes.IndexByte(kv, ':')
|
||||
if i < 0 {
|
||||
return m, ProtocolError("malformed MIME header line: " + string(kv))
|
||||
}
|
||||
- endKey := i
|
||||
- for endKey > 0 && kv[endKey-1] == ' ' {
|
||||
- endKey--
|
||||
- }
|
||||
- key := canonicalMIMEHeaderKey(kv[:endKey])
|
||||
+ key := canonicalMIMEHeaderKey(kv[:i])
|
||||
|
||||
// As per RFC 7230 field-name is a token, tokens consist of one or more chars.
|
||||
// We could return a ProtocolError here, but better to be liberal in what we
|
||||
diff --git a/src/net/textproto/reader_test.go b/src/net/textproto/reader_test.go
|
||||
index f85fbdc36d..b92fdcd3c7 100644
|
||||
--- a/src/net/textproto/reader_test.go
|
||||
+++ b/src/net/textproto/reader_test.go
|
||||
@@ -188,11 +188,10 @@ func TestLargeReadMIMEHeader(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
-// Test that we read slightly-bogus MIME headers seen in the wild,
|
||||
-// with spaces before colons, and spaces in keys.
|
||||
+// TestReadMIMEHeaderNonCompliant checks that we don't normalize headers
|
||||
+// with spaces before colons, and accept spaces in keys.
|
||||
func TestReadMIMEHeaderNonCompliant(t *testing.T) {
|
||||
- // Invalid HTTP response header as sent by an Axis security
|
||||
- // camera: (this is handled by IE, Firefox, Chrome, curl, etc.)
|
||||
+ // These invalid headers will be rejected by net/http according to RFC 7230.
|
||||
r := reader("Foo: bar\r\n" +
|
||||
"Content-Language: en\r\n" +
|
||||
"SID : 0\r\n" +
|
||||
@@ -202,9 +201,9 @@ func TestReadMIMEHeaderNonCompliant(t *testing.T) {
|
||||
want := MIMEHeader{
|
||||
"Foo": {"bar"},
|
||||
"Content-Language": {"en"},
|
||||
- "Sid": {"0"},
|
||||
- "Audio Mode": {"None"},
|
||||
- "Privilege": {"127"},
|
||||
+ "SID ": {"0"},
|
||||
+ "Audio Mode ": {"None"},
|
||||
+ "Privilege ": {"127"},
|
||||
}
|
||||
if !reflect.DeepEqual(m, want) || err != nil {
|
||||
t.Fatalf("ReadMIMEHeader =\n%v, %v; want:\n%v", m, err, want)
|
||||
@@ -20,8 +20,6 @@ RPROVIDES_${PN} = "libjson"
|
||||
|
||||
inherit autotools
|
||||
|
||||
EXTRA_OECONF = "--enable-rdrand"
|
||||
|
||||
do_configure_prepend() {
|
||||
# Clean up autoconf cruft that should not be in the tarball
|
||||
rm -f ${S}/config.status
|
||||
|
||||
@@ -16,6 +16,7 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P
|
||||
file://cross-prop-default.patch \
|
||||
file://many-cross.patch \
|
||||
file://cross-libdir.patch \
|
||||
file://0001-Fix-missing-return-statements-that-are-seen-with-Wer.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "ef9f14326ec1e30d3ba1a26df0f92826ede5a79255ad723af78a2691c37109fd"
|
||||
SRC_URI[md5sum] = "0267b0871266056184c484792572c682"
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
From 7e83cf1edac2a57c08ebb1ce7f21c2a539d5c300 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Liska <mliska@suse.cz>
|
||||
Date: Mon, 15 Jul 2019 10:06:17 +0200
|
||||
Subject: [PATCH] Fix missing return statements that are seen with
|
||||
-Werror=return-type.
|
||||
|
||||
Error example:
|
||||
|
||||
Code:
|
||||
|
||||
#include <locale.h>
|
||||
int main () {
|
||||
/* If it's not defined as a macro, try to use as a symbol */
|
||||
#ifndef LC_MESSAGES
|
||||
LC_MESSAGES;
|
||||
#endif
|
||||
}
|
||||
Compiler stdout:
|
||||
|
||||
Compiler stderr:
|
||||
In file included from /usr/include/locale.h:25,
|
||||
from /tmp/tmpep_i4iwg/testfile.c:2:
|
||||
/usr/include/features.h:382:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
|
||||
382 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
|
||||
| ^~~~~~~
|
||||
/tmp/tmpep_i4iwg/testfile.c: In function 'main':
|
||||
/tmp/tmpep_i4iwg/testfile.c:8:9: error: control reaches end of non-void function [-Werror=return-type]
|
||||
8 | }
|
||||
| ^
|
||||
cc1: some warnings being treated as errors
|
||||
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
|
||||
---
|
||||
mesonbuild/compilers/c.py | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
|
||||
index b0096459..69cf84a4 100644
|
||||
--- a/mesonbuild/compilers/c.py
|
||||
+++ b/mesonbuild/compilers/c.py
|
||||
@@ -387,6 +387,7 @@ class CCompiler(Compiler):
|
||||
#ifndef {symbol}
|
||||
{symbol};
|
||||
#endif
|
||||
+ return 0;
|
||||
}}'''
|
||||
return self.compiles(t.format(**fargs), env, extra_args=extra_args,
|
||||
dependencies=dependencies)
|
||||
@@ -563,6 +564,7 @@ class CCompiler(Compiler):
|
||||
{prefix}
|
||||
int main(int argc, char **argv) {{
|
||||
{type} something;
|
||||
+ return 0;
|
||||
}}'''
|
||||
if not self.compiles(t.format(**fargs), env, extra_args=extra_args,
|
||||
dependencies=dependencies):
|
||||
@@ -598,6 +600,7 @@ class CCompiler(Compiler):
|
||||
{prefix}
|
||||
int main(int argc, char **argv) {{
|
||||
{type} something;
|
||||
+ return 0;
|
||||
}}'''
|
||||
if not self.compiles(t.format(**fargs), env, extra_args=extra_args,
|
||||
dependencies=dependencies):
|
||||
@@ -672,6 +675,7 @@ class CCompiler(Compiler):
|
||||
#include <stdio.h>
|
||||
int main(int argc, char *argv[]) {{
|
||||
printf ("{fmt}", {cast} {f}());
|
||||
+ return 0;
|
||||
}}'''.format(**fargs)
|
||||
res = self.run(code, env, extra_args=extra_args, dependencies=dependencies)
|
||||
if not res.compiled:
|
||||
@@ -823,6 +827,7 @@ class CCompiler(Compiler):
|
||||
#error "No definition for __builtin_{func} found in the prefix"
|
||||
#endif
|
||||
#endif
|
||||
+ return 0;
|
||||
}}'''
|
||||
return self.links(t.format(**fargs), env, extra_args=extra_args,
|
||||
dependencies=dependencies)
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -51,7 +51,7 @@ index 6d3678f..90fdb80 100644
|
||||
- cmd = self.pkgbin.get_command() + args
|
||||
+ def _call_pkgbin_real(self, args, env, use_native=False):
|
||||
+ if use_native:
|
||||
+ cmd = self.pkgbin.get_command() + "-native" + args
|
||||
+ cmd = [self.pkgbin.get_command()[0] + "-native"] + args
|
||||
+ else:
|
||||
+ cmd = self.pkgbin.get_command() + args
|
||||
p, out = Popen_safe(cmd, env=env)[0:2]
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
From 7f770b9c20da1a192dad8cb572a6391f2773285a Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Thu, 3 May 2018 14:31:55 +0200
|
||||
Subject: [PATCH 1/2] Don't leak temporary file on failed ed-style patch
|
||||
|
||||
Now that we write ed-style patches to a temporary file before we
|
||||
apply them, we need to ensure that the temporary file is removed
|
||||
before we leave, even on fatal error.
|
||||
|
||||
* src/pch.c (do_ed_script): Use global TMPEDNAME instead of local
|
||||
tmpname. Don't unlink the file directly, instead tag it for removal
|
||||
at exit time.
|
||||
* src/patch.c (cleanup): Unlink TMPEDNAME at exit.
|
||||
|
||||
This closes bug #53820:
|
||||
https://savannah.gnu.org/bugs/index.php?53820
|
||||
|
||||
Fixes: 123eaff0d5d1 ("Fix arbitrary command execution in ed-style patches (CVE-2018-1000156)")
|
||||
|
||||
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/patch.git/commit/?id=19599883ffb6a450d2884f081f8ecf68edbed7ee]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
src/common.h | 2 ++
|
||||
src/pch.c | 12 +++++-------
|
||||
2 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/common.h b/src/common.h
|
||||
index ec50b40..22238b5 100644
|
||||
--- a/src/common.h
|
||||
+++ b/src/common.h
|
||||
@@ -94,10 +94,12 @@ XTERN char const *origsuff;
|
||||
XTERN char const * TMPINNAME;
|
||||
XTERN char const * TMPOUTNAME;
|
||||
XTERN char const * TMPPATNAME;
|
||||
+XTERN char const * TMPEDNAME;
|
||||
|
||||
XTERN bool TMPINNAME_needs_removal;
|
||||
XTERN bool TMPOUTNAME_needs_removal;
|
||||
XTERN bool TMPPATNAME_needs_removal;
|
||||
+XTERN bool TMPEDNAME_needs_removal;
|
||||
|
||||
#ifdef DEBUGGING
|
||||
XTERN int debug;
|
||||
diff --git a/src/pch.c b/src/pch.c
|
||||
index 16e001a..c1a62cf 100644
|
||||
--- a/src/pch.c
|
||||
+++ b/src/pch.c
|
||||
@@ -2392,7 +2392,6 @@ do_ed_script (char const *inname, char const *outname,
|
||||
file_offset beginning_of_this_line;
|
||||
size_t chars_read;
|
||||
FILE *tmpfp = 0;
|
||||
- char const *tmpname;
|
||||
int tmpfd;
|
||||
pid_t pid;
|
||||
|
||||
@@ -2404,12 +2403,13 @@ do_ed_script (char const *inname, char const *outname,
|
||||
invalid commands and treats the next line as a new command, which
|
||||
can lead to arbitrary command execution. */
|
||||
|
||||
- tmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);
|
||||
+ tmpfd = make_tempfile (&TMPEDNAME, 'e', NULL, O_RDWR | O_BINARY, 0);
|
||||
if (tmpfd == -1)
|
||||
- pfatal ("Can't create temporary file %s", quotearg (tmpname));
|
||||
+ pfatal ("Can't create temporary file %s", quotearg (TMPEDNAME));
|
||||
+ TMPEDNAME_needs_removal = true;
|
||||
tmpfp = fdopen (tmpfd, "w+b");
|
||||
if (! tmpfp)
|
||||
- pfatal ("Can't open stream for file %s", quotearg (tmpname));
|
||||
+ pfatal ("Can't open stream for file %s", quotearg (TMPEDNAME));
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
@@ -2449,8 +2449,7 @@ do_ed_script (char const *inname, char const *outname,
|
||||
write_fatal ();
|
||||
|
||||
if (lseek (tmpfd, 0, SEEK_SET) == -1)
|
||||
- pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname));
|
||||
-
|
||||
+ pfatal ("Can't rewind to the beginning of file %s", quotearg (TMPEDNAME));
|
||||
if (! dry_run && ! skip_rest_of_patch) {
|
||||
int exclusive = *outname_needs_removal ? 0 : O_EXCL;
|
||||
*outname_needs_removal = true;
|
||||
@@ -2482,7 +2481,6 @@ do_ed_script (char const *inname, char const *outname,
|
||||
}
|
||||
|
||||
fclose (tmpfp);
|
||||
- safe_unlink (tmpname);
|
||||
|
||||
if (ofp)
|
||||
{
|
||||
--
|
||||
2.17.0
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
From 369dcccdfa6336e5a873d6d63705cfbe04c55727 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 7 May 2018 15:14:45 +0200
|
||||
Subject: Don't leak temporary file on failed multi-file ed-style patch
|
||||
|
||||
The previous fix worked fine with single-file ed-style patches, but
|
||||
would still leak temporary files in the case of multi-file ed-style
|
||||
patch. Fix that case as well, and extend the test case to check for
|
||||
it.
|
||||
|
||||
* src/patch.c (main): Unlink TMPEDNAME if needed before moving to
|
||||
the next file in a patch.
|
||||
|
||||
This closes bug #53820:
|
||||
https://savannah.gnu.org/bugs/index.php?53820
|
||||
|
||||
Fixes: 123eaff0d5d1 ("Fix arbitrary command execution in ed-style patches (CVE-2018-1000156)")
|
||||
Fixes: 19599883ffb6 ("Don't leak temporary file on failed ed-style patch")
|
||||
|
||||
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/patch.git/commit/?id=369dcccdfa6336e5a873d6d63705cfbe04c55727]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
src/patch.c | 1 +
|
||||
tests/ed-style | 31 +++++++++++++++++++++++++++++++
|
||||
2 files changed, 32 insertions(+)
|
||||
|
||||
diff --git a/src/patch.c b/src/patch.c
|
||||
index 9146597..81c7a02 100644
|
||||
--- a/src/patch.c
|
||||
+++ b/src/patch.c
|
||||
@@ -236,6 +236,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
remove_if_needed (TMPOUTNAME, &TMPOUTNAME_needs_removal);
|
||||
}
|
||||
+ remove_if_needed (TMPEDNAME, &TMPEDNAME_needs_removal);
|
||||
|
||||
if (! skip_rest_of_patch && ! file_type)
|
||||
{
|
||||
diff --git a/tests/ed-style b/tests/ed-style
|
||||
index 6b6ef9d..504e6e5 100644
|
||||
--- a/tests/ed-style
|
||||
+++ b/tests/ed-style
|
||||
@@ -38,3 +38,34 @@ EOF
|
||||
check 'cat foo' <<EOF
|
||||
foo
|
||||
EOF
|
||||
+
|
||||
+# Test the case where one ed-style patch modifies several files
|
||||
+
|
||||
+cat > ed3.diff <<EOF
|
||||
+--- foo
|
||||
++++ foo
|
||||
+1c
|
||||
+bar
|
||||
+.
|
||||
+--- baz
|
||||
++++ baz
|
||||
+0a
|
||||
+baz
|
||||
+.
|
||||
+EOF
|
||||
+
|
||||
+# Apparently we can't create a file with such a patch, while it works fine
|
||||
+# when the file name is provided on the command line
|
||||
+cat > baz <<EOF
|
||||
+EOF
|
||||
+
|
||||
+check 'patch -e -i ed3.diff' <<EOF
|
||||
+EOF
|
||||
+
|
||||
+check 'cat foo' <<EOF
|
||||
+bar
|
||||
+EOF
|
||||
+
|
||||
+check 'cat baz' <<EOF
|
||||
+baz
|
||||
+EOF
|
||||
--
|
||||
cgit v1.0-41-gc330
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 3fcd042d26d70856e826a42b5f93dc4854d80bf0 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Gruenbacher <agruen@gnu.org>
|
||||
Date: Fri, 6 Apr 2018 19:36:15 +0200
|
||||
Subject: [PATCH] Invoke ed directly instead of using the shell
|
||||
|
||||
* src/pch.c (do_ed_script): Invoke ed directly instead of using a shell
|
||||
command to avoid quoting vulnerabilities.
|
||||
|
||||
CVE: CVE-2019-13638
|
||||
Upstream-Status: Backport[https://git.savannah.gnu.org/cgit/patch.git/patch/?id=3fcd042d26d70856e826a42b5f93dc4854d80bf0]
|
||||
Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
|
||||
|
||||
---
|
||||
src/pch.c | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
|
||||
diff --git a/src/pch.c b/src/pch.c
|
||||
index 4fd5a05..16e001a 100644
|
||||
--- a/src/pch.c
|
||||
+++ b/src/pch.c
|
||||
@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char const *outname,
|
||||
*outname_needs_removal = true;
|
||||
copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
|
||||
}
|
||||
- sprintf (buf, "%s %s%s", editor_program,
|
||||
- verbosity == VERBOSE ? "" : "- ",
|
||||
- outname);
|
||||
fflush (stdout);
|
||||
|
||||
pid = fork();
|
||||
@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char const *outname,
|
||||
else if (pid == 0)
|
||||
{
|
||||
dup2 (tmpfd, 0);
|
||||
- execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
|
||||
+ assert (outname[0] != '!' && outname[0] != '-');
|
||||
+ execlp (editor_program, editor_program, "-", outname, (char *) NULL);
|
||||
_exit (2);
|
||||
}
|
||||
else
|
||||
--
|
||||
2.7.4
|
||||
|
||||
113
meta/recipes-devtools/patch/patch/CVE-2019-13636.patch
Normal file
113
meta/recipes-devtools/patch/patch/CVE-2019-13636.patch
Normal file
@@ -0,0 +1,113 @@
|
||||
From dce4683cbbe107a95f1f0d45fabc304acfb5d71a Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Gruenbacher <agruen@gnu.org>
|
||||
Date: Mon, 15 Jul 2019 16:21:48 +0200
|
||||
Subject: Don't follow symlinks unless --follow-symlinks is given
|
||||
|
||||
* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file,
|
||||
append_to_file): Unless the --follow-symlinks option is given, open files with
|
||||
the O_NOFOLLOW flag to avoid following symlinks. So far, we were only doing
|
||||
that consistently for input files.
|
||||
* src/util.c (create_backup): When creating empty backup files, (re)create them
|
||||
with O_CREAT | O_EXCL to avoid following symlinks in that case as well.
|
||||
|
||||
CVE: CVE-2019-13636
|
||||
Upstream-Status: Backport[https://git.savannah.gnu.org/cgit/patch.git/patch/?id=dce4683cbbe107a95f1f0d45fabc304acfb5d71a]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
|
||||
---
|
||||
src/inp.c | 12 ++++++++++--
|
||||
src/util.c | 14 +++++++++++---
|
||||
2 files changed, 21 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/inp.c b/src/inp.c
|
||||
index 32d0919..22d7473 100644
|
||||
--- a/src/inp.c
|
||||
+++ b/src/inp.c
|
||||
@@ -238,8 +238,13 @@ plan_a (char const *filename)
|
||||
{
|
||||
if (S_ISREG (instat.st_mode))
|
||||
{
|
||||
- int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
|
||||
+ int flags = O_RDONLY | binary_transput;
|
||||
size_t buffered = 0, n;
|
||||
+ int ifd;
|
||||
+
|
||||
+ if (! follow_symlinks)
|
||||
+ flags |= O_NOFOLLOW;
|
||||
+ ifd = safe_open (filename, flags, 0);
|
||||
if (ifd < 0)
|
||||
pfatal ("can't open file %s", quotearg (filename));
|
||||
|
||||
@@ -340,6 +345,7 @@ plan_a (char const *filename)
|
||||
static void
|
||||
plan_b (char const *filename)
|
||||
{
|
||||
+ int flags = O_RDONLY | binary_transput;
|
||||
int ifd;
|
||||
FILE *ifp;
|
||||
int c;
|
||||
@@ -353,7 +359,9 @@ plan_b (char const *filename)
|
||||
|
||||
if (instat.st_size == 0)
|
||||
filename = NULL_DEVICE;
|
||||
- if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0
|
||||
+ if (! follow_symlinks)
|
||||
+ flags |= O_NOFOLLOW;
|
||||
+ if ((ifd = safe_open (filename, flags, 0)) < 0
|
||||
|| ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r")))
|
||||
pfatal ("Can't open file %s", quotearg (filename));
|
||||
if (TMPINNAME_needs_removal)
|
||||
diff --git a/src/util.c b/src/util.c
|
||||
index 1cc08ba..fb38307 100644
|
||||
--- a/src/util.c
|
||||
+++ b/src/util.c
|
||||
@@ -388,7 +388,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original)
|
||||
|
||||
try_makedirs_errno = ENOENT;
|
||||
safe_unlink (bakname);
|
||||
- while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0)
|
||||
+ while ((fd = safe_open (bakname, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, 0666)) < 0)
|
||||
{
|
||||
if (errno != try_makedirs_errno)
|
||||
pfatal ("Can't create file %s", quotearg (bakname));
|
||||
@@ -579,10 +579,13 @@ create_file (char const *file, int open_flags, mode_t mode,
|
||||
static void
|
||||
copy_to_fd (const char *from, int tofd)
|
||||
{
|
||||
+ int from_flags = O_RDONLY | O_BINARY;
|
||||
int fromfd;
|
||||
ssize_t i;
|
||||
|
||||
- if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
|
||||
+ if (! follow_symlinks)
|
||||
+ from_flags |= O_NOFOLLOW;
|
||||
+ if ((fromfd = safe_open (from, from_flags, 0)) < 0)
|
||||
pfatal ("Can't reopen file %s", quotearg (from));
|
||||
while ((i = read (fromfd, buf, bufsize)) != 0)
|
||||
{
|
||||
@@ -625,6 +628,8 @@ copy_file (char const *from, char const *to, struct stat *tost,
|
||||
else
|
||||
{
|
||||
assert (S_ISREG (mode));
|
||||
+ if (! follow_symlinks)
|
||||
+ to_flags |= O_NOFOLLOW;
|
||||
tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode,
|
||||
to_dir_known_to_exist);
|
||||
copy_to_fd (from, tofd);
|
||||
@@ -640,9 +645,12 @@ copy_file (char const *from, char const *to, struct stat *tost,
|
||||
void
|
||||
append_to_file (char const *from, char const *to)
|
||||
{
|
||||
+ int to_flags = O_WRONLY | O_APPEND | O_BINARY;
|
||||
int tofd;
|
||||
|
||||
- if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0)
|
||||
+ if (! follow_symlinks)
|
||||
+ to_flags |= O_NOFOLLOW;
|
||||
+ if ((tofd = safe_open (to, to_flags, 0)) < 0)
|
||||
pfatal ("Can't reopen file %s", quotearg (to));
|
||||
copy_to_fd (from, tofd);
|
||||
if (close (tofd) != 0)
|
||||
--
|
||||
cgit v1.0-41-gc330
|
||||
|
||||
@@ -6,6 +6,10 @@ SRC_URI += "file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
|
||||
file://0003-Allow-input-files-to-be-missing-for-ed-style-patches.patch \
|
||||
file://0004-Fix-arbitrary-command-execution-in-ed-style-patches-.patch \
|
||||
file://0001-Fix-swapping-fake-lines-in-pch_swap.patch \
|
||||
file://CVE-2019-13636.patch \
|
||||
file://0001-Invoke-ed-directly-instead-of-using-the-shell.patch \
|
||||
file://0001-Don-t-leak-temporary-file-on-failed-ed-style-patch.patch \
|
||||
file://0001-Don-t-leak-temporary-file-on-failed-multi-file-ed.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "4c68cee989d83c87b00a3860bcd05600"
|
||||
|
||||
@@ -8,6 +8,11 @@ INC_PR = "r1"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=e466242989bd33c1bd2b6a526a742498"
|
||||
|
||||
SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
|
||||
file://bpo-35907-cve-2019-9948.patch \
|
||||
file://bpo-35907-cve-2019-9948-fix.patch \
|
||||
file://bpo-36216-cve-2019-9636.patch \
|
||||
file://bpo-36216-cve-2019-9636-fix.patch \
|
||||
file://CVE-2019-9740.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "30157d85a2c0479c09ea2cbe61f2aaf5"
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
From 532ed09c5454bb789a301bb6f1339a0818255610 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Roberto=20C=2E=20S=C3=A1nchez?= <roberto@connexer.com>
|
||||
Date: Sat, 14 Sep 2019 13:26:38 -0400
|
||||
Subject: [PATCH] [2.7] bpo-34155: Dont parse domains containing @ (GH-13079)
|
||||
(GH-16006)
|
||||
|
||||
This change skips parsing of email addresses where domains include a "@" character, which can be maliciously used since the local part is returned as a complete address.
|
||||
|
||||
(cherry picked from commit 8cb65d1381b027f0b09ee36bfed7f35bb4dec9a9)
|
||||
|
||||
Excludes changes to Lib/email/_header_value_parser.py, which did not
|
||||
exist in 2.7.
|
||||
|
||||
Co-authored-by: jpic <jpic@users.noreply.github.com>
|
||||
|
||||
https://bugs.python.org/issue34155
|
||||
|
||||
Upstream-Status: Backport [https://github.com/python/cpython/commit/8cb65d1381b027f0b09ee36bfed7f35bb4dec9a9]
|
||||
|
||||
CVE: CVE-2019-16056
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
---
|
||||
Lib/email/_parseaddr.py | 11 ++++++++++-
|
||||
Lib/email/test/test_email.py | 14 ++++++++++++++
|
||||
.../2019-05-04-13-33-37.bpo-34155.MJll68.rst | 1 +
|
||||
3 files changed, 25 insertions(+), 1 deletion(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst
|
||||
|
||||
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py
|
||||
index 690db2c22d..dc49d2e45a 100644
|
||||
--- a/Lib/email/_parseaddr.py
|
||||
+++ b/Lib/email/_parseaddr.py
|
||||
@@ -336,7 +336,12 @@ class AddrlistClass:
|
||||
aslist.append('@')
|
||||
self.pos += 1
|
||||
self.gotonext()
|
||||
- return EMPTYSTRING.join(aslist) + self.getdomain()
|
||||
+ domain = self.getdomain()
|
||||
+ if not domain:
|
||||
+ # Invalid domain, return an empty address instead of returning a
|
||||
+ # local part to denote failed parsing.
|
||||
+ return EMPTYSTRING
|
||||
+ return EMPTYSTRING.join(aslist) + domain
|
||||
|
||||
def getdomain(self):
|
||||
"""Get the complete domain name from an address."""
|
||||
@@ -351,6 +356,10 @@ class AddrlistClass:
|
||||
elif self.field[self.pos] == '.':
|
||||
self.pos += 1
|
||||
sdlist.append('.')
|
||||
+ elif self.field[self.pos] == '@':
|
||||
+ # bpo-34155: Don't parse domains with two `@` like
|
||||
+ # `a@malicious.org@important.com`.
|
||||
+ return EMPTYSTRING
|
||||
elif self.field[self.pos] in self.atomends:
|
||||
break
|
||||
else:
|
||||
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
|
||||
index 4b4dee3d34..2efe44ac5a 100644
|
||||
--- a/Lib/email/test/test_email.py
|
||||
+++ b/Lib/email/test/test_email.py
|
||||
@@ -2306,6 +2306,20 @@ class TestMiscellaneous(TestEmailBase):
|
||||
self.assertEqual(Utils.parseaddr('<>'), ('', ''))
|
||||
self.assertEqual(Utils.formataddr(Utils.parseaddr('<>')), '')
|
||||
|
||||
+ def test_parseaddr_multiple_domains(self):
|
||||
+ self.assertEqual(
|
||||
+ Utils.parseaddr('a@b@c'),
|
||||
+ ('', '')
|
||||
+ )
|
||||
+ self.assertEqual(
|
||||
+ Utils.parseaddr('a@b.c@c'),
|
||||
+ ('', '')
|
||||
+ )
|
||||
+ self.assertEqual(
|
||||
+ Utils.parseaddr('a@172.17.0.1@c'),
|
||||
+ ('', '')
|
||||
+ )
|
||||
+
|
||||
def test_noquote_dump(self):
|
||||
self.assertEqual(
|
||||
Utils.formataddr(('A Silly Person', 'person@dom.ain')),
|
||||
diff --git a/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst b/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst
|
||||
new file mode 100644
|
||||
index 0000000000..50292e29ed
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst
|
||||
@@ -0,0 +1 @@
|
||||
+Fix parsing of invalid email addresses with more than one ``@`` (e.g. a@b@c.com.) to not return the part before 2nd ``@`` as valid email address. Patch by maxking & jpic.
|
||||
215
meta/recipes-devtools/python/python/CVE-2019-9740.patch
Normal file
215
meta/recipes-devtools/python/python/CVE-2019-9740.patch
Normal file
@@ -0,0 +1,215 @@
|
||||
From bb8071a4cae5ab3fe321481dd3d73662ffb26052 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Stinner <victor.stinner@gmail.com>
|
||||
Date: Tue, 21 May 2019 15:12:33 +0200
|
||||
Subject: [PATCH] bpo-30458: Disallow control chars in http URLs (GH-12755)
|
||||
(GH-13154) (GH-13315)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Disallow control chars in http URLs in urllib2.urlopen. This
|
||||
addresses a potential security problem for applications that do not
|
||||
sanity check their URLs where http request headers could be injected.
|
||||
|
||||
Disable https related urllib tests on a build without ssl (GH-13032)
|
||||
These tests require an SSL enabled build. Skip these tests when
|
||||
python is built without SSL to fix test failures.
|
||||
|
||||
Use httplib.InvalidURL instead of ValueError as the new error case's
|
||||
exception. (GH-13044)
|
||||
|
||||
Backport Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
|
||||
|
||||
(cherry picked from commit 7e200e0763f5b71c199aaf98bd5588f291585619)
|
||||
|
||||
Notes on backport to Python 2.7:
|
||||
|
||||
* test_urllib tests urllib.urlopen() which quotes the URL and so is
|
||||
not vulerable to HTTP Header Injection.
|
||||
* Add tests to test_urllib2 on urllib2.urlopen().
|
||||
* Reject non-ASCII characters: range 0x80-0xff.
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2019-9740
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
Lib/httplib.py | 16 ++++++
|
||||
Lib/test/test_urllib.py | 25 +++++++++
|
||||
Lib/test/test_urllib2.py | 51 ++++++++++++++++++-
|
||||
Lib/test/test_xmlrpc.py | 8 ++-
|
||||
.../2019-04-10-08-53-30.bpo-30458.51E-DA.rst | 1 +
|
||||
5 files changed, 99 insertions(+), 2 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
|
||||
diff --git a/Lib/httplib.py b/Lib/httplib.py
|
||||
index 60a8fb4e355f..1b41c346e090 100644
|
||||
--- a/Lib/httplib.py
|
||||
+++ b/Lib/httplib.py
|
||||
@@ -247,6 +247,16 @@
|
||||
_is_legal_header_name = re.compile(r'\A[^:\s][^:\r\n]*\Z').match
|
||||
_is_illegal_header_value = re.compile(r'\n(?![ \t])|\r(?![ \t\n])').search
|
||||
|
||||
+# These characters are not allowed within HTTP URL paths.
|
||||
+# See https://tools.ietf.org/html/rfc3986#section-3.3 and the
|
||||
+# https://tools.ietf.org/html/rfc3986#appendix-A pchar definition.
|
||||
+# Prevents CVE-2019-9740. Includes control characters such as \r\n.
|
||||
+# Restrict non-ASCII characters above \x7f (0x80-0xff).
|
||||
+_contains_disallowed_url_pchar_re = re.compile('[\x00-\x20\x7f-\xff]')
|
||||
+# Arguably only these _should_ allowed:
|
||||
+# _is_allowed_url_pchars_re = re.compile(r"^[/!$&'()*+,;=:@%a-zA-Z0-9._~-]+$")
|
||||
+# We are more lenient for assumed real world compatibility purposes.
|
||||
+
|
||||
# We always set the Content-Length header for these methods because some
|
||||
# servers will otherwise respond with a 411
|
||||
_METHODS_EXPECTING_BODY = {'PATCH', 'POST', 'PUT'}
|
||||
@@ -927,6 +937,12 @@ def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
|
||||
self._method = method
|
||||
if not url:
|
||||
url = '/'
|
||||
+ # Prevent CVE-2019-9740.
|
||||
+ match = _contains_disallowed_url_pchar_re.search(url)
|
||||
+ if match:
|
||||
+ raise InvalidURL("URL can't contain control characters. %r "
|
||||
+ "(found at least %r)"
|
||||
+ % (url, match.group()))
|
||||
hdr = '%s %s %s' % (method, url, self._http_vsn_str)
|
||||
|
||||
self._output(hdr)
|
||||
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
|
||||
index 1ce9201c0693..d7778d4194f3 100644
|
||||
--- a/Lib/test/test_urllib.py
|
||||
+++ b/Lib/test/test_urllib.py
|
||||
@@ -257,6 +257,31 @@ def test_url_fragment(self):
|
||||
finally:
|
||||
self.unfakehttp()
|
||||
|
||||
+ def test_url_with_control_char_rejected(self):
|
||||
+ for char_no in range(0, 0x21) + range(0x7f, 0x100):
|
||||
+ char = chr(char_no)
|
||||
+ schemeless_url = "//localhost:7777/test%s/" % char
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ try:
|
||||
+ # urllib quotes the URL so there is no injection.
|
||||
+ resp = urllib.urlopen("http:" + schemeless_url)
|
||||
+ self.assertNotIn(char, resp.geturl())
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
+ def test_url_with_newline_header_injection_rejected(self):
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ host = "localhost:7777?a=1 HTTP/1.1\r\nX-injected: header\r\nTEST: 123"
|
||||
+ schemeless_url = "//" + host + ":8080/test/?test=a"
|
||||
+ try:
|
||||
+ # urllib quotes the URL so there is no injection.
|
||||
+ resp = urllib.urlopen("http:" + schemeless_url)
|
||||
+ self.assertNotIn(' ', resp.geturl())
|
||||
+ self.assertNotIn('\r', resp.geturl())
|
||||
+ self.assertNotIn('\n', resp.geturl())
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
def test_read_bogus(self):
|
||||
# urlopen() should raise IOError for many error codes.
|
||||
self.fakehttp('''HTTP/1.1 401 Authentication Required
|
||||
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
|
||||
index 6d24d5ddf83c..9531818e16b2 100644
|
||||
--- a/Lib/test/test_urllib2.py
|
||||
+++ b/Lib/test/test_urllib2.py
|
||||
@@ -15,6 +15,9 @@
|
||||
except ImportError:
|
||||
ssl = None
|
||||
|
||||
+from test.test_urllib import FakeHTTPMixin
|
||||
+
|
||||
+
|
||||
# XXX
|
||||
# Request
|
||||
# CacheFTPHandler (hard to write)
|
||||
@@ -1262,7 +1265,7 @@ def _test_basic_auth(self, opener, auth_handler, auth_header,
|
||||
self.assertEqual(len(http_handler.requests), 1)
|
||||
self.assertFalse(http_handler.requests[0].has_header(auth_header))
|
||||
|
||||
-class MiscTests(unittest.TestCase):
|
||||
+class MiscTests(unittest.TestCase, FakeHTTPMixin):
|
||||
|
||||
def test_build_opener(self):
|
||||
class MyHTTPHandler(urllib2.HTTPHandler): pass
|
||||
@@ -1317,6 +1320,52 @@ def test_unsupported_algorithm(self):
|
||||
"Unsupported digest authentication algorithm 'invalid'"
|
||||
)
|
||||
|
||||
+ @unittest.skipUnless(ssl, "ssl module required")
|
||||
+ def test_url_with_control_char_rejected(self):
|
||||
+ for char_no in range(0, 0x21) + range(0x7f, 0x100):
|
||||
+ char = chr(char_no)
|
||||
+ schemeless_url = "//localhost:7777/test%s/" % char
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ try:
|
||||
+ # We explicitly test urllib.request.urlopen() instead of the top
|
||||
+ # level 'def urlopen()' function defined in this... (quite ugly)
|
||||
+ # test suite. They use different url opening codepaths. Plain
|
||||
+ # urlopen uses FancyURLOpener which goes via a codepath that
|
||||
+ # calls urllib.parse.quote() on the URL which makes all of the
|
||||
+ # above attempts at injection within the url _path_ safe.
|
||||
+ escaped_char_repr = repr(char).replace('\\', r'\\')
|
||||
+ InvalidURL = httplib.InvalidURL
|
||||
+ with self.assertRaisesRegexp(
|
||||
+ InvalidURL, "contain control.*" + escaped_char_repr):
|
||||
+ urllib2.urlopen("http:" + schemeless_url)
|
||||
+ with self.assertRaisesRegexp(
|
||||
+ InvalidURL, "contain control.*" + escaped_char_repr):
|
||||
+ urllib2.urlopen("https:" + schemeless_url)
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
+ @unittest.skipUnless(ssl, "ssl module required")
|
||||
+ def test_url_with_newline_header_injection_rejected(self):
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ host = "localhost:7777?a=1 HTTP/1.1\r\nX-injected: header\r\nTEST: 123"
|
||||
+ schemeless_url = "//" + host + ":8080/test/?test=a"
|
||||
+ try:
|
||||
+ # We explicitly test urllib2.urlopen() instead of the top
|
||||
+ # level 'def urlopen()' function defined in this... (quite ugly)
|
||||
+ # test suite. They use different url opening codepaths. Plain
|
||||
+ # urlopen uses FancyURLOpener which goes via a codepath that
|
||||
+ # calls urllib.parse.quote() on the URL which makes all of the
|
||||
+ # above attempts at injection within the url _path_ safe.
|
||||
+ InvalidURL = httplib.InvalidURL
|
||||
+ with self.assertRaisesRegexp(
|
||||
+ InvalidURL, r"contain control.*\\r.*(found at least . .)"):
|
||||
+ urllib2.urlopen("http:" + schemeless_url)
|
||||
+ with self.assertRaisesRegexp(InvalidURL, r"contain control.*\\n"):
|
||||
+ urllib2.urlopen("https:" + schemeless_url)
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
+
|
||||
|
||||
class RequestTests(unittest.TestCase):
|
||||
|
||||
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
|
||||
index 36b3be67fd6b..90ccb30716ff 100644
|
||||
--- a/Lib/test/test_xmlrpc.py
|
||||
+++ b/Lib/test/test_xmlrpc.py
|
||||
@@ -659,7 +659,13 @@ def test_dotted_attribute(self):
|
||||
def test_partial_post(self):
|
||||
# Check that a partial POST doesn't make the server loop: issue #14001.
|
||||
conn = httplib.HTTPConnection(ADDR, PORT)
|
||||
- conn.request('POST', '/RPC2 HTTP/1.0\r\nContent-Length: 100\r\n\r\nbye')
|
||||
+ conn.send('POST /RPC2 HTTP/1.0\r\n'
|
||||
+ 'Content-Length: 100\r\n\r\n'
|
||||
+ 'bye HTTP/1.1\r\n'
|
||||
+ 'Host: %s:%s\r\n'
|
||||
+ 'Accept-Encoding: identity\r\n'
|
||||
+ 'Content-Length: 0\r\n\r\n'
|
||||
+ % (ADDR, PORT))
|
||||
conn.close()
|
||||
|
||||
class SimpleServerEncodingTestCase(BaseServerTestCase):
|
||||
diff --git a/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst b/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
new file mode 100644
|
||||
index 000000000000..47cb899df1af
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
@@ -0,0 +1 @@
|
||||
+Address CVE-2019-9740 by disallowing URL paths with embedded whitespace or control characters through into the underlying http client request. Such potentially malicious header injection URLs now cause an httplib.InvalidURL exception to be raised.
|
||||
@@ -0,0 +1,81 @@
|
||||
From 5a1033fe5be764a135adcfff2fdc14edc3e5f327 Mon Sep 17 00:00:00 2001
|
||||
From: Changqing Li <changqing.li@windriver.com>
|
||||
Date: Thu, 10 Oct 2019 16:32:19 +0800
|
||||
Subject: [PATCH] bpo-36742: Fixes handling of pre-normalization characters in
|
||||
urlsplit() bpo-36742: Corrects fix to handle decomposition in usernames
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
https://github.com/python/cpython/commit/98a4dcefbbc3bce5ab07e7c0830a183157250259
|
||||
https://github.com/python/cpython/commit/f61599b050c621386a3fc6bc480359e2d3bb93de#diff-b577545d73dd0cdb2c337a4c5f89e1d7
|
||||
|
||||
CVE: CVE-2019-10160
|
||||
|
||||
Signed-off-by: Changqing Li <changqing.li@windriver.com>
|
||||
---
|
||||
Lib/test/test_urlparse.py | 19 +++++++++++++------
|
||||
Lib/urlparse.py | 14 +++++++++-----
|
||||
2 files changed, 22 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
|
||||
index 1830d0b..857ed96 100644
|
||||
--- a/Lib/test/test_urlparse.py
|
||||
+++ b/Lib/test/test_urlparse.py
|
||||
@@ -641,13 +641,20 @@ class UrlParseTestCase(unittest.TestCase):
|
||||
self.assertIn(u'\u2100', denorm_chars)
|
||||
self.assertIn(u'\uFF03', denorm_chars)
|
||||
|
||||
+ # bpo-36742: Verify port separators are ignored when they
|
||||
+ # existed prior to decomposition
|
||||
+ urlparse.urlsplit(u'http://\u30d5\u309a:80')
|
||||
+ with self.assertRaises(ValueError):
|
||||
+ urlparse.urlsplit(u'http://\u30d5\u309a\ufe1380')
|
||||
+
|
||||
for scheme in [u"http", u"https", u"ftp"]:
|
||||
- for c in denorm_chars:
|
||||
- url = u"{}://netloc{}false.netloc/path".format(scheme, c)
|
||||
- if test_support.verbose:
|
||||
- print "Checking %r" % url
|
||||
- with self.assertRaises(ValueError):
|
||||
- urlparse.urlsplit(url)
|
||||
+ for netloc in [u"netloc{}false.netloc", u"n{}user@netloc"]:
|
||||
+ for c in denorm_chars:
|
||||
+ url = u"{}://{}/path".format(scheme, netloc.format(c))
|
||||
+ if test_support.verbose:
|
||||
+ print "Checking %r" % url
|
||||
+ with self.assertRaises(ValueError):
|
||||
+ urlparse.urlsplit(url)
|
||||
|
||||
def test_main():
|
||||
test_support.run_unittest(UrlParseTestCase)
|
||||
diff --git a/Lib/urlparse.py b/Lib/urlparse.py
|
||||
index 54eda08..e34b368 100644
|
||||
--- a/Lib/urlparse.py
|
||||
+++ b/Lib/urlparse.py
|
||||
@@ -171,14 +171,18 @@ def _checknetloc(netloc):
|
||||
# looking for characters like \u2100 that expand to 'a/c'
|
||||
# IDNA uses NFKC equivalence, so normalize for this check
|
||||
import unicodedata
|
||||
- netloc2 = unicodedata.normalize('NFKC', netloc)
|
||||
- if netloc == netloc2:
|
||||
+ n = netloc.replace(u'@', u'') # ignore characters already included
|
||||
+ n = n.replace(u':', u'') # but not the surrounding text
|
||||
+ n = n.replace(u'#', u'')
|
||||
+ n = n.replace(u'?', u'')
|
||||
+
|
||||
+ netloc2 = unicodedata.normalize('NFKC', n)
|
||||
+ if n == netloc2:
|
||||
return
|
||||
- _, _, netloc = netloc.rpartition('@') # anything to the left of '@' is okay
|
||||
for c in '/?#@:':
|
||||
if c in netloc2:
|
||||
- raise ValueError("netloc '" + netloc2 + "' contains invalid " +
|
||||
- "characters under NFKC normalization")
|
||||
+ raise ValueError(u"netloc '" + netloc + u"' contains invalid " +
|
||||
+ u"characters under NFKC normalization")
|
||||
|
||||
def urlsplit(url, scheme='', allow_fragments=True):
|
||||
"""Parse a URL into 5 components:
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 4865615a2bc2b78c739e4c33f536712c7f9af061 Mon Sep 17 00:00:00 2001
|
||||
From 17796e353acf08acd604610f34840a4a9d2f4b54 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||
Date: Thu, 31 Jan 2019 16:46:30 +0100
|
||||
Subject: [PATCH] distutils/sysconfig: append
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 1397979ee445ff6826aa5469511e003539f77bb2 Mon Sep 17 00:00:00 2001
|
||||
From 12900d498bb77bcc990868a80eaf0ab257b88fff Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 14 May 2013 15:00:26 -0700
|
||||
Subject: [PATCH] python3: Add target and native recipes
|
||||
|
||||
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.python.org"
|
||||
LICENSE = "PSFv2"
|
||||
SECTION = "devel/python"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=f257cc14f81685691652a3d3e1b5d754"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=e466242989bd33c1bd2b6a526a742498"
|
||||
|
||||
SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
|
||||
file://run-ptest \
|
||||
@@ -32,8 +32,8 @@ SRC_URI_append_class-nativesdk = " \
|
||||
file://0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "df6ec36011808205beda239c72f947cb"
|
||||
SRC_URI[sha256sum] = "d83fe8ce51b1bb48bbcf0550fd265b9a75cdfdfa93f916f9e700aef8444bf1bb"
|
||||
SRC_URI[md5sum] = "d33e4aae66097051c2eca45ee3604803"
|
||||
SRC_URI[sha256sum] = "fb799134b868199930b75f26678f18932214042639cd52b16da7fd134cd9b13f"
|
||||
|
||||
# exclude pre-releases for both python 2.x and 3.x
|
||||
UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
|
||||
@@ -294,6 +294,6 @@ FILES_${PN}-man = "${datadir}/man"
|
||||
|
||||
RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip bzip2 libgcc tzdata-europe coreutils sed"
|
||||
RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-tr-tr.iso-8859-9"
|
||||
RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk', '', d)}"
|
||||
RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk tk-lib', '', d)}"
|
||||
RDEPENDS_${PN}-dev = ""
|
||||
|
||||
@@ -30,10 +30,8 @@ SRC_URI += " \
|
||||
file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \
|
||||
file://float-endian.patch \
|
||||
file://0001-python2-use-cc_basename-to-replace-CC-for-checking-c.patch \
|
||||
file://bpo-35907-cve-2019-9948.patch \
|
||||
file://bpo-35907-cve-2019-9948-fix.patch \
|
||||
file://bpo-36216-cve-2019-9636.patch \
|
||||
file://bpo-36216-cve-2019-9636-fix.patch \
|
||||
file://0001-2.7-bpo-34155-Dont-parse-domains-containing-GH-13079.patch \
|
||||
file://bpo-36742-cve-2019-10160.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/Python-${PV}"
|
||||
@@ -177,7 +175,7 @@ RDEPENDS_${PN}-modules += "${PN}-misc"
|
||||
|
||||
# ptest
|
||||
RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip tzdata-europe coreutils sed"
|
||||
RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk', '', d)}"
|
||||
RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk tk-lib', '', d)}"
|
||||
# catch manpage
|
||||
PACKAGES += "${PN}-man"
|
||||
FILES_${PN}-man = "${datadir}/man"
|
||||
|
||||
@@ -22,19 +22,14 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
|
||||
file://0010-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \
|
||||
file://0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch \
|
||||
file://0001-Add-a-missing-X11-include.patch \
|
||||
file://0001-egl-headless-add-egl_create_context.patch \
|
||||
file://0014-fix-CVE-2018-16872.patch \
|
||||
file://0015-fix-CVE-2018-20124.patch \
|
||||
file://0016-fix-CVE-2018-20125.patch \
|
||||
file://0017-fix-CVE-2018-20126.patch \
|
||||
file://0018-fix-CVE-2018-20191.patch \
|
||||
file://0019-fix-CVE-2018-20216.patch \
|
||||
file://CVE-2019-3812.patch \
|
||||
file://0014-linux-user-fix-to-handle-variably-sized-SIOCGSTAMP-w.patch \
|
||||
file://0001-linux-user-assume-__NR_gettid-always-exists.patch \
|
||||
file://0001-linux-user-rename-gettid-to-sys_gettid-to-avoid-clas.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
SRC_URI[md5sum] = "fb687ce0b02d3bf4327e36d3b99427a8"
|
||||
SRC_URI[sha256sum] = "6a0508df079a0a33c2487ca936a56c12122f105b8a96a44374704bef6c69abfc"
|
||||
SRC_URI[md5sum] = "aafb005c252eb3a667c2468868348c0a"
|
||||
SRC_URI[sha256sum] = "b148fc3c7382c5addd915db433383160ca7b840bc6ea90bb0d35c6b253526d56"
|
||||
|
||||
COMPATIBLE_HOST_mipsarchn32 = "null"
|
||||
COMPATIBLE_HOST_mipsarchn64 = "null"
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
From 952e5d584f5aabe41298c278065fe628f3f7aa7a Mon Sep 17 00:00:00 2001
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Thu, 29 Nov 2018 13:35:02 +0100
|
||||
Subject: [PATCH] egl-headless: add egl_create_context
|
||||
|
||||
We must set the correct context (via eglMakeCurrent) before
|
||||
calling qemu_egl_create_context, so we need a thin wrapper and can't
|
||||
hook qemu_egl_create_context directly as ->dpy_gl_ctx_create callback.
|
||||
|
||||
Reported-by: Frederik Carlier <frederik.carlier@quamotion.mobi>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Message-id: 20181129123502.30129-1-kraxel@redhat.com
|
||||
|
||||
Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=952e5d584f5aabe41298c278065fe628f3f7aa7a]
|
||||
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||
---
|
||||
ui/egl-headless.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
|
||||
index 4cf3bbc0e4..519e7bad32 100644
|
||||
--- a/ui/egl-headless.c
|
||||
+++ b/ui/egl-headless.c
|
||||
@@ -38,6 +38,14 @@ static void egl_gfx_switch(DisplayChangeListener *dcl,
|
||||
edpy->ds = new_surface;
|
||||
}
|
||||
|
||||
+static QEMUGLContext egl_create_context(DisplayChangeListener *dcl,
|
||||
+ QEMUGLParams *params)
|
||||
+{
|
||||
+ eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
+ qemu_egl_rn_ctx);
|
||||
+ return qemu_egl_create_context(dcl, params);
|
||||
+}
|
||||
+
|
||||
static void egl_scanout_disable(DisplayChangeListener *dcl)
|
||||
{
|
||||
egl_dpy *edpy = container_of(dcl, egl_dpy, dcl);
|
||||
@@ -150,7 +158,7 @@ static const DisplayChangeListenerOps egl_ops = {
|
||||
.dpy_gfx_update = egl_gfx_update,
|
||||
.dpy_gfx_switch = egl_gfx_switch,
|
||||
|
||||
- .dpy_gl_ctx_create = qemu_egl_create_context,
|
||||
+ .dpy_gl_ctx_create = egl_create_context,
|
||||
.dpy_gl_ctx_destroy = qemu_egl_destroy_context,
|
||||
.dpy_gl_ctx_make_current = qemu_egl_make_context_current,
|
||||
.dpy_gl_ctx_get_current = qemu_egl_get_current_context,
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 184943d827ce09375284e6fbb9fd5eeb9e369529 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Wed, 20 Mar 2019 16:18:41 +0000
|
||||
Subject: [PATCH] linux-user: assume __NR_gettid always exists
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The gettid syscall was introduced in Linux 2.4.11. This is old enough
|
||||
that we can assume it always exists and thus not bother with the
|
||||
conditional backcompat logic.
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
||||
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
|
||||
Message-Id: <20190320161842.13908-2-berrange@redhat.com>
|
||||
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
||||
|
||||
Upstream-Status: Backport
|
||||
dependancy patch for fix
|
||||
|
||||
Signed-off-by: Armin Kuster <akuster808@gmail.com>
|
||||
|
||||
---
|
||||
|
||||
|
||||
linux-user/syscall.c | 8 --------
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
Index: qemu-3.1.0/linux-user/syscall.c
|
||||
===================================================================
|
||||
--- qemu-3.1.0.orig/linux-user/syscall.c
|
||||
+++ qemu-3.1.0/linux-user/syscall.c
|
||||
@@ -250,15 +250,7 @@ static type name (type1 arg1,type2 arg2,
|
||||
#define TARGET_NR__llseek TARGET_NR_llseek
|
||||
#endif
|
||||
|
||||
-#ifdef __NR_gettid
|
||||
_syscall0(int, gettid)
|
||||
-#else
|
||||
-/* This is a replacement for the host gettid() and must return a host
|
||||
- errno. */
|
||||
-static int gettid(void) {
|
||||
- return -ENOSYS;
|
||||
-}
|
||||
-#endif
|
||||
|
||||
/* For the 64-bit guest on 32-bit host case we must emulate
|
||||
* getdents using getdents64, because otherwise the host
|
||||
@@ -0,0 +1,95 @@
|
||||
From 71ba74f67eaca21b0cc9d96f534ad3b9a7161400 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Wed, 20 Mar 2019 16:18:42 +0000
|
||||
Subject: [PATCH] linux-user: rename gettid() to sys_gettid() to avoid clash
|
||||
with glibc
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The glibc-2.29.9000-6.fc31.x86_64 package finally includes the gettid()
|
||||
function as part of unistd.h when __USE_GNU is defined. This clashes
|
||||
with linux-user code which unconditionally defines this function name
|
||||
itself.
|
||||
|
||||
/home/berrange/src/virt/qemu/linux-user/syscall.c:253:16: error: static declaration of ‘gettid’ follows non-static declaration
|
||||
253 | _syscall0(int, gettid)
|
||||
| ^~~~~~
|
||||
/home/berrange/src/virt/qemu/linux-user/syscall.c:184:13: note: in definition of macro ‘_syscall0’
|
||||
184 | static type name (void) \
|
||||
| ^~~~
|
||||
In file included from /usr/include/unistd.h:1170,
|
||||
from /home/berrange/src/virt/qemu/include/qemu/osdep.h:107,
|
||||
from /home/berrange/src/virt/qemu/linux-user/syscall.c:20:
|
||||
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
|
||||
34 | extern __pid_t gettid (void) __THROW;
|
||||
| ^~~~~~
|
||||
CC aarch64-linux-user/linux-user/signal.o
|
||||
make[1]: *** [/home/berrange/src/virt/qemu/rules.mak:69: linux-user/syscall.o] Error 1
|
||||
make[1]: *** Waiting for unfinished jobs....
|
||||
make: *** [Makefile:449: subdir-aarch64-linux-user] Error 2
|
||||
|
||||
While we could make our definition conditional and rely on glibc's impl,
|
||||
this patch simply renames our definition to sys_gettid() which is a
|
||||
common pattern in this file.
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
||||
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
|
||||
Message-Id: <20190320161842.13908-3-berrange@redhat.com>
|
||||
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
||||
|
||||
Upstream-status: Backport
|
||||
|
||||
Fixes issue found on tumbleweed-ty-1
|
||||
Yocto bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13577
|
||||
Signed-off-by: Armin Kuster <akuster808@gmail.com>
|
||||
|
||||
---
|
||||
linux-user/syscall.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: qemu-3.1.0/linux-user/syscall.c
|
||||
===================================================================
|
||||
--- qemu-3.1.0.orig/linux-user/syscall.c
|
||||
+++ qemu-3.1.0/linux-user/syscall.c
|
||||
@@ -250,7 +250,8 @@ static type name (type1 arg1,type2 arg2,
|
||||
#define TARGET_NR__llseek TARGET_NR_llseek
|
||||
#endif
|
||||
|
||||
-_syscall0(int, gettid)
|
||||
+#define __NR_sys_gettid __NR_gettid
|
||||
+_syscall0(int, sys_gettid)
|
||||
|
||||
/* For the 64-bit guest on 32-bit host case we must emulate
|
||||
* getdents using getdents64, because otherwise the host
|
||||
@@ -5483,7 +5484,7 @@ static void *clone_func(void *arg)
|
||||
cpu = ENV_GET_CPU(env);
|
||||
thread_cpu = cpu;
|
||||
ts = (TaskState *)cpu->opaque;
|
||||
- info->tid = gettid();
|
||||
+ info->tid = sys_gettid();
|
||||
task_settid(ts);
|
||||
if (info->child_tidptr)
|
||||
put_user_u32(info->tid, info->child_tidptr);
|
||||
@@ -5628,9 +5629,9 @@ static int do_fork(CPUArchState *env, un
|
||||
mapping. We can't repeat the spinlock hack used above because
|
||||
the child process gets its own copy of the lock. */
|
||||
if (flags & CLONE_CHILD_SETTID)
|
||||
- put_user_u32(gettid(), child_tidptr);
|
||||
+ put_user_u32(sys_gettid(), child_tidptr);
|
||||
if (flags & CLONE_PARENT_SETTID)
|
||||
- put_user_u32(gettid(), parent_tidptr);
|
||||
+ put_user_u32(sys_gettid(), parent_tidptr);
|
||||
ts = (TaskState *)cpu->opaque;
|
||||
if (flags & CLONE_SETTLS)
|
||||
cpu_set_tls (env, newtls);
|
||||
@@ -10588,7 +10589,7 @@ static abi_long do_syscall1(void *cpu_en
|
||||
return TARGET_PAGE_SIZE;
|
||||
#endif
|
||||
case TARGET_NR_gettid:
|
||||
- return get_errno(gettid());
|
||||
+ return get_errno(sys_gettid());
|
||||
#ifdef TARGET_NR_readahead
|
||||
case TARGET_NR_readahead:
|
||||
#if TARGET_ABI_BITS == 32
|
||||
@@ -1,85 +0,0 @@
|
||||
CVE: CVE-2018-16872
|
||||
Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=bab9df35]
|
||||
|
||||
Signed-off-by: Kai Kang <kai.kang@windriver.com>
|
||||
|
||||
From bab9df35ce73d1c8e19a37e2737717ea1c984dc1 Mon Sep 17 00:00:00 2001
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Thu, 13 Dec 2018 13:25:11 +0100
|
||||
Subject: [PATCH] usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
|
||||
|
||||
Open files and directories with O_NOFOLLOW to avoid symlinks attacks.
|
||||
While being at it also add O_CLOEXEC.
|
||||
|
||||
usb-mtp only handles regular files and directories and ignores
|
||||
everything else, so users should not see a difference.
|
||||
|
||||
Because qemu ignores symlinks, carrying out a successful symlink attack
|
||||
requires swapping an existing file or directory below rootdir for a
|
||||
symlink and winning the race against the inotify notification to qemu.
|
||||
|
||||
Fixes: CVE-2018-16872
|
||||
Cc: Prasad J Pandit <ppandit@redhat.com>
|
||||
Cc: Bandan Das <bsd@redhat.com>
|
||||
Reported-by: Michael Hanselmann <public@hansmi.ch>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
|
||||
Message-id: 20181213122511.13853-1-kraxel@redhat.com
|
||||
---
|
||||
hw/usb/dev-mtp.c | 13 +++++++++----
|
||||
1 file changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
|
||||
index 100b7171f4..36c43b8c20 100644
|
||||
--- a/hw/usb/dev-mtp.c
|
||||
+++ b/hw/usb/dev-mtp.c
|
||||
@@ -653,13 +653,18 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)
|
||||
{
|
||||
struct dirent *entry;
|
||||
DIR *dir;
|
||||
+ int fd;
|
||||
|
||||
if (o->have_children) {
|
||||
return;
|
||||
}
|
||||
o->have_children = true;
|
||||
|
||||
- dir = opendir(o->path);
|
||||
+ fd = open(o->path, O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
|
||||
+ if (fd < 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ dir = fdopendir(fd);
|
||||
if (!dir) {
|
||||
return;
|
||||
}
|
||||
@@ -1007,7 +1012,7 @@ static MTPData *usb_mtp_get_object(MTPState *s, MTPControl *c,
|
||||
|
||||
trace_usb_mtp_op_get_object(s->dev.addr, o->handle, o->path);
|
||||
|
||||
- d->fd = open(o->path, O_RDONLY);
|
||||
+ d->fd = open(o->path, O_RDONLY | O_CLOEXEC | O_NOFOLLOW);
|
||||
if (d->fd == -1) {
|
||||
usb_mtp_data_free(d);
|
||||
return NULL;
|
||||
@@ -1031,7 +1036,7 @@ static MTPData *usb_mtp_get_partial_object(MTPState *s, MTPControl *c,
|
||||
c->argv[1], c->argv[2]);
|
||||
|
||||
d = usb_mtp_data_alloc(c);
|
||||
- d->fd = open(o->path, O_RDONLY);
|
||||
+ d->fd = open(o->path, O_RDONLY | O_CLOEXEC | O_NOFOLLOW);
|
||||
if (d->fd == -1) {
|
||||
usb_mtp_data_free(d);
|
||||
return NULL;
|
||||
@@ -1658,7 +1663,7 @@ static void usb_mtp_write_data(MTPState *s)
|
||||
0, 0, 0, 0);
|
||||
goto done;
|
||||
}
|
||||
- d->fd = open(path, O_CREAT | O_WRONLY, mask);
|
||||
+ d->fd = open(path, O_CREAT | O_WRONLY | O_CLOEXEC | O_NOFOLLOW, mask);
|
||||
if (d->fd == -1) {
|
||||
usb_mtp_queue_result(s, RES_STORE_FULL, d->trans,
|
||||
0, 0, 0, 0);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user