diff options
89 files changed, 246 insertions, 4280 deletions
diff --git a/meta-agl-bsp/classes/image.bbclass b/meta-agl-bsp/classes/image.bbclass index 1002431ef..a832fa671 100644 --- a/meta-agl-bsp/classes/image.bbclass +++ b/meta-agl-bsp/classes/image.bbclass @@ -1,19 +1,17 @@ inherit rootfs_${IMAGE_PKGTYPE} -# Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk +# Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base # in the non-Linux SDK_OS case, such as mingw32 -SDKEXTCLASS ?= "${@['populate_sdk', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS", True)]}" +SDKEXTCLASS ?= "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}" inherit ${SDKEXTCLASS} TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}" TOOLCHAIN_TARGET_TASK_ATTEMPTONLY += "${PACKAGE_INSTALL_ATTEMPTONLY}" POPULATE_SDK_POST_TARGET_COMMAND += "rootfs_sysroot_relativelinks; " -inherit gzipnative - LICENSE = "MIT" PACKAGES = "" -DEPENDS += "${MLPREFIX}qemuwrapper-cross ${MLPREFIX}depmodwrapper-cross" +DEPENDS += "${MLPREFIX}qemuwrapper-cross depmodwrapper-cross" RDEPENDS += "${PACKAGE_INSTALL} ${LINGUAS_INSTALL}" RRECOMMENDS += "${PACKAGE_INSTALL_ATTEMPTONLY}" @@ -31,7 +29,7 @@ IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs empty-root-password IMAGE_GEN_DEBUGFS ?= "0" # rootfs bootstrap install -ROOTFS_BOOTSTRAP_INSTALL = "${@bb.utils.contains("IMAGE_FEATURES", "package-management", "", "${ROOTFS_PKGMANAGE_BOOTSTRAP}",d)}" +ROOTFS_BOOTSTRAP_INSTALL = "run-postinsts" # These packages will be removed from a read-only rootfs after all other # packages have been installed @@ -51,7 +49,7 @@ FEATURE_PACKAGES_splash = "${SPLASH}" IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}' def check_image_features(d): - valid_features = (d.getVarFlag('IMAGE_FEATURES', 'validitems', True) or "").split() + valid_features = (d.getVarFlag('IMAGE_FEATURES', 'validitems') or "").split() valid_features += d.getVarFlags('COMPLEMENTARY_GLOB').keys() for var in d: if var.startswith("PACKAGE_GROUP_"): @@ -133,7 +131,7 @@ def build_live(d): if bb.utils.contains("IMAGE_FSTYPES", "live", "live", "0", d) == "0": # live is not set but hob might set iso or hddimg d.setVar('NOISO', bb.utils.contains('IMAGE_FSTYPES', "iso", "0", "1", d)) d.setVar('NOHDD', bb.utils.contains('IMAGE_FSTYPES', "hddimg", "0", "1", d)) - if d.getVar('NOISO', True) == "0" or d.getVar('NOHDD', True) == "0": + if d.getVar('NOISO') == "0" or d.getVar('NOHDD') == "0": return "image-live" return "" return "image-live" @@ -142,38 +140,54 @@ IMAGE_TYPE_live = "${@build_live(d)}" inherit ${IMAGE_TYPE_live} IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vmdk.xz", "vdi", "qcow2", "hdddirect"], "image-vm", "", d)}' + inherit ${IMAGE_TYPE_vm} +IMAGE_TYPE_container = '${@bb.utils.contains("IMAGE_FSTYPES", "container", "image-container", "", d)}' +inherit ${IMAGE_TYPE_container} + +def build_uboot(d): + if 'u-boot' in (d.getVar('IMAGE_FSTYPES') or ''): + return "image_types_uboot" + else: + return "" + +IMAGE_TYPE_uboot = "${@build_uboot(d)}" +inherit ${IMAGE_TYPE_uboot} + +IMAGE_TYPE_wic = "image_types_wic" +inherit ${IMAGE_TYPE_wic} + python () { deps = " " + imagetypes_getdepends(d) d.appendVarFlag('do_rootfs', 'depends', deps) deps = "" - for dep in (d.getVar('EXTRA_IMAGEDEPENDS', True) or "").split(): + for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split(): deps += " %s:do_populate_sysroot" % dep - d.appendVarFlag('do_build', 'depends', deps) + d.appendVarFlag('do_image_complete', 'depends', deps) #process IMAGE_FEATURES, we must do this before runtime_mapping_rename #Check for replaces image features features = set(oe.data.typed_value('IMAGE_FEATURES', d)) remain_features = features.copy() for feature in features: - replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature, True) or "").split()) + replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature) or "").split()) remain_features -= replaces #Check for conflict image features for feature in remain_features: - conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature, True) or "").split()) + conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature) or "").split()) temp = conflicts & remain_features if temp: - bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN', True), feature, ' '.join(list(temp)))) + bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN'), feature, ' '.join(list(temp)))) d.setVar('IMAGE_FEATURES', ' '.join(sorted(list(remain_features)))) check_image_features(d) - initramfs_image = d.getVar('INITRAMFS_IMAGE', True) or "" + initramfs_image = d.getVar('INITRAMFS_IMAGE') or "" if initramfs_image != "": - d.appendVarFlag('do_build', 'depends', " %s:do_bundle_initramfs" % d.getVar('PN', True)) + d.appendVarFlag('do_build', 'depends', " %s:do_bundle_initramfs" % d.getVar('PN')) d.appendVarFlag('do_bundle_initramfs', 'depends', " %s:do_image_complete" % initramfs_image) } @@ -185,7 +199,7 @@ IMAGE_POSTPROCESS_COMMAND ?= "" # some default locales IMAGE_LINGUAS ?= "de-de fr-fr en-gb" -LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS', True).split()))}" +LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}" # Prefer image, but use the fallback files for lookups if the image ones # aren't yet available. @@ -199,6 +213,14 @@ PACKAGE_EXCLUDE[type] = "list" fakeroot python do_rootfs () { from oe.rootfs import create_rootfs from oe.manifest import create_manifest + import logging + + logger = d.getVar('BB_TASK_LOGGER', False) + if logger: + logcatcher = bb.utils.LogCatcher() + logger.addHandler(logcatcher) + else: + logcatcher = None # NOTE: if you add, remove or significantly refactor the stages of this # process then you should recalculate the weightings here. This is quite @@ -212,20 +234,20 @@ fakeroot python do_rootfs () { progress_reporter.next_stage() # Handle package exclusions - excl_pkgs = d.getVar("PACKAGE_EXCLUDE", True).split() - inst_pkgs = d.getVar("PACKAGE_INSTALL", True).split() - inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY", True).split() + excl_pkgs = d.getVar("PACKAGE_EXCLUDE").split() + inst_pkgs = d.getVar("PACKAGE_INSTALL").split() + inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY").split() d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs)) d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs)) for pkg in excl_pkgs: if pkg in inst_pkgs: - bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN', True), inst_pkgs)) + bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs)) inst_pkgs.remove(pkg) if pkg in inst_attempt_pkgs: - bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN', True), inst_pkgs)) + bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs)) inst_attempt_pkgs.remove(pkg) d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs)) @@ -235,7 +257,7 @@ fakeroot python do_rootfs () { # We have to delay the runtime_mapping_rename until just before rootfs runs # otherwise, the multilib renaming could step in and squash any fixups that # may have occurred. - pn = d.getVar('PN', True) + pn = d.getVar('PN') runtime_mapping_rename("PACKAGE_INSTALL", pn, d) runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d) runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d) @@ -246,19 +268,19 @@ fakeroot python do_rootfs () { progress_reporter.next_stage() # generate rootfs - create_rootfs(d, progress_reporter=progress_reporter) + create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher) progress_reporter.finish() } do_rootfs[dirs] = "${TOPDIR}" do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}" do_rootfs[umask] = "022" -addtask rootfs before do_build +addtask rootfs before do_build after do_prepare_recipe_sysroot fakeroot python do_image () { from oe.utils import execute_pre_post_process - pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND", True) + pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND") execute_pre_post_process(d, pre_process_cmds) } @@ -269,7 +291,7 @@ addtask do_image after do_rootfs before do_build fakeroot python do_image_complete () { from oe.utils import execute_pre_post_process - post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND", True) + post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND") execute_pre_post_process(d, post_process_cmds) } @@ -292,7 +314,7 @@ addtask do_image_complete after do_image before do_build fakeroot python do_image_qa () { from oe.utils import ImageQAFailed - qa_cmds = (d.getVar('IMAGE_QA_COMMANDS', True) or '').split() + qa_cmds = (d.getVar('IMAGE_QA_COMMANDS') or '').split() qamsg = "" for cmd in qa_cmds: @@ -307,40 +329,17 @@ fakeroot python do_image_qa () { qamsg = qamsg + '\n' if qamsg: - imgname = d.getVar('IMAGE_NAME', True) + imgname = d.getVar('IMAGE_NAME') bb.fatal("QA errors found whilst validating image: %s\n%s" % (imgname, qamsg)) } addtask do_image_qa after do_image_complete before do_build -# -# Write environment variables used by wic -# to tmp/sysroots/<machine>/imgdata/<image>.env -# -python do_rootfs_wicenv () { - wicvars = d.getVar('WICVARS', True) - if not wicvars: - return - - stdir = d.getVar('STAGING_DIR_TARGET', True) - outdir = os.path.join(stdir, 'imgdata') - bb.utils.mkdirhier(outdir) - basename = d.getVar('IMAGE_BASENAME', True) - with open(os.path.join(outdir, basename) + '.env', 'w') as envf: - for var in wicvars.split(): - value = d.getVar(var, True) - if value: - envf.write('%s="%s"\n' % (var, value.strip())) -} -addtask do_rootfs_wicenv after do_image before do_image_wic -do_rootfs_wicenv[vardeps] += "${WICVARS}" -do_rootfs_wicenv[prefuncs] = 'set_image_size' - def setup_debugfs_variables(d): d.appendVar('IMAGE_ROOTFS', '-dbg') d.appendVar('IMAGE_LINK_NAME', '-dbg') d.appendVar('IMAGE_NAME','-dbg') d.setVar('IMAGE_BUILDING_DEBUGFS', 'true') - debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS', True) + debugfs_image_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS') if debugfs_image_fstypes: d.setVar('IMAGE_FSTYPES', debugfs_image_fstypes) @@ -358,7 +357,7 @@ python () { # # Without de-duplication, gen_conversion_cmds() below # would create the same compression command multiple times. - ctypes = set(d.getVar('CONVERSIONTYPES', True).split()) + ctypes = set(d.getVar('CONVERSIONTYPES').split()) old_overrides = d.getVar('OVERRIDES', False) def _image_base_type(type): @@ -375,11 +374,11 @@ python () { return basetype basetypes = {} - alltypes = d.getVar('IMAGE_FSTYPES', True).split() + alltypes = d.getVar('IMAGE_FSTYPES').split() typedeps = {} - if d.getVar('IMAGE_GEN_DEBUGFS', True) == "1": - debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS', True).split() + if d.getVar('IMAGE_GEN_DEBUGFS') == "1": + debugfs_fstypes = d.getVar('IMAGE_FSTYPES_DEBUGFS').split() for t in debugfs_fstypes: alltypes.append("debugfs_" + t) @@ -394,7 +393,7 @@ python () { if t.startswith("debugfs_"): t = t[8:] debug = "debugfs_" - deps = (d.getVar('IMAGE_TYPEDEP_' + t, True) or "").split() + deps = (d.getVar('IMAGE_TYPEDEP_' + t) or "").split() vardeps.add('IMAGE_TYPEDEP_' + t) if baset not in typedeps: typedeps[baset] = set() @@ -414,7 +413,7 @@ python () { d.appendVarFlag('do_image', 'vardeps', ' '.join(vardeps)) - maskedtypes = (d.getVar('IMAGE_TYPES_MASKED', True) or "").split() + maskedtypes = (d.getVar('IMAGE_TYPES_MASKED') or "").split() maskedtypes = [dbg + t for t in maskedtypes for dbg in ("", "debugfs_")] for t in basetypes: @@ -433,7 +432,6 @@ python () { debug = "setup_debugfs " realt = t[8:] localdata.setVar('OVERRIDES', '%s:%s' % (realt, old_overrides)) - bb.data.update_data(localdata) localdata.setVar('type', realt) # Delete DATETIME so we don't expand any references to it now # This means the task's hash can be stable rather than having hardcoded @@ -442,7 +440,7 @@ python () { localdata.delVar('DATETIME') localdata.delVar('TMPDIR') - image_cmd = localdata.getVar("IMAGE_CMD", True) + image_cmd = localdata.getVar("IMAGE_CMD") vardeps.add('IMAGE_CMD_' + realt) if image_cmd: cmds.append("\t" + image_cmd) @@ -464,7 +462,7 @@ python () { # Create input image first. gen_conversion_cmds(type) localdata.setVar('type', type) - cmd = "\t" + (localdata.getVar("CONVERSION_CMD_" + ctype, True) or localdata.getVar("COMPRESS_CMD_" + ctype, True)) + cmd = "\t" + (localdata.getVar("CONVERSION_CMD_" + ctype) or localdata.getVar("COMPRESS_CMD_" + ctype)) if cmd not in cmds: cmds.append(cmd) vardeps.add('CONVERSION_CMD_' + ctype) @@ -515,17 +513,17 @@ python () { def get_rootfs_size(d): import subprocess - rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT', True)) - overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR', True)) - rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE', True)) - rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE', True)) - rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE', True) - image_fstypes = d.getVar('IMAGE_FSTYPES', True) or '' - initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES', True) or '' - initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE', True) + rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT')) + overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR')) + rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE')) + rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE')) + rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE') + image_fstypes = d.getVar('IMAGE_FSTYPES') or '' + initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES') or '' + initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE') output = subprocess.check_output(['du', '-ks', - d.getVar('IMAGE_ROOTFS', True)]) + d.getVar('IMAGE_ROOTFS')]) size_kb = int(output.split()[0]) base_size = size_kb * overhead_factor base_size = max(base_size, rootfs_req_size) + rootfs_extra_space @@ -541,7 +539,7 @@ def get_rootfs_size(d): # Do not check image size of the debugfs image. This is not supposed # to be deployed, etc. so it doesn't make sense to limit the size # of the debug. - if (d.getVar('IMAGE_BUILDING_DEBUGFS', True) or "") == "true": + if (d.getVar('IMAGE_BUILDING_DEBUGFS') or "") == "true": return base_size # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set) @@ -572,13 +570,13 @@ python set_image_size () { # python create_symlinks() { - deploy_dir = d.getVar('IMGDEPLOYDIR', True) - img_name = d.getVar('IMAGE_NAME', True) - link_name = d.getVar('IMAGE_LINK_NAME', True) - manifest_name = d.getVar('IMAGE_MANIFEST', True) - taskname = d.getVar("BB_CURRENTTASK", True) + deploy_dir = d.getVar('IMGDEPLOYDIR') + img_name = d.getVar('IMAGE_NAME') + link_name = d.getVar('IMAGE_LINK_NAME') + manifest_name = d.getVar('IMAGE_MANIFEST') + taskname = d.getVar("BB_CURRENTTASK") subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split() - imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix', True) or d.expand("${IMAGE_NAME_SUFFIX}.") + imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix') or d.expand("${IMAGE_NAME_SUFFIX}.") if not link_name: return @@ -604,9 +602,9 @@ do_patch[noexec] = "1" do_configure[noexec] = "1" do_compile[noexec] = "1" do_install[noexec] = "1" -do_populate_sysroot[noexec] = "1" +deltask do_populate_sysroot do_package[noexec] = "1" -do_package_qa[noexec] = "1" +deltask do_package_qa do_packagedata[noexec] = "1" do_package_write_ipk[noexec] = "1" do_package_write_deb[noexec] = "1" diff --git a/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc b/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc index 299568fcb..d970fecab 100644 --- a/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc +++ b/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc @@ -22,7 +22,7 @@ APPEND += "console=ttyS0,115200n8 reboot=efi" IMAGE_INSTALL_append = " \ libva \ va-intel \ - gstreamer-vaapi-1.0 " + gstreamer1.0-vaapi" AGL_DEFAULT_IMAGE_FSTYPES := "wic hddimg" INITRD_LIVE = "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.ext4.gz" diff --git a/meta-agl-bsp/conf/include/agl_joule.inc b/meta-agl-bsp/conf/include/agl_joule.inc index 246e47f9d..a13bdd9dd 100644 --- a/meta-agl-bsp/conf/include/agl_joule.inc +++ b/meta-agl-bsp/conf/include/agl_joule.inc @@ -7,7 +7,7 @@ IMAGE_INSTALL_append = " linux-firmware-iwlwifi-8000c linux-firmware-ibt-11-5" IMAGE_INSTALL_append = " \ libva \ va-intel \ - gstreamer-vaapi-1.0 " + gstreamer1.0-vaapi" OSTREE_BOOTLOADER ?= "u-boot" AGL_DEFAULT_IMAGE_FSTYPES := "wic hddimg" diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi2.inc b/meta-agl-bsp/conf/include/agl_raspberrypi2.inc index 0b531b11d..111893b32 100644 --- a/meta-agl-bsp/conf/include/agl_raspberrypi2.inc +++ b/meta-agl-bsp/conf/include/agl_raspberrypi2.inc @@ -11,7 +11,6 @@ MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/ KERNEL_IMAGETYPE = "uImage" KERNEL_DEVICETREE_append = " overlays/vc4-kms-v3d-overlay.dtb" -PREFERRED_VERSION_linux-raspberrypi = "4.4.%" PREFERRED_VERSION_mesa = "12.%" PREFERRED_PROVIDER_virtual/egl = "mesa" diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc b/meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc index 6f42c3602..f6801352c 100644 --- a/meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc +++ b/meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc @@ -5,20 +5,8 @@ ENABLE_CMA = "1" CMA_LWM = "16" CMA_HWM = "32" -CORE_IMAGE_EXTRA_INSTALL += "wayland weston" - -MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" - KERNEL_IMAGETYPE = "Image" KERNEL_DEVICETREE_append = " overlays/vc4-kms-v3d-overlay.dtb" -PREFERRED_VERSION_linux-raspberrypi = "4.9.%" -PREFERRED_VERSION_mesa = "12.%" - -PREFERRED_PROVIDER_virtual/egl = "mesa" -PREFERRED_PROVIDER_virtual/libgles2 = "mesa" -PREFERRED_PROVIDER_virtual/libgl = "mesa" -PREFERRED_PROVIDER_virtual/mesa = "mesa" -PREFERRED_PROVIDER_jpeg = "jpeg" MACHINE_FEATURES += "vc4graphics" diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi3.inc b/meta-agl-bsp/conf/include/agl_raspberrypi3.inc index 1dd5f2989..54ccdd573 100644 --- a/meta-agl-bsp/conf/include/agl_raspberrypi3.inc +++ b/meta-agl-bsp/conf/include/agl_raspberrypi3.inc @@ -5,23 +5,12 @@ ENABLE_CMA = "1" CMA_LWM = "16" CMA_HWM = "32" -CORE_IMAGE_EXTRA_INSTALL += "wayland weston" - MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" # The correct config for a Raspberry Pi 3 in 32bit mode UBOOT_MACHINE = "rpi_3_32b_config" KERNEL_IMAGETYPE = "uImage" -KERNEL_DEVICETREE_append = " overlays/vc4-kms-v3d-overlay.dtb" -PREFERRED_VERSION_linux-raspberrypi = "4.4.%" -PREFERRED_VERSION_mesa = "12.%" - -PREFERRED_PROVIDER_virtual/egl = "mesa" -PREFERRED_PROVIDER_virtual/libgles2 = "mesa" -PREFERRED_PROVIDER_virtual/libgl = "mesa" -PREFERRED_PROVIDER_virtual/mesa = "mesa" -PREFERRED_PROVIDER_jpeg = "jpeg" MACHINE_FEATURES += "vc4graphics" diff --git a/meta-agl-bsp/meta-core/recipes-support/gnutls/files/check_SYS_getrandom.patch b/meta-agl-bsp/meta-core/recipes-support/gnutls/files/check_SYS_getrandom.patch deleted file mode 100644 index 535c22af1..000000000 --- a/meta-agl-bsp/meta-core/recipes-support/gnutls/files/check_SYS_getrandom.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f26c3979ab0325edb2e410d287bc501cf00e0ac0 Mon Sep 17 00:00:00 2001 -From: Nikos Mavrogiannopoulos <nmav@redhat.com> -Date: Mon, 22 Aug 2016 16:32:34 +0200 -Subject: [PATCH] rnd-linux: added check for SYS_getrandom being defined - -This allows to compile the getrandom() code in old Linux systems -which do not have the system call defined. ---- - -Upstream-Status: Backport -Signed-off-by: Khem Raj <raj.khem@gmail.com> - - lib/nettle/rnd-linux.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/lib/nettle/rnd-linux.c b/lib/nettle/rnd-linux.c -index d7f07a6..7a24d05 100644 ---- a/lib/nettle/rnd-linux.c -+++ b/lib/nettle/rnd-linux.c -@@ -56,7 +56,11 @@ static dev_t _gnutls_urandom_fd_rdev = 0; - # else - # include <sys/syscall.h> - # undef getrandom --# define getrandom(dst,s,flags) syscall(SYS_getrandom, (void*)dst, (size_t)s, (unsigned int)flags) -+# if defined(SYS_getrandom) -+# define getrandom(dst,s,flags) syscall(SYS_getrandom, (void*)dst, (size_t)s, (unsigned int)flags) -+# else -+# define getrandom(dst,s,flags) -1 -+# endif - # endif - - static unsigned have_getrandom(void) --- -libgit2 0.24.0 - diff --git a/meta-agl-bsp/meta-core/recipes-support/gnutls/gnutls_3.5.3.bbappend b/meta-agl-bsp/meta-core/recipes-support/gnutls/gnutls_3.5.3.bbappend deleted file mode 100644 index dc67743fc..000000000 --- a/meta-agl-bsp/meta-core/recipes-support/gnutls/gnutls_3.5.3.bbappend +++ /dev/null @@ -1,8 +0,0 @@ -FILESEXTRAPATHS_append := ":${THISDIR}/files" - -SRC_URI_append = "\ - file://check_SYS_getrandom.patch \ - " - - -# backport from https://patchwork.openembedded.org/patch/133002/ diff --git a/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-yocto_4.8%.bbappend b/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-yocto_4.9%.bbappend index 65484da51..65484da51 100644 --- a/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-yocto_4.8%.bbappend +++ b/meta-agl-bsp/meta-intel/recipes-kernel/linux/linux-yocto_4.9%.bbappend diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/files/disable-asm-on-non-gcc.patch b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/files/disable-asm-on-non-gcc.patch deleted file mode 100644 index d2d67558b..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/files/disable-asm-on-non-gcc.patch +++ /dev/null @@ -1,29 +0,0 @@ -Configure checks for compiler to be gcc and then it enables asm_offsets -generation. see - -https://cgit.freedesktop.org/mesa/mesa/commit/?id=73c9b4b0e05fc66629ba250846948dc55c0e7a0d - -However, we missed the check when enabling this on cross compilation -when architecture for both host and target is x86 - -Fixes errors like -./gen_matypes > matypes.h -/bin/bash: ./gen_matypes: No such file or directory - --Khem - -Upstream-Status: Submitted - -Index: mesa-12.0.1/configure.ac -=================================================================== ---- mesa-12.0.1.orig/configure.ac -+++ mesa-12.0.1/configure.ac -@@ -732,7 +732,7 @@ test "x$enable_asm" = xno && AC_MSG_RESU - if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then - case "$host_cpu" in - i?86 | x86_64 | amd64) -- if test "x$host_cpu" != "x$target_cpu"; then -+ if test "x$host_cpu" != "x$target_cpu" -o "x$acv_mesa_CLANG" = xyes; then - enable_asm=no - AC_MSG_RESULT([no, cross compiling]) - fi diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/files/replace_glibc_check_with_linux.patch b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/files/replace_glibc_check_with_linux.patch deleted file mode 100644 index e4461ef17..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/files/replace_glibc_check_with_linux.patch +++ /dev/null @@ -1,17 +0,0 @@ -endianness check is OS wide and not specific to libc - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Upstream-Status: Pending -Index: mesa-11.1.1/src/gallium/include/pipe/p_config.h -=================================================================== ---- mesa-11.1.1.orig/src/gallium/include/pipe/p_config.h -+++ mesa-11.1.1/src/gallium/include/pipe/p_config.h -@@ -130,7 +130,7 @@ - * Endian detection. - */ - --#ifdef __GLIBC__ -+#if defined(__linux__) - #include <endian.h> - - #if __BYTE_ORDER == __LITTLE_ENDIAN diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa-gl_12.0.3.bb b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa-gl_12.0.3.bb deleted file mode 100644 index f06a3e9b5..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa-gl_12.0.3.bb +++ /dev/null @@ -1,13 +0,0 @@ -require mesa_${PV}.bb - -SUMMARY += " (OpenGL only, no EGL/GLES)" - -FILESEXTRAPATHS =. "${FILE_DIRNAME}/mesa:" - -PROVIDES = "virtual/libgl virtual/mesa" - -S = "${WORKDIR}/mesa-${PV}" - -PACKAGECONFIG ??= "dri ${MESA_CRYPTO} ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" - -EXCLUDE_FROM_WORLD = "1" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa.inc b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa.inc deleted file mode 100644 index e4880ffed..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa.inc +++ /dev/null @@ -1,191 +0,0 @@ -SUMMARY = "A free implementation of the OpenGL API" -DESCRIPTION = "Mesa is an open-source implementation of the OpenGL specification - \ -a system for rendering interactive 3D graphics. \ -A variety of device drivers allows Mesa to be used in many different environments \ -ranging from software emulation to complete hardware acceleration for modern GPUs. \ -Mesa is used as part of the overall Direct Rendering Infrastructure and X.org \ -environment." - -HOMEPAGE = "http://mesa3d.org" -BUGTRACKER = "https://bugs.freedesktop.org" -SECTION = "x11" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://docs/license.html;md5=899fbe7e42d494c7c8c159c7001693d5" - -PE = "2" - -DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native udev" - -PROVIDES = "virtual/libgl virtual/libgles1 virtual/libgles2 virtual/egl virtual/mesa" - -inherit autotools pkgconfig pythonnative gettext distro_features_check - -REQUIRED_DISTRO_FEATURES = "opengl" - -EXTRA_OECONF = "--enable-shared-glapi" - -PACKAGECONFIG ??= "gbm egl gles dri ${MESA_CRYPTO} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}\ - ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)}\ - " - -PACKAGECONFIG[gbm] = "--enable-gbm,--disable-gbm" - -X11_DEPS = "xf86driproto glproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes" -PACKAGECONFIG[x11] = "--enable-glx-tls,--disable-glx,${X11_DEPS}" -PACKAGECONFIG[xvmc] = "--enable-xvmc,--disable-xvmc,libxvmc" -PACKAGECONFIG[wayland] = ",,wayland-native wayland" - -DRIDRIVERS = "swrast" -DRIDRIVERS_append_x86 = ",radeon,r200,nouveau,i965,i915" -DRIDRIVERS_append_x86-64 = ",radeon,r200,nouveau,i965,i915" -PACKAGECONFIG[dri] = "--enable-dri --with-dri-drivers=${DRIDRIVERS}, --disable-dri, dri2proto libdrm" -PACKAGECONFIG[dri3] = "--enable-dri3, --disable-dri3, dri3proto presentproto libxshmfence" - -PACKAGECONFIG[gles] = "--enable-gles1 --enable-gles2, --disable-gles1 --disable-gles2" - -EGL_PLATFORMS = "drm" -EGL_PLATFORMS .="${@bb.utils.contains('PACKAGECONFIG', 'x11', ',x11', '', d)}" -EGL_PLATFORMS .="${@bb.utils.contains('PACKAGECONFIG', 'wayland', ',wayland', '', d)}" -PACKAGECONFIG[egl] = "--enable-egl --with-egl-platforms=${EGL_PLATFORMS}, --disable-egl" - -GALLIUMDRIVERS = "swrast" -GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', 'radeonsi,r600', '', d)}" -PACKAGECONFIG[r600] = "" -GALLIUMDRIVERS_LLVM33_ENABLED = "${@base_version_less_or_equal('MESA_LLVM_RELEASE', '3.2', False, len('${GALLIUMDRIVERS_LLVM33}') > 0, d)}" -GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" -GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}" -GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}" -# keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers -PACKAGECONFIG[gallium] = "--with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers" -MESA_LLVM_RELEASE ?= "3.3" -PACKAGECONFIG[gallium-llvm] = "--enable-gallium-llvm --enable-llvm-shared-libs, --disable-gallium-llvm, llvm${MESA_LLVM_RELEASE} \ - ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" -export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" -PACKAGECONFIG[xa] = "--enable-xa, --disable-xa" - -# Mesa requires one of the following crypto implementation, pick one of them -MESA_CRYPTO ??= "openssl" -PACKAGECONFIG[openssl] = "--with-sha1=libcrypto,,openssl" -PACKAGECONFIG[nettle] = "--with-sha1=libnettle,,nettle" -PACKAGECONFIG[gcrypt] = "--with-sha1=libgcrypt,,libgcrypt" - -# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2) -FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer" - -# Multiple virtual/gl providers being built breaks staging -EXCLUDE_FROM_WORLD = "1" - -# Remove the mesa dependency on mesa-dev, as mesa is empty -RDEPENDS_${PN}-dev = "" - -PACKAGES =+ "libegl-mesa libegl-mesa-dev \ - libosmesa libosmesa-dev \ - libgl-mesa libgl-mesa-dev \ - libglapi libglapi-dev \ - libgbm libgbm-dev \ - libgles1-mesa libgles1-mesa-dev \ - libgles2-mesa libgles2-mesa-dev \ - libgles3-mesa libgles3-mesa-dev \ - libwayland-egl libwayland-egl-dev \ - libxvmcsoftpipe libxvmcsoftpipe-dev \ - libxatracker libxatracker-dev \ - mesa-megadriver \ - " - -do_install_append () { - # Drivers never need libtool .la files - rm -f ${D}${libdir}/dri/*.la - rm -f ${D}${libdir}/egl/*.la - rm -f ${D}${libdir}/gallium-pipe/*.la - rm -f ${D}${libdir}/gbm/*.la - - # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used - rm -f ${D}${sysconfdir}/drirc -} - -# For the packages that make up the OpenGL interfaces, inject variables so that -# they don't get Debian-renamed (which would remove the -mesa suffix), and -# RPROVIDEs/RCONFLICTs on the generic libgl name. -python __anonymous() { - pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split() - for p in (("egl", "libegl", "libegl1"), - ("dri", "libgl", "libgl1"), - ("gles", "libgles1", "libglesv1-cm1"), - ("gles", "libgles2", "libglesv2-2"), - ("gles", "libgles3",)): - if not p[0] in pkgconfig: - continue - fullp = p[1] + "-mesa" - pkgs = " ".join(p[1:]) - d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1") - d.appendVar("RREPLACES_" + fullp, pkgs) - d.appendVar("RPROVIDES_" + fullp, pkgs) - d.appendVar("RCONFLICTS_" + fullp, pkgs) - - d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver") - - # For -dev, the first element is both the Debian and original name - fullp += "-dev" - pkgs = p[1] + "-dev" - d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1") - d.appendVar("RREPLACES_" + fullp, pkgs) - d.appendVar("RPROVIDES_" + fullp, pkgs) - d.appendVar("RCONFLICTS_" + fullp, pkgs) -} - -python mesa_populate_packages() { - pkgs = ['mesa', 'mesa-dev', 'mesa-dbg'] - for pkg in pkgs: - d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) - d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) - d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) - - import re - dri_drivers_root = oe.path.join(d.getVar('PKGD', True), d.getVar('libdir', True), "dri") - if os.path.isdir(dri_drivers_root): - dri_pkgs = os.listdir(dri_drivers_root) - lib_name = d.expand("${MLPREFIX}mesa-megadriver") - for p in dri_pkgs: - m = re.match('^(.*)_dri\.so$', p) - if m: - pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1)) - d.appendVar("RPROVIDES_%s" % lib_name, pkg_name) - d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name) - d.appendVar("RREPLACES_%s" % lib_name, pkg_name) - - pipe_drivers_root = os.path.join(d.getVar('libdir', True), "gallium-pipe") - do_split_packages(d, pipe_drivers_root, '^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='') -} - -PACKAGESPLITFUNCS_prepend = "mesa_populate_packages " - -PACKAGES_DYNAMIC += "^mesa-driver-.*" - -FILES_${PN} += "${sysconfdir}/drirc" -FILES_mesa-megadriver = "${libdir}/dri/*" -FILES_libegl-mesa = "${libdir}/libEGL.so.*" -FILES_libgbm = "${libdir}/libgbm.so.*" -FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*" -FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*" -FILES_libgl-mesa = "${libdir}/libGL.so.*" -FILES_libglapi = "${libdir}/libglapi.so.*" -FILES_libosmesa = "${libdir}/libOSMesa.so.*" -FILES_libwayland-egl = "${libdir}/libwayland-egl.so.*" -FILES_libxvmcsoftpipe = "${libdir}/libXvMCsoftpipe.so.*" -FILES_libxatracker = "${libdir}/libxatracker.so.*" - -FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc" -FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc" -FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h" -FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc" -FILES_libglapi-dev = "${libdir}/libglapi.*" -FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" -FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" -FILES_libgles3-mesa-dev = "${includedir}/GLES3" -FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/osmesa.h ${libdir}/pkgconfig/osmesa.pc" -FILES_libwayland-egl-dev = "${libdir}/pkgconfig/wayland-egl.pc ${libdir}/libwayland-egl.*" -FILES_libxvmcsoftpipe-dev = "${libdir}/libXvMCsoftpipe.so ${libdir}/libXvMCsoftpipe.la" -FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \ - ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \ - ${libdir}/pkgconfig/xatracker.pc" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa_12.0.3.bb b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa_12.0.3.bb deleted file mode 100644 index acc8353dd..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa_12.0.3.bb +++ /dev/null @@ -1,17 +0,0 @@ -require ${BPN}.inc - -SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/${PV}/mesa-${PV}.tar.xz \ - file://replace_glibc_check_with_linux.patch \ - file://disable-asm-on-non-gcc.patch \ -" - -SRC_URI[md5sum] = "1113699c714042d8c4df4766be8c57d8" -SRC_URI[sha256sum] = "1dc86dd9b51272eee1fad3df65e18cda2e556ef1bc0b6e07cd750b9757f493b1" - -#because we cannot rely on the fact that all apps will use pkgconfig, -#make eglplatform.h independent of MESA_EGL_NO_X11_HEADER -do_install_append() { - if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)}; then - sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if defined(MESA_EGL_NO_X11_HEADERS) || ${@bb.utils.contains('PACKAGECONFIG', 'x11', '0', '1', d)}/' ${D}${includedir}/EGL/eglplatform.h - fi -} diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0001-mm-larger-stack-guard-gap-between-vmas.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0001-mm-larger-stack-guard-gap-between-vmas.patch deleted file mode 100644 index e9fafad74..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0001-mm-larger-stack-guard-gap-between-vmas.patch +++ /dev/null @@ -1,900 +0,0 @@ -From 3982d0807e02909957990f194c5ed2ffb6ab6c35 Mon Sep 17 00:00:00 2001 -From: Hugh Dickins <hughd@google.com> -Date: Mon, 19 Jun 2017 04:03:24 -0700 -Subject: [PATCH 1/3] mm: larger stack guard gap, between vmas - -commit 1be7107fbe18eed3e319a6c3e83c78254b693acb upstream. - -Stack guard page is a useful feature to reduce a risk of stack smashing -into a different mapping. We have been using a single page gap which -is sufficient to prevent having stack adjacent to a different mapping. -But this seems to be insufficient in the light of the stack usage in -userspace. E.g. glibc uses as large as 64kB alloca() in many commonly -used functions. Others use constructs liks gid_t buffer[NGROUPS_MAX] -which is 256kB or stack strings with MAX_ARG_STRLEN. - -This will become especially dangerous for suid binaries and the default -no limit for the stack size limit because those applications can be -tricked to consume a large portion of the stack and a single glibc call -could jump over the guard page. These attacks are not theoretical, -unfortunatelly. - -Make those attacks less probable by increasing the stack guard gap -to 1MB (on systems with 4k pages; but make it depend on the page size -because systems with larger base pages might cap stack allocations in -the PAGE_SIZE units) which should cover larger alloca() and VLA stack -allocations. It is obviously not a full fix because the problem is -somehow inherent, but it should reduce attack space a lot. - -One could argue that the gap size should be configurable from userspace, -but that can be done later when somebody finds that the new 1MB is wrong -for some special case applications. For now, add a kernel command line -option (stack_guard_gap) to specify the stack gap size (in page units). - -Implementation wise, first delete all the old code for stack guard page: -because although we could get away with accounting one extra page in a -stack vma, accounting a larger gap can break userspace - case in point, -a program run with "ulimit -S -v 20000" failed when the 1MB gap was -counted for RLIMIT_AS; similar problems could come with RLIMIT_MLOCK -and strict non-overcommit mode. - -Instead of keeping gap inside the stack vma, maintain the stack guard -gap as a gap between vmas: using vm_start_gap() in place of vm_start -(or vm_end_gap() in place of vm_end if VM_GROWSUP) in just those few -places which need to respect the gap - mainly arch_get_unmapped_area(), -and and the vma tree's subtree_gap support for that. - -Original-patch-by: Oleg Nesterov <oleg@redhat.com> -Original-patch-by: Michal Hocko <mhocko@suse.com> -Signed-off-by: Hugh Dickins <hughd@google.com> -Acked-by: Michal Hocko <mhocko@suse.com> -Tested-by: Helge Deller <deller@gmx.de> # parisc -Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> -[wt: backport to 4.11: adjust context] -[wt: backport to 4.9: adjust context ; kernel doc was not in admin-guide] -[wt: backport to 4.4: adjust context ; drop ppc hugetlb_radix changes] -Signed-off-by: Willy Tarreau <w@1wt.eu> -[gkh: minor build fixes for 4.4] -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - Documentation/kernel-parameters.txt | 7 ++ - arch/arc/mm/mmap.c | 2 +- - arch/arm/mm/mmap.c | 4 +- - arch/frv/mm/elf-fdpic.c | 2 +- - arch/mips/mm/mmap.c | 2 +- - arch/parisc/kernel/sys_parisc.c | 15 ++-- - arch/powerpc/mm/slice.c | 2 +- - arch/s390/mm/mmap.c | 4 +- - arch/sh/mm/mmap.c | 4 +- - arch/sparc/kernel/sys_sparc_64.c | 4 +- - arch/sparc/mm/hugetlbpage.c | 2 +- - arch/tile/mm/hugetlbpage.c | 2 +- - arch/x86/kernel/sys_x86_64.c | 4 +- - arch/x86/mm/hugetlbpage.c | 2 +- - arch/xtensa/kernel/syscall.c | 2 +- - fs/hugetlbfs/inode.c | 2 +- - fs/proc/task_mmu.c | 4 - - include/linux/mm.h | 53 ++++++------- - mm/gup.c | 5 -- - mm/memory.c | 38 --------- - mm/mmap.c | 149 +++++++++++++++++++++--------------- - 21 files changed, 149 insertions(+), 160 deletions(-) - -diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt -index c360f80..9738c8b 100644 ---- a/Documentation/kernel-parameters.txt -+++ b/Documentation/kernel-parameters.txt -@@ -3576,6 +3576,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. - spia_pedr= - spia_peddr= - -+ stack_guard_gap= [MM] -+ override the default stack gap protection. The value -+ is in page units and it defines how many pages prior -+ to (for stacks growing down) resp. after (for stacks -+ growing up) the main stack are reserved for no other -+ mapping. Default value is 256 pages. -+ - stacktrace [FTRACE] - Enabled the stack tracer on boot up. - -diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c -index 2e06d56..cf4ae69 100644 ---- a/arch/arc/mm/mmap.c -+++ b/arch/arc/mm/mmap.c -@@ -64,7 +64,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c -index 407dc78..c469c06 100644 ---- a/arch/arm/mm/mmap.c -+++ b/arch/arm/mm/mmap.c -@@ -89,7 +89,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -140,7 +140,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c -index 836f147..efa59f1 100644 ---- a/arch/frv/mm/elf-fdpic.c -+++ b/arch/frv/mm/elf-fdpic.c -@@ -74,7 +74,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi - addr = PAGE_ALIGN(addr); - vma = find_vma(current->mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - goto success; - } - -diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c -index 5c81fdd..025cb31 100644 ---- a/arch/mips/mm/mmap.c -+++ b/arch/mips/mm/mmap.c -@@ -92,7 +92,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c -index 5aba01a..4dda73c 100644 ---- a/arch/parisc/kernel/sys_parisc.c -+++ b/arch/parisc/kernel/sys_parisc.c -@@ -88,7 +88,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) - { - struct mm_struct *mm = current->mm; -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - unsigned long task_size = TASK_SIZE; - int do_color_align, last_mmap; - struct vm_unmapped_area_info info; -@@ -115,9 +115,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - else - addr = PAGE_ALIGN(addr); - -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - goto found_addr; - } - -@@ -141,7 +142,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - const unsigned long len, const unsigned long pgoff, - const unsigned long flags) - { -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct mm_struct *mm = current->mm; - unsigned long addr = addr0; - int do_color_align, last_mmap; -@@ -175,9 +176,11 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = COLOR_ALIGN(addr, last_mmap, pgoff); - else - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - goto found_addr; - } - -diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c -index 0f432a7..6ad12b2 100644 ---- a/arch/powerpc/mm/slice.c -+++ b/arch/powerpc/mm/slice.c -@@ -105,7 +105,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr, - if ((mm->task_size - len) < addr) - return 0; - vma = find_vma(mm, addr); -- return (!vma || (addr + len) <= vma->vm_start); -+ return (!vma || (addr + len) <= vm_start_gap(vma)); - } - - static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice) -diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c -index f2b6b1d..126c4a9 100644 ---- a/arch/s390/mm/mmap.c -+++ b/arch/s390/mm/mmap.c -@@ -97,7 +97,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -135,7 +135,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c -index 6777177..7df7d59 100644 ---- a/arch/sh/mm/mmap.c -+++ b/arch/sh/mm/mmap.c -@@ -63,7 +63,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -113,7 +113,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c -index c690c8e..7f0f7c01 100644 ---- a/arch/sparc/kernel/sys_sparc_64.c -+++ b/arch/sparc/kernel/sys_sparc_64.c -@@ -118,7 +118,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi - - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -181,7 +181,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c -index da11424..ffa842b 100644 ---- a/arch/sparc/mm/hugetlbpage.c -+++ b/arch/sparc/mm/hugetlbpage.c -@@ -115,7 +115,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, HPAGE_SIZE); - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c -index c034dc3..c97ee6c 100644 ---- a/arch/tile/mm/hugetlbpage.c -+++ b/arch/tile/mm/hugetlbpage.c -@@ -232,7 +232,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (current->mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c -index 10e0272..136ad7c 100644 ---- a/arch/x86/kernel/sys_x86_64.c -+++ b/arch/x86/kernel/sys_x86_64.c -@@ -143,7 +143,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (end - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -186,7 +186,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c -index 42982b2..39bdaf3 100644 ---- a/arch/x86/mm/hugetlbpage.c -+++ b/arch/x86/mm/hugetlbpage.c -@@ -144,7 +144,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c -index 83cf496..3aaaae1 100644 ---- a/arch/xtensa/kernel/syscall.c -+++ b/arch/xtensa/kernel/syscall.c -@@ -87,7 +87,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - /* At this point: (!vmm || addr < vmm->vm_end). */ - if (TASK_SIZE - len < addr) - return -ENOMEM; -- if (!vmm || addr + len <= vmm->vm_start) -+ if (!vmm || addr + len <= vm_start_gap(vmm)) - return addr; - addr = vmm->vm_end; - if (flags & MAP_SHARED) -diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c -index 595ebdb..a17da8b5 100644 ---- a/fs/hugetlbfs/inode.c -+++ b/fs/hugetlbfs/inode.c -@@ -191,7 +191,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index d598b9c..cb7020c 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -295,11 +295,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) - - /* We don't show the stack guard page in /proc/maps */ - start = vma->vm_start; -- if (stack_guard_page_start(vma, start)) -- start += PAGE_SIZE; - end = vma->vm_end; -- if (stack_guard_page_end(vma, end)) -- end -= PAGE_SIZE; - - seq_setwidth(m, 25 + sizeof(void *) * 6 - 1); - seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ", -diff --git a/include/linux/mm.h b/include/linux/mm.h -index f0ffa01..55f950a 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -1278,39 +1278,11 @@ int clear_page_dirty_for_io(struct page *page); - - int get_cmdline(struct task_struct *task, char *buffer, int buflen); - --/* Is the vma a continuation of the stack vma above it? */ --static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr) --{ -- return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); --} -- - static inline bool vma_is_anonymous(struct vm_area_struct *vma) - { - return !vma->vm_ops; - } - --static inline int stack_guard_page_start(struct vm_area_struct *vma, -- unsigned long addr) --{ -- return (vma->vm_flags & VM_GROWSDOWN) && -- (vma->vm_start == addr) && -- !vma_growsdown(vma->vm_prev, addr); --} -- --/* Is the vma a continuation of the stack vma below it? */ --static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr) --{ -- return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP); --} -- --static inline int stack_guard_page_end(struct vm_area_struct *vma, -- unsigned long addr) --{ -- return (vma->vm_flags & VM_GROWSUP) && -- (vma->vm_end == addr) && -- !vma_growsup(vma->vm_next, addr); --} -- - int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t); - - extern unsigned long move_page_tables(struct vm_area_struct *vma, -@@ -2012,6 +1984,7 @@ void page_cache_async_readahead(struct address_space *mapping, - pgoff_t offset, - unsigned long size); - -+extern unsigned long stack_guard_gap; - /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ - extern int expand_stack(struct vm_area_struct *vma, unsigned long address); - -@@ -2040,6 +2013,30 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m - return vma; - } - -+static inline unsigned long vm_start_gap(struct vm_area_struct *vma) -+{ -+ unsigned long vm_start = vma->vm_start; -+ -+ if (vma->vm_flags & VM_GROWSDOWN) { -+ vm_start -= stack_guard_gap; -+ if (vm_start > vma->vm_start) -+ vm_start = 0; -+ } -+ return vm_start; -+} -+ -+static inline unsigned long vm_end_gap(struct vm_area_struct *vma) -+{ -+ unsigned long vm_end = vma->vm_end; -+ -+ if (vma->vm_flags & VM_GROWSUP) { -+ vm_end += stack_guard_gap; -+ if (vm_end < vma->vm_end) -+ vm_end = -PAGE_SIZE; -+ } -+ return vm_end; -+} -+ - static inline unsigned long vma_pages(struct vm_area_struct *vma) - { - return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; -diff --git a/mm/gup.c b/mm/gup.c -index 4b0b7e7..b599526 100644 ---- a/mm/gup.c -+++ b/mm/gup.c -@@ -312,11 +312,6 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, - /* mlock all present pages, but do not fault in new pages */ - if ((*flags & (FOLL_POPULATE | FOLL_MLOCK)) == FOLL_MLOCK) - return -ENOENT; -- /* For mm_populate(), just skip the stack guard page. */ -- if ((*flags & FOLL_POPULATE) && -- (stack_guard_page_start(vma, address) || -- stack_guard_page_end(vma, address + PAGE_SIZE))) -- return -ENOENT; - if (*flags & FOLL_WRITE) - fault_flags |= FAULT_FLAG_WRITE; - if (nonblocking) -diff --git a/mm/memory.c b/mm/memory.c -index 76dcee3..e6fa134 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -2662,40 +2662,6 @@ out_release: - } - - /* -- * This is like a special single-page "expand_{down|up}wards()", -- * except we must first make sure that 'address{-|+}PAGE_SIZE' -- * doesn't hit another vma. -- */ --static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address) --{ -- address &= PAGE_MASK; -- if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) { -- struct vm_area_struct *prev = vma->vm_prev; -- -- /* -- * Is there a mapping abutting this one below? -- * -- * That's only ok if it's the same stack mapping -- * that has gotten split.. -- */ -- if (prev && prev->vm_end == address) -- return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM; -- -- return expand_downwards(vma, address - PAGE_SIZE); -- } -- if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) { -- struct vm_area_struct *next = vma->vm_next; -- -- /* As VM_GROWSDOWN but s/below/above/ */ -- if (next && next->vm_start == address + PAGE_SIZE) -- return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM; -- -- return expand_upwards(vma, address + PAGE_SIZE); -- } -- return 0; --} -- --/* - * We enter with non-exclusive mmap_sem (to exclude vma changes, - * but allow concurrent faults), and pte mapped but not yet locked. - * We return with mmap_sem still held, but pte unmapped and unlocked. -@@ -2715,10 +2681,6 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, - if (vma->vm_flags & VM_SHARED) - return VM_FAULT_SIGBUS; - -- /* Check if we need to add a guard page to the stack */ -- if (check_stack_guard_page(vma, address) < 0) -- return VM_FAULT_SIGSEGV; -- - /* Use the zero-page for reads */ - if (!(flags & FAULT_FLAG_WRITE) && !mm_forbids_zeropage(mm)) { - entry = pte_mkspecial(pfn_pte(my_zero_pfn(address), -diff --git a/mm/mmap.c b/mm/mmap.c -index 455772a..5e043dd 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -288,6 +288,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) - unsigned long retval; - unsigned long newbrk, oldbrk; - struct mm_struct *mm = current->mm; -+ struct vm_area_struct *next; - unsigned long min_brk; - bool populate; - -@@ -332,7 +333,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) - } - - /* Check against existing mmap mappings. */ -- if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE)) -+ next = find_vma(mm, oldbrk); -+ if (next && newbrk + PAGE_SIZE > vm_start_gap(next)) - goto out; - - /* Ok, looks good - let it rip. */ -@@ -355,10 +357,22 @@ out: - - static long vma_compute_subtree_gap(struct vm_area_struct *vma) - { -- unsigned long max, subtree_gap; -- max = vma->vm_start; -- if (vma->vm_prev) -- max -= vma->vm_prev->vm_end; -+ unsigned long max, prev_end, subtree_gap; -+ -+ /* -+ * Note: in the rare case of a VM_GROWSDOWN above a VM_GROWSUP, we -+ * allow two stack_guard_gaps between them here, and when choosing -+ * an unmapped area; whereas when expanding we only require one. -+ * That's a little inconsistent, but keeps the code here simpler. -+ */ -+ max = vm_start_gap(vma); -+ if (vma->vm_prev) { -+ prev_end = vm_end_gap(vma->vm_prev); -+ if (max > prev_end) -+ max -= prev_end; -+ else -+ max = 0; -+ } - if (vma->vm_rb.rb_left) { - subtree_gap = rb_entry(vma->vm_rb.rb_left, - struct vm_area_struct, vm_rb)->rb_subtree_gap; -@@ -451,7 +465,7 @@ static void validate_mm(struct mm_struct *mm) - anon_vma_unlock_read(anon_vma); - } - -- highest_address = vma->vm_end; -+ highest_address = vm_end_gap(vma); - vma = vma->vm_next; - i++; - } -@@ -620,7 +634,7 @@ void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, - if (vma->vm_next) - vma_gap_update(vma->vm_next); - else -- mm->highest_vm_end = vma->vm_end; -+ mm->highest_vm_end = vm_end_gap(vma); - - /* - * vma->vm_prev wasn't known when we followed the rbtree to find the -@@ -866,7 +880,7 @@ again: remove_next = 1 + (end > next->vm_end); - vma_gap_update(vma); - if (end_changed) { - if (!next) -- mm->highest_vm_end = end; -+ mm->highest_vm_end = vm_end_gap(vma); - else if (!adjust_next) - vma_gap_update(next); - } -@@ -909,7 +923,7 @@ again: remove_next = 1 + (end > next->vm_end); - else if (next) - vma_gap_update(next); - else -- mm->highest_vm_end = end; -+ VM_WARN_ON(mm->highest_vm_end != vm_end_gap(vma)); - } - if (insert && file) - uprobe_mmap(insert); -@@ -1741,7 +1755,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) - - while (true) { - /* Visit left subtree if it looks promising */ -- gap_end = vma->vm_start; -+ gap_end = vm_start_gap(vma); - if (gap_end >= low_limit && vma->vm_rb.rb_left) { - struct vm_area_struct *left = - rb_entry(vma->vm_rb.rb_left, -@@ -1752,7 +1766,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) - } - } - -- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; -+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0; - check_current: - /* Check if current node has a suitable gap */ - if (gap_start > high_limit) -@@ -1779,8 +1793,8 @@ check_current: - vma = rb_entry(rb_parent(prev), - struct vm_area_struct, vm_rb); - if (prev == vma->vm_rb.rb_left) { -- gap_start = vma->vm_prev->vm_end; -- gap_end = vma->vm_start; -+ gap_start = vm_end_gap(vma->vm_prev); -+ gap_end = vm_start_gap(vma); - goto check_current; - } - } -@@ -1844,7 +1858,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) - - while (true) { - /* Visit right subtree if it looks promising */ -- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; -+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0; - if (gap_start <= high_limit && vma->vm_rb.rb_right) { - struct vm_area_struct *right = - rb_entry(vma->vm_rb.rb_right, -@@ -1857,7 +1871,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) - - check_current: - /* Check if current node has a suitable gap */ -- gap_end = vma->vm_start; -+ gap_end = vm_start_gap(vma); - if (gap_end < low_limit) - return -ENOMEM; - if (gap_start <= high_limit && gap_end - gap_start >= length) -@@ -1883,7 +1897,7 @@ check_current: - struct vm_area_struct, vm_rb); - if (prev == vma->vm_rb.rb_right) { - gap_start = vma->vm_prev ? -- vma->vm_prev->vm_end : 0; -+ vm_end_gap(vma->vm_prev) : 0; - goto check_current; - } - } -@@ -1921,7 +1935,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) - { - struct mm_struct *mm = current->mm; -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct vm_unmapped_area_info info; - - if (len > TASK_SIZE - mmap_min_addr) -@@ -1932,9 +1946,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - if (addr) { - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - return addr; - } - -@@ -1957,7 +1972,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - const unsigned long len, const unsigned long pgoff, - const unsigned long flags) - { -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct mm_struct *mm = current->mm; - unsigned long addr = addr0; - struct vm_unmapped_area_info info; -@@ -1972,9 +1987,10 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - /* requesting a specific address */ - if (addr) { - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - return addr; - } - -@@ -2099,21 +2115,19 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr, - * update accounting. This is shared with both the - * grow-up and grow-down cases. - */ --static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow) -+static int acct_stack_growth(struct vm_area_struct *vma, -+ unsigned long size, unsigned long grow) - { - struct mm_struct *mm = vma->vm_mm; - struct rlimit *rlim = current->signal->rlim; -- unsigned long new_start, actual_size; -+ unsigned long new_start; - - /* address space limit tests */ - if (!may_expand_vm(mm, grow)) - return -ENOMEM; - - /* Stack limit test */ -- actual_size = size; -- if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN))) -- actual_size -= PAGE_SIZE; -- if (actual_size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) -+ if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) - return -ENOMEM; - - /* mlock limit tests */ -@@ -2151,17 +2165,30 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns - int expand_upwards(struct vm_area_struct *vma, unsigned long address) - { - struct mm_struct *mm = vma->vm_mm; -+ struct vm_area_struct *next; -+ unsigned long gap_addr; - int error = 0; - - if (!(vma->vm_flags & VM_GROWSUP)) - return -EFAULT; - - /* Guard against wrapping around to address 0. */ -- if (address < PAGE_ALIGN(address+4)) -- address = PAGE_ALIGN(address+4); -- else -+ address &= PAGE_MASK; -+ address += PAGE_SIZE; -+ if (!address) - return -ENOMEM; - -+ /* Enforce stack_guard_gap */ -+ gap_addr = address + stack_guard_gap; -+ if (gap_addr < address) -+ return -ENOMEM; -+ next = vma->vm_next; -+ if (next && next->vm_start < gap_addr) { -+ if (!(next->vm_flags & VM_GROWSUP)) -+ return -ENOMEM; -+ /* Check that both stack segments have the same anon_vma? */ -+ } -+ - /* We must make sure the anon_vma is allocated. */ - if (unlikely(anon_vma_prepare(vma))) - return -ENOMEM; -@@ -2206,7 +2233,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) - if (vma->vm_next) - vma_gap_update(vma->vm_next); - else -- mm->highest_vm_end = address; -+ mm->highest_vm_end = vm_end_gap(vma); - spin_unlock(&mm->page_table_lock); - - perf_event_mmap(vma); -@@ -2227,6 +2254,8 @@ int expand_downwards(struct vm_area_struct *vma, - unsigned long address) - { - struct mm_struct *mm = vma->vm_mm; -+ struct vm_area_struct *prev; -+ unsigned long gap_addr; - int error; - - address &= PAGE_MASK; -@@ -2234,6 +2263,17 @@ int expand_downwards(struct vm_area_struct *vma, - if (error) - return error; - -+ /* Enforce stack_guard_gap */ -+ gap_addr = address - stack_guard_gap; -+ if (gap_addr > address) -+ return -ENOMEM; -+ prev = vma->vm_prev; -+ if (prev && prev->vm_end > gap_addr) { -+ if (!(prev->vm_flags & VM_GROWSDOWN)) -+ return -ENOMEM; -+ /* Check that both stack segments have the same anon_vma? */ -+ } -+ - /* We must make sure the anon_vma is allocated. */ - if (unlikely(anon_vma_prepare(vma))) - return -ENOMEM; -@@ -2289,28 +2329,25 @@ int expand_downwards(struct vm_area_struct *vma, - return error; - } - --/* -- * Note how expand_stack() refuses to expand the stack all the way to -- * abut the next virtual mapping, *unless* that mapping itself is also -- * a stack mapping. We want to leave room for a guard page, after all -- * (the guard page itself is not added here, that is done by the -- * actual page faulting logic) -- * -- * This matches the behavior of the guard page logic (see mm/memory.c: -- * check_stack_guard_page()), which only allows the guard page to be -- * removed under these circumstances. -- */ -+/* enforced gap between the expanding stack and other mappings. */ -+unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT; -+ -+static int __init cmdline_parse_stack_guard_gap(char *p) -+{ -+ unsigned long val; -+ char *endptr; -+ -+ val = simple_strtoul(p, &endptr, 10); -+ if (!*endptr) -+ stack_guard_gap = val << PAGE_SHIFT; -+ -+ return 0; -+} -+__setup("stack_guard_gap=", cmdline_parse_stack_guard_gap); -+ - #ifdef CONFIG_STACK_GROWSUP - int expand_stack(struct vm_area_struct *vma, unsigned long address) - { -- struct vm_area_struct *next; -- -- address &= PAGE_MASK; -- next = vma->vm_next; -- if (next && next->vm_start == address + PAGE_SIZE) { -- if (!(next->vm_flags & VM_GROWSUP)) -- return -ENOMEM; -- } - return expand_upwards(vma, address); - } - -@@ -2332,14 +2369,6 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) - #else - int expand_stack(struct vm_area_struct *vma, unsigned long address) - { -- struct vm_area_struct *prev; -- -- address &= PAGE_MASK; -- prev = vma->vm_prev; -- if (prev && prev->vm_end == address) { -- if (!(prev->vm_flags & VM_GROWSDOWN)) -- return -ENOMEM; -- } - return expand_downwards(vma, address); - } - -@@ -2437,7 +2466,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, - vma->vm_prev = prev; - vma_gap_update(vma); - } else -- mm->highest_vm_end = prev ? prev->vm_end : 0; -+ mm->highest_vm_end = prev ? vm_end_gap(prev) : 0; - tail_vma->vm_next = NULL; - - /* Kill the cache */ --- -2.1.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0002-Allow-stack-to-grow-up-to-address-space-limit.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0002-Allow-stack-to-grow-up-to-address-space-limit.patch deleted file mode 100644 index d0c94cef2..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0002-Allow-stack-to-grow-up-to-address-space-limit.patch +++ /dev/null @@ -1,51 +0,0 @@ -From cd20f002742028366c33b38b3ca613eaee4582c9 Mon Sep 17 00:00:00 2001 -From: Helge Deller <deller@gmx.de> -Date: Mon, 19 Jun 2017 17:34:05 +0200 -Subject: [PATCH 2/3] Allow stack to grow up to address space limit - -commit bd726c90b6b8ce87602208701b208a208e6d5600 upstream. - -Fix expand_upwards() on architectures with an upward-growing stack (parisc, -metag and partly IA-64) to allow the stack to reliably grow exactly up to -the address space limit given by TASK_SIZE. - -Signed-off-by: Helge Deller <deller@gmx.de> -Acked-by: Hugh Dickins <hughd@google.com> -Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - mm/mmap.c | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/mm/mmap.c b/mm/mmap.c -index 5e043dd..fcf4c88 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -2172,16 +2172,19 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) - if (!(vma->vm_flags & VM_GROWSUP)) - return -EFAULT; - -- /* Guard against wrapping around to address 0. */ -+ /* Guard against exceeding limits of the address space. */ - address &= PAGE_MASK; -- address += PAGE_SIZE; -- if (!address) -+ if (address >= TASK_SIZE) - return -ENOMEM; -+ address += PAGE_SIZE; - - /* Enforce stack_guard_gap */ - gap_addr = address + stack_guard_gap; -- if (gap_addr < address) -- return -ENOMEM; -+ -+ /* Guard against overflow */ -+ if (gap_addr < address || gap_addr > TASK_SIZE) -+ gap_addr = TASK_SIZE; -+ - next = vma->vm_next; - if (next && next->vm_start < gap_addr) { - if (!(next->vm_flags & VM_GROWSUP)) --- -2.1.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch deleted file mode 100644 index 3f0acfa29..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.4/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 1c182004bcb1cd619b58ba6631b9d88052d18e02 Mon Sep 17 00:00:00 2001 -From: Hugh Dickins <hughd@google.com> -Date: Tue, 20 Jun 2017 02:10:44 -0700 -Subject: [PATCH 3/3] mm: fix new crash in unmapped_area_topdown() - -commit f4cb767d76cf7ee72f97dd76f6cfa6c76a5edc89 upstream. - -Trinity gets kernel BUG at mm/mmap.c:1963! in about 3 minutes of -mmap testing. That's the VM_BUG_ON(gap_end < gap_start) at the -end of unmapped_area_topdown(). Linus points out how MAP_FIXED -(which does not have to respect our stack guard gap intentions) -could result in gap_end below gap_start there. Fix that, and -the similar case in its alternative, unmapped_area(). - -Fixes: 1be7107fbe18 ("mm: larger stack guard gap, between vmas") -Reported-by: Dave Jones <davej@codemonkey.org.uk> -Debugged-by: Linus Torvalds <torvalds@linux-foundation.org> -Signed-off-by: Hugh Dickins <hughd@google.com> -Acked-by: Michal Hocko <mhocko@suse.com> -Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - mm/mmap.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/mm/mmap.c b/mm/mmap.c -index fcf4c88..0990f8b 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -1771,7 +1771,8 @@ check_current: - /* Check if current node has a suitable gap */ - if (gap_start > high_limit) - return -ENOMEM; -- if (gap_end >= low_limit && gap_end - gap_start >= length) -+ if (gap_end >= low_limit && -+ gap_end > gap_start && gap_end - gap_start >= length) - goto found; - - /* Visit right subtree if it looks promising */ -@@ -1874,7 +1875,8 @@ check_current: - gap_end = vm_start_gap(vma); - if (gap_end < low_limit) - return -ENOMEM; -- if (gap_start <= high_limit && gap_end - gap_start >= length) -+ if (gap_start <= high_limit && -+ gap_end > gap_start && gap_end - gap_start >= length) - goto found; - - /* Visit left subtree if it looks promising */ --- -2.1.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0001-mm-larger-stack-guard-gap-between-vmas.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0001-mm-larger-stack-guard-gap-between-vmas.patch deleted file mode 100644 index 06fed097b..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0001-mm-larger-stack-guard-gap-between-vmas.patch +++ /dev/null @@ -1,935 +0,0 @@ -From d2fe80af1664f169498f6e624a8ea01e4e28efe2 Mon Sep 17 00:00:00 2001 -From: Hugh Dickins <hughd@google.com> -Date: Mon, 19 Jun 2017 04:03:24 -0700 -Subject: [PATCH 1/3] mm: larger stack guard gap, between vmas - -commit 1be7107fbe18eed3e319a6c3e83c78254b693acb upstream. - -Stack guard page is a useful feature to reduce a risk of stack smashing -into a different mapping. We have been using a single page gap which -is sufficient to prevent having stack adjacent to a different mapping. -But this seems to be insufficient in the light of the stack usage in -userspace. E.g. glibc uses as large as 64kB alloca() in many commonly -used functions. Others use constructs liks gid_t buffer[NGROUPS_MAX] -which is 256kB or stack strings with MAX_ARG_STRLEN. - -This will become especially dangerous for suid binaries and the default -no limit for the stack size limit because those applications can be -tricked to consume a large portion of the stack and a single glibc call -could jump over the guard page. These attacks are not theoretical, -unfortunatelly. - -Make those attacks less probable by increasing the stack guard gap -to 1MB (on systems with 4k pages; but make it depend on the page size -because systems with larger base pages might cap stack allocations in -the PAGE_SIZE units) which should cover larger alloca() and VLA stack -allocations. It is obviously not a full fix because the problem is -somehow inherent, but it should reduce attack space a lot. - -One could argue that the gap size should be configurable from userspace, -but that can be done later when somebody finds that the new 1MB is wrong -for some special case applications. For now, add a kernel command line -option (stack_guard_gap) to specify the stack gap size (in page units). - -Implementation wise, first delete all the old code for stack guard page: -because although we could get away with accounting one extra page in a -stack vma, accounting a larger gap can break userspace - case in point, -a program run with "ulimit -S -v 20000" failed when the 1MB gap was -counted for RLIMIT_AS; similar problems could come with RLIMIT_MLOCK -and strict non-overcommit mode. - -Instead of keeping gap inside the stack vma, maintain the stack guard -gap as a gap between vmas: using vm_start_gap() in place of vm_start -(or vm_end_gap() in place of vm_end if VM_GROWSUP) in just those few -places which need to respect the gap - mainly arch_get_unmapped_area(), -and and the vma tree's subtree_gap support for that. - -Original-patch-by: Oleg Nesterov <oleg@redhat.com> -Original-patch-by: Michal Hocko <mhocko@suse.com> -Signed-off-by: Hugh Dickins <hughd@google.com> -Acked-by: Michal Hocko <mhocko@suse.com> -Tested-by: Helge Deller <deller@gmx.de> # parisc -Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> -[wt: backport to 4.11: adjust context] -[wt: backport to 4.9: adjust context ; kernel doc was not in admin-guide] -Signed-off-by: Willy Tarreau <w@1wt.eu> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - Documentation/kernel-parameters.txt | 7 ++ - arch/arc/mm/mmap.c | 2 +- - arch/arm/mm/mmap.c | 4 +- - arch/frv/mm/elf-fdpic.c | 2 +- - arch/mips/mm/mmap.c | 2 +- - arch/parisc/kernel/sys_parisc.c | 15 ++-- - arch/powerpc/mm/hugetlbpage-radix.c | 2 +- - arch/powerpc/mm/mmap.c | 4 +- - arch/powerpc/mm/slice.c | 2 +- - arch/s390/mm/mmap.c | 4 +- - arch/sh/mm/mmap.c | 4 +- - arch/sparc/kernel/sys_sparc_64.c | 4 +- - arch/sparc/mm/hugetlbpage.c | 2 +- - arch/tile/mm/hugetlbpage.c | 2 +- - arch/x86/kernel/sys_x86_64.c | 4 +- - arch/x86/mm/hugetlbpage.c | 2 +- - arch/xtensa/kernel/syscall.c | 2 +- - fs/hugetlbfs/inode.c | 2 +- - fs/proc/task_mmu.c | 4 - - include/linux/mm.h | 53 ++++++------- - mm/gup.c | 5 -- - mm/memory.c | 38 --------- - mm/mmap.c | 149 +++++++++++++++++++++--------------- - 23 files changed, 152 insertions(+), 163 deletions(-) - -diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt -index 65b05ba..29de8cf 100644 ---- a/Documentation/kernel-parameters.txt -+++ b/Documentation/kernel-parameters.txt -@@ -3922,6 +3922,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. - spia_pedr= - spia_peddr= - -+ stack_guard_gap= [MM] -+ override the default stack gap protection. The value -+ is in page units and it defines how many pages prior -+ to (for stacks growing down) resp. after (for stacks -+ growing up) the main stack are reserved for no other -+ mapping. Default value is 256 pages. -+ - stacktrace [FTRACE] - Enabled the stack tracer on boot up. - -diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c -index 2e06d56..cf4ae69 100644 ---- a/arch/arc/mm/mmap.c -+++ b/arch/arc/mm/mmap.c -@@ -64,7 +64,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c -index 66353ca..641334e 100644 ---- a/arch/arm/mm/mmap.c -+++ b/arch/arm/mm/mmap.c -@@ -89,7 +89,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -140,7 +140,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c -index 836f147..efa59f1 100644 ---- a/arch/frv/mm/elf-fdpic.c -+++ b/arch/frv/mm/elf-fdpic.c -@@ -74,7 +74,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi - addr = PAGE_ALIGN(addr); - vma = find_vma(current->mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - goto success; - } - -diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c -index d08ea3f..a44052c 100644 ---- a/arch/mips/mm/mmap.c -+++ b/arch/mips/mm/mmap.c -@@ -92,7 +92,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c -index 0a393a0..1d7691f 100644 ---- a/arch/parisc/kernel/sys_parisc.c -+++ b/arch/parisc/kernel/sys_parisc.c -@@ -88,7 +88,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) - { - struct mm_struct *mm = current->mm; -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - unsigned long task_size = TASK_SIZE; - int do_color_align, last_mmap; - struct vm_unmapped_area_info info; -@@ -115,9 +115,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - else - addr = PAGE_ALIGN(addr); - -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - goto found_addr; - } - -@@ -141,7 +142,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - const unsigned long len, const unsigned long pgoff, - const unsigned long flags) - { -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct mm_struct *mm = current->mm; - unsigned long addr = addr0; - int do_color_align, last_mmap; -@@ -175,9 +176,11 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = COLOR_ALIGN(addr, last_mmap, pgoff); - else - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - goto found_addr; - } - -diff --git a/arch/powerpc/mm/hugetlbpage-radix.c b/arch/powerpc/mm/hugetlbpage-radix.c -index 35254a6..a2b2d97 100644 ---- a/arch/powerpc/mm/hugetlbpage-radix.c -+++ b/arch/powerpc/mm/hugetlbpage-radix.c -@@ -65,7 +65,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - /* -diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c -index 2f1e443..5bc2845 100644 ---- a/arch/powerpc/mm/mmap.c -+++ b/arch/powerpc/mm/mmap.c -@@ -106,7 +106,7 @@ radix__arch_get_unmapped_area(struct file *filp, unsigned long addr, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -142,7 +142,7 @@ radix__arch_get_unmapped_area_topdown(struct file *filp, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c -index 2b27458..c4d5c9c 100644 ---- a/arch/powerpc/mm/slice.c -+++ b/arch/powerpc/mm/slice.c -@@ -105,7 +105,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr, - if ((mm->task_size - len) < addr) - return 0; - vma = find_vma(mm, addr); -- return (!vma || (addr + len) <= vma->vm_start); -+ return (!vma || (addr + len) <= vm_start_gap(vma)); - } - - static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice) -diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c -index eb9df28..812368f 100644 ---- a/arch/s390/mm/mmap.c -+++ b/arch/s390/mm/mmap.c -@@ -98,7 +98,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -136,7 +136,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c -index 6777177..7df7d59 100644 ---- a/arch/sh/mm/mmap.c -+++ b/arch/sh/mm/mmap.c -@@ -63,7 +63,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -113,7 +113,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c -index fe8b8ee..02e05e2 100644 ---- a/arch/sparc/kernel/sys_sparc_64.c -+++ b/arch/sparc/kernel/sys_sparc_64.c -@@ -118,7 +118,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi - - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -181,7 +181,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c -index 988acc8b..58cde8d 100644 ---- a/arch/sparc/mm/hugetlbpage.c -+++ b/arch/sparc/mm/hugetlbpage.c -@@ -116,7 +116,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, HPAGE_SIZE); - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c -index 77ceaa3..67508b2 100644 ---- a/arch/tile/mm/hugetlbpage.c -+++ b/arch/tile/mm/hugetlbpage.c -@@ -232,7 +232,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (current->mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c -index a55ed63..1119414 100644 ---- a/arch/x86/kernel/sys_x86_64.c -+++ b/arch/x86/kernel/sys_x86_64.c -@@ -140,7 +140,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (end - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -183,7 +183,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c -index 2ae8584..fe342e8 100644 ---- a/arch/x86/mm/hugetlbpage.c -+++ b/arch/x86/mm/hugetlbpage.c -@@ -144,7 +144,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c -index 83cf496..3aaaae1 100644 ---- a/arch/xtensa/kernel/syscall.c -+++ b/arch/xtensa/kernel/syscall.c -@@ -87,7 +87,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - /* At this point: (!vmm || addr < vmm->vm_end). */ - if (TASK_SIZE - len < addr) - return -ENOMEM; -- if (!vmm || addr + len <= vmm->vm_start) -+ if (!vmm || addr + len <= vm_start_gap(vmm)) - return addr; - addr = vmm->vm_end; - if (flags & MAP_SHARED) -diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c -index 4fb7b10..704fa0b 100644 ---- a/fs/hugetlbfs/inode.c -+++ b/fs/hugetlbfs/inode.c -@@ -191,7 +191,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index 35b92d8..c5f2136 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -299,11 +299,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) - - /* We don't show the stack guard page in /proc/maps */ - start = vma->vm_start; -- if (stack_guard_page_start(vma, start)) -- start += PAGE_SIZE; - end = vma->vm_end; -- if (stack_guard_page_end(vma, end)) -- end -= PAGE_SIZE; - - seq_setwidth(m, 25 + sizeof(void *) * 6 - 1); - seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ", -diff --git a/include/linux/mm.h b/include/linux/mm.h -index 0b5b2e4..6c9e1ad 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -1356,39 +1356,11 @@ int clear_page_dirty_for_io(struct page *page); - - int get_cmdline(struct task_struct *task, char *buffer, int buflen); - --/* Is the vma a continuation of the stack vma above it? */ --static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr) --{ -- return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); --} -- - static inline bool vma_is_anonymous(struct vm_area_struct *vma) - { - return !vma->vm_ops; - } - --static inline int stack_guard_page_start(struct vm_area_struct *vma, -- unsigned long addr) --{ -- return (vma->vm_flags & VM_GROWSDOWN) && -- (vma->vm_start == addr) && -- !vma_growsdown(vma->vm_prev, addr); --} -- --/* Is the vma a continuation of the stack vma below it? */ --static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr) --{ -- return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP); --} -- --static inline int stack_guard_page_end(struct vm_area_struct *vma, -- unsigned long addr) --{ -- return (vma->vm_flags & VM_GROWSUP) && -- (vma->vm_end == addr) && -- !vma_growsup(vma->vm_next, addr); --} -- - int vma_is_stack_for_current(struct vm_area_struct *vma); - - extern unsigned long move_page_tables(struct vm_area_struct *vma, -@@ -2127,6 +2099,7 @@ void page_cache_async_readahead(struct address_space *mapping, - pgoff_t offset, - unsigned long size); - -+extern unsigned long stack_guard_gap; - /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ - extern int expand_stack(struct vm_area_struct *vma, unsigned long address); - -@@ -2155,6 +2128,30 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m - return vma; - } - -+static inline unsigned long vm_start_gap(struct vm_area_struct *vma) -+{ -+ unsigned long vm_start = vma->vm_start; -+ -+ if (vma->vm_flags & VM_GROWSDOWN) { -+ vm_start -= stack_guard_gap; -+ if (vm_start > vma->vm_start) -+ vm_start = 0; -+ } -+ return vm_start; -+} -+ -+static inline unsigned long vm_end_gap(struct vm_area_struct *vma) -+{ -+ unsigned long vm_end = vma->vm_end; -+ -+ if (vma->vm_flags & VM_GROWSUP) { -+ vm_end += stack_guard_gap; -+ if (vm_end < vma->vm_end) -+ vm_end = -PAGE_SIZE; -+ } -+ return vm_end; -+} -+ - static inline unsigned long vma_pages(struct vm_area_struct *vma) - { - return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; -diff --git a/mm/gup.c b/mm/gup.c -index ec4f827..c63a034 100644 ---- a/mm/gup.c -+++ b/mm/gup.c -@@ -370,11 +370,6 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, - /* mlock all present pages, but do not fault in new pages */ - if ((*flags & (FOLL_POPULATE | FOLL_MLOCK)) == FOLL_MLOCK) - return -ENOENT; -- /* For mm_populate(), just skip the stack guard page. */ -- if ((*flags & FOLL_POPULATE) && -- (stack_guard_page_start(vma, address) || -- stack_guard_page_end(vma, address + PAGE_SIZE))) -- return -ENOENT; - if (*flags & FOLL_WRITE) - fault_flags |= FAULT_FLAG_WRITE; - if (*flags & FOLL_REMOTE) -diff --git a/mm/memory.c b/mm/memory.c -index cbb1e5e..e6a5a1f 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -2699,40 +2699,6 @@ int do_swap_page(struct fault_env *fe, pte_t orig_pte) - } - - /* -- * This is like a special single-page "expand_{down|up}wards()", -- * except we must first make sure that 'address{-|+}PAGE_SIZE' -- * doesn't hit another vma. -- */ --static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address) --{ -- address &= PAGE_MASK; -- if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) { -- struct vm_area_struct *prev = vma->vm_prev; -- -- /* -- * Is there a mapping abutting this one below? -- * -- * That's only ok if it's the same stack mapping -- * that has gotten split.. -- */ -- if (prev && prev->vm_end == address) -- return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM; -- -- return expand_downwards(vma, address - PAGE_SIZE); -- } -- if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) { -- struct vm_area_struct *next = vma->vm_next; -- -- /* As VM_GROWSDOWN but s/below/above/ */ -- if (next && next->vm_start == address + PAGE_SIZE) -- return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM; -- -- return expand_upwards(vma, address + PAGE_SIZE); -- } -- return 0; --} -- --/* - * We enter with non-exclusive mmap_sem (to exclude vma changes, - * but allow concurrent faults), and pte mapped but not yet locked. - * We return with mmap_sem still held, but pte unmapped and unlocked. -@@ -2748,10 +2714,6 @@ static int do_anonymous_page(struct fault_env *fe) - if (vma->vm_flags & VM_SHARED) - return VM_FAULT_SIGBUS; - -- /* Check if we need to add a guard page to the stack */ -- if (check_stack_guard_page(vma, fe->address) < 0) -- return VM_FAULT_SIGSEGV; -- - /* - * Use pte_alloc() instead of pte_alloc_map(). We can't run - * pte_offset_map() on pmds where a huge pmd might be created -diff --git a/mm/mmap.c b/mm/mmap.c -index 1af87c1..26542b3 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -183,6 +183,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) - unsigned long retval; - unsigned long newbrk, oldbrk; - struct mm_struct *mm = current->mm; -+ struct vm_area_struct *next; - unsigned long min_brk; - bool populate; - -@@ -228,7 +229,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) - } - - /* Check against existing mmap mappings. */ -- if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE)) -+ next = find_vma(mm, oldbrk); -+ if (next && newbrk + PAGE_SIZE > vm_start_gap(next)) - goto out; - - /* Ok, looks good - let it rip. */ -@@ -251,10 +253,22 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) - - static long vma_compute_subtree_gap(struct vm_area_struct *vma) - { -- unsigned long max, subtree_gap; -- max = vma->vm_start; -- if (vma->vm_prev) -- max -= vma->vm_prev->vm_end; -+ unsigned long max, prev_end, subtree_gap; -+ -+ /* -+ * Note: in the rare case of a VM_GROWSDOWN above a VM_GROWSUP, we -+ * allow two stack_guard_gaps between them here, and when choosing -+ * an unmapped area; whereas when expanding we only require one. -+ * That's a little inconsistent, but keeps the code here simpler. -+ */ -+ max = vm_start_gap(vma); -+ if (vma->vm_prev) { -+ prev_end = vm_end_gap(vma->vm_prev); -+ if (max > prev_end) -+ max -= prev_end; -+ else -+ max = 0; -+ } - if (vma->vm_rb.rb_left) { - subtree_gap = rb_entry(vma->vm_rb.rb_left, - struct vm_area_struct, vm_rb)->rb_subtree_gap; -@@ -350,7 +364,7 @@ static void validate_mm(struct mm_struct *mm) - anon_vma_unlock_read(anon_vma); - } - -- highest_address = vma->vm_end; -+ highest_address = vm_end_gap(vma); - vma = vma->vm_next; - i++; - } -@@ -539,7 +553,7 @@ void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, - if (vma->vm_next) - vma_gap_update(vma->vm_next); - else -- mm->highest_vm_end = vma->vm_end; -+ mm->highest_vm_end = vm_end_gap(vma); - - /* - * vma->vm_prev wasn't known when we followed the rbtree to find the -@@ -854,7 +868,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start, - vma_gap_update(vma); - if (end_changed) { - if (!next) -- mm->highest_vm_end = end; -+ mm->highest_vm_end = vm_end_gap(vma); - else if (!adjust_next) - vma_gap_update(next); - } -@@ -939,7 +953,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start, - * mm->highest_vm_end doesn't need any update - * in remove_next == 1 case. - */ -- VM_WARN_ON(mm->highest_vm_end != end); -+ VM_WARN_ON(mm->highest_vm_end != vm_end_gap(vma)); - } - } - if (insert && file) -@@ -1783,7 +1797,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) - - while (true) { - /* Visit left subtree if it looks promising */ -- gap_end = vma->vm_start; -+ gap_end = vm_start_gap(vma); - if (gap_end >= low_limit && vma->vm_rb.rb_left) { - struct vm_area_struct *left = - rb_entry(vma->vm_rb.rb_left, -@@ -1794,7 +1808,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) - } - } - -- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; -+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0; - check_current: - /* Check if current node has a suitable gap */ - if (gap_start > high_limit) -@@ -1821,8 +1835,8 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) - vma = rb_entry(rb_parent(prev), - struct vm_area_struct, vm_rb); - if (prev == vma->vm_rb.rb_left) { -- gap_start = vma->vm_prev->vm_end; -- gap_end = vma->vm_start; -+ gap_start = vm_end_gap(vma->vm_prev); -+ gap_end = vm_start_gap(vma); - goto check_current; - } - } -@@ -1886,7 +1900,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) - - while (true) { - /* Visit right subtree if it looks promising */ -- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; -+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0; - if (gap_start <= high_limit && vma->vm_rb.rb_right) { - struct vm_area_struct *right = - rb_entry(vma->vm_rb.rb_right, -@@ -1899,7 +1913,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) - - check_current: - /* Check if current node has a suitable gap */ -- gap_end = vma->vm_start; -+ gap_end = vm_start_gap(vma); - if (gap_end < low_limit) - return -ENOMEM; - if (gap_start <= high_limit && gap_end - gap_start >= length) -@@ -1925,7 +1939,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) - struct vm_area_struct, vm_rb); - if (prev == vma->vm_rb.rb_right) { - gap_start = vma->vm_prev ? -- vma->vm_prev->vm_end : 0; -+ vm_end_gap(vma->vm_prev) : 0; - goto check_current; - } - } -@@ -1963,7 +1977,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) - { - struct mm_struct *mm = current->mm; -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct vm_unmapped_area_info info; - - if (len > TASK_SIZE - mmap_min_addr) -@@ -1974,9 +1988,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - if (addr) { - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - return addr; - } - -@@ -1999,7 +2014,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - const unsigned long len, const unsigned long pgoff, - const unsigned long flags) - { -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct mm_struct *mm = current->mm; - unsigned long addr = addr0; - struct vm_unmapped_area_info info; -@@ -2014,9 +2029,10 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - /* requesting a specific address */ - if (addr) { - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - return addr; - } - -@@ -2151,21 +2167,19 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr, - * update accounting. This is shared with both the - * grow-up and grow-down cases. - */ --static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow) -+static int acct_stack_growth(struct vm_area_struct *vma, -+ unsigned long size, unsigned long grow) - { - struct mm_struct *mm = vma->vm_mm; - struct rlimit *rlim = current->signal->rlim; -- unsigned long new_start, actual_size; -+ unsigned long new_start; - - /* address space limit tests */ - if (!may_expand_vm(mm, vma->vm_flags, grow)) - return -ENOMEM; - - /* Stack limit test */ -- actual_size = size; -- if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN))) -- actual_size -= PAGE_SIZE; -- if (actual_size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) -+ if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) - return -ENOMEM; - - /* mlock limit tests */ -@@ -2203,17 +2217,30 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns - int expand_upwards(struct vm_area_struct *vma, unsigned long address) - { - struct mm_struct *mm = vma->vm_mm; -+ struct vm_area_struct *next; -+ unsigned long gap_addr; - int error = 0; - - if (!(vma->vm_flags & VM_GROWSUP)) - return -EFAULT; - - /* Guard against wrapping around to address 0. */ -- if (address < PAGE_ALIGN(address+4)) -- address = PAGE_ALIGN(address+4); -- else -+ address &= PAGE_MASK; -+ address += PAGE_SIZE; -+ if (!address) - return -ENOMEM; - -+ /* Enforce stack_guard_gap */ -+ gap_addr = address + stack_guard_gap; -+ if (gap_addr < address) -+ return -ENOMEM; -+ next = vma->vm_next; -+ if (next && next->vm_start < gap_addr) { -+ if (!(next->vm_flags & VM_GROWSUP)) -+ return -ENOMEM; -+ /* Check that both stack segments have the same anon_vma? */ -+ } -+ - /* We must make sure the anon_vma is allocated. */ - if (unlikely(anon_vma_prepare(vma))) - return -ENOMEM; -@@ -2257,7 +2284,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) - if (vma->vm_next) - vma_gap_update(vma->vm_next); - else -- mm->highest_vm_end = address; -+ mm->highest_vm_end = vm_end_gap(vma); - spin_unlock(&mm->page_table_lock); - - perf_event_mmap(vma); -@@ -2278,6 +2305,8 @@ int expand_downwards(struct vm_area_struct *vma, - unsigned long address) - { - struct mm_struct *mm = vma->vm_mm; -+ struct vm_area_struct *prev; -+ unsigned long gap_addr; - int error; - - address &= PAGE_MASK; -@@ -2285,6 +2314,17 @@ int expand_downwards(struct vm_area_struct *vma, - if (error) - return error; - -+ /* Enforce stack_guard_gap */ -+ gap_addr = address - stack_guard_gap; -+ if (gap_addr > address) -+ return -ENOMEM; -+ prev = vma->vm_prev; -+ if (prev && prev->vm_end > gap_addr) { -+ if (!(prev->vm_flags & VM_GROWSDOWN)) -+ return -ENOMEM; -+ /* Check that both stack segments have the same anon_vma? */ -+ } -+ - /* We must make sure the anon_vma is allocated. */ - if (unlikely(anon_vma_prepare(vma))) - return -ENOMEM; -@@ -2339,28 +2379,25 @@ int expand_downwards(struct vm_area_struct *vma, - return error; - } - --/* -- * Note how expand_stack() refuses to expand the stack all the way to -- * abut the next virtual mapping, *unless* that mapping itself is also -- * a stack mapping. We want to leave room for a guard page, after all -- * (the guard page itself is not added here, that is done by the -- * actual page faulting logic) -- * -- * This matches the behavior of the guard page logic (see mm/memory.c: -- * check_stack_guard_page()), which only allows the guard page to be -- * removed under these circumstances. -- */ -+/* enforced gap between the expanding stack and other mappings. */ -+unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT; -+ -+static int __init cmdline_parse_stack_guard_gap(char *p) -+{ -+ unsigned long val; -+ char *endptr; -+ -+ val = simple_strtoul(p, &endptr, 10); -+ if (!*endptr) -+ stack_guard_gap = val << PAGE_SHIFT; -+ -+ return 0; -+} -+__setup("stack_guard_gap=", cmdline_parse_stack_guard_gap); -+ - #ifdef CONFIG_STACK_GROWSUP - int expand_stack(struct vm_area_struct *vma, unsigned long address) - { -- struct vm_area_struct *next; -- -- address &= PAGE_MASK; -- next = vma->vm_next; -- if (next && next->vm_start == address + PAGE_SIZE) { -- if (!(next->vm_flags & VM_GROWSUP)) -- return -ENOMEM; -- } - return expand_upwards(vma, address); - } - -@@ -2382,14 +2419,6 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) - #else - int expand_stack(struct vm_area_struct *vma, unsigned long address) - { -- struct vm_area_struct *prev; -- -- address &= PAGE_MASK; -- prev = vma->vm_prev; -- if (prev && prev->vm_end == address) { -- if (!(prev->vm_flags & VM_GROWSDOWN)) -- return -ENOMEM; -- } - return expand_downwards(vma, address); - } - -@@ -2487,7 +2516,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, - vma->vm_prev = prev; - vma_gap_update(vma); - } else -- mm->highest_vm_end = prev ? prev->vm_end : 0; -+ mm->highest_vm_end = prev ? vm_end_gap(prev) : 0; - tail_vma->vm_next = NULL; - - /* Kill the cache */ --- -2.1.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0002-Allow-stack-to-grow-up-to-address-space-limit.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0002-Allow-stack-to-grow-up-to-address-space-limit.patch deleted file mode 100644 index 2a20abb57..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0002-Allow-stack-to-grow-up-to-address-space-limit.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 88aa347d26911cffd84ac3dd2a8341f1ba7e3444 Mon Sep 17 00:00:00 2001 -From: Helge Deller <deller@gmx.de> -Date: Mon, 19 Jun 2017 17:34:05 +0200 -Subject: [PATCH 2/3] Allow stack to grow up to address space limit - -commit bd726c90b6b8ce87602208701b208a208e6d5600 upstream. - -Fix expand_upwards() on architectures with an upward-growing stack (parisc, -metag and partly IA-64) to allow the stack to reliably grow exactly up to -the address space limit given by TASK_SIZE. - -Signed-off-by: Helge Deller <deller@gmx.de> -Acked-by: Hugh Dickins <hughd@google.com> -Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - mm/mmap.c | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/mm/mmap.c b/mm/mmap.c -index 26542b3..d71a61e 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -2224,16 +2224,19 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) - if (!(vma->vm_flags & VM_GROWSUP)) - return -EFAULT; - -- /* Guard against wrapping around to address 0. */ -+ /* Guard against exceeding limits of the address space. */ - address &= PAGE_MASK; -- address += PAGE_SIZE; -- if (!address) -+ if (address >= TASK_SIZE) - return -ENOMEM; -+ address += PAGE_SIZE; - - /* Enforce stack_guard_gap */ - gap_addr = address + stack_guard_gap; -- if (gap_addr < address) -- return -ENOMEM; -+ -+ /* Guard against overflow */ -+ if (gap_addr < address || gap_addr > TASK_SIZE) -+ gap_addr = TASK_SIZE; -+ - next = vma->vm_next; - if (next && next->vm_start < gap_addr) { - if (!(next->vm_flags & VM_GROWSUP)) --- -2.1.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch deleted file mode 100644 index 7dc79192b..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-4.9/0003-mm-fix-new-crash-in-unmapped_area_topdown.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 00d15368d611f12f3c4980dce63b68b08ea89a09 Mon Sep 17 00:00:00 2001 -From: Hugh Dickins <hughd@google.com> -Date: Tue, 20 Jun 2017 02:10:44 -0700 -Subject: [PATCH 3/3] mm: fix new crash in unmapped_area_topdown() - -commit f4cb767d76cf7ee72f97dd76f6cfa6c76a5edc89 upstream. - -Trinity gets kernel BUG at mm/mmap.c:1963! in about 3 minutes of -mmap testing. That's the VM_BUG_ON(gap_end < gap_start) at the -end of unmapped_area_topdown(). Linus points out how MAP_FIXED -(which does not have to respect our stack guard gap intentions) -could result in gap_end below gap_start there. Fix that, and -the similar case in its alternative, unmapped_area(). - -Fixes: 1be7107fbe18 ("mm: larger stack guard gap, between vmas") -Reported-by: Dave Jones <davej@codemonkey.org.uk> -Debugged-by: Linus Torvalds <torvalds@linux-foundation.org> -Signed-off-by: Hugh Dickins <hughd@google.com> -Acked-by: Michal Hocko <mhocko@suse.com> -Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ---- - mm/mmap.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/mm/mmap.c b/mm/mmap.c -index d71a61e..145d3d5 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -1813,7 +1813,8 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) - /* Check if current node has a suitable gap */ - if (gap_start > high_limit) - return -ENOMEM; -- if (gap_end >= low_limit && gap_end - gap_start >= length) -+ if (gap_end >= low_limit && -+ gap_end > gap_start && gap_end - gap_start >= length) - goto found; - - /* Visit right subtree if it looks promising */ -@@ -1916,7 +1917,8 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) - gap_end = vm_start_gap(vma); - if (gap_end < low_limit) - return -ENOMEM; -- if (gap_start <= high_limit && gap_end - gap_start >= length) -+ if (gap_start <= high_limit && -+ gap_end > gap_start && gap_end - gap_start >= length) - goto found; - - /* Visit left subtree if it looks promising */ --- -2.1.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-Smack-File-receive-for-sockets.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-Smack-File-receive-for-sockets.patch deleted file mode 100644 index 4021e5d38..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-Smack-File-receive-for-sockets.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 2b206c36b16e72cfe41cd22448d8527359ffd962 Mon Sep 17 00:00:00 2001 -From: Casey Schaufler <casey@schaufler-ca.com> -Date: Mon, 7 Dec 2015 14:34:32 -0800 -Subject: [PATCH 1/4] Smack: File receive for sockets - -The existing file receive hook checks for access on -the file inode even for UDS. This is not right, as -the inode is not used by Smack to make access checks -for sockets. This change checks for an appropriate -access relationship between the receiving (current) -process and the socket. If the process can't write -to the socket's send label or the socket's receive -label can't write to the process fail. - -This will allow the legitimate cases, where the -socket sender and socket receiver can freely communicate. -Only strangly set socket labels should cause a problem. - -Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> ---- - security/smack/smack_lsm.c | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c -index ff81026..b20ef06 100644 ---- a/security/smack/smack_lsm.c -+++ b/security/smack/smack_lsm.c -@@ -1860,12 +1860,34 @@ static int smack_file_receive(struct file *file) - int may = 0; - struct smk_audit_info ad; - struct inode *inode = file_inode(file); -+ struct socket *sock; -+ struct task_smack *tsp; -+ struct socket_smack *ssp; - - if (unlikely(IS_PRIVATE(inode))) - return 0; - - smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); - smk_ad_setfield_u_fs_path(&ad, file->f_path); -+ -+ if (S_ISSOCK(inode->i_mode)) { -+ sock = SOCKET_I(inode); -+ ssp = sock->sk->sk_security; -+ tsp = current_security(); -+ /* -+ * If the receiving process can't write to the -+ * passed socket or if the passed socket can't -+ * write to the receiving process don't accept -+ * the passed socket. -+ */ -+ rc = smk_access(tsp->smk_task, ssp->smk_out, MAY_WRITE, &ad); -+ rc = smk_bu_file(file, may, rc); -+ if (rc < 0) -+ return rc; -+ rc = smk_access(ssp->smk_in, tsp->smk_task, MAY_WRITE, &ad); -+ rc = smk_bu_file(file, may, rc); -+ return rc; -+ } - /* - * This code relies on bitmasks. - */ --- -2.7.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-smack-fix-cache-of-access-labels.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-smack-fix-cache-of-access-labels.patch deleted file mode 100644 index c516f3aa5..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-smack-fix-cache-of-access-labels.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 99267706991ab84bd44ceaea9a7ec886bbdd58e0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jobol@nonadev.net> -Date: Tue, 12 Jan 2016 21:23:40 +0100 -Subject: [PATCH 2/4] smack: fix cache of access labels -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Before this commit, removing the access property of -a file, aka, the extended attribute security.SMACK64 -was not effictive until the cache had been cleaned. - -This patch fixes that problem. - -Signed-off-by: José Bollo <jobol@nonadev.net> -Acked-by: Casey Schaufler <casey@schaufler-ca.com> ---- - security/smack/smack_lsm.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c -index b20ef06..b2bcb14 100644 ---- a/security/smack/smack_lsm.c -+++ b/security/smack/smack_lsm.c -@@ -1444,9 +1444,13 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) - * Don't do anything special for these. - * XATTR_NAME_SMACKIPIN - * XATTR_NAME_SMACKIPOUT -- * XATTR_NAME_SMACKEXEC - */ -- if (strcmp(name, XATTR_NAME_SMACK) == 0) -+ if (strcmp(name, XATTR_NAME_SMACK) == 0) { -+ struct super_block *sbp = d_backing_inode(dentry)->i_sb; -+ struct superblock_smack *sbsp = sbp->s_security; -+ -+ isp->smk_inode = sbsp->smk_default; -+ } else if (strcmp(name, XATTR_NAME_SMACKEXEC) == 0) - isp->smk_task = NULL; - else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0) - isp->smk_mmap = NULL; --- -2.7.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0003-Smack-ignore-null-signal-in-smack_task_kill.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0003-Smack-ignore-null-signal-in-smack_task_kill.patch deleted file mode 100644 index c9180bb9f..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0003-Smack-ignore-null-signal-in-smack_task_kill.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ec4eb03af07b0fbc330aecca6ac4ebd6accd8825 Mon Sep 17 00:00:00 2001 -From: Rafal Krypa <r.krypa@samsung.com> -Date: Mon, 4 Apr 2016 11:14:53 +0200 -Subject: [PATCH 3/4] Smack: ignore null signal in smack_task_kill - -Kill with signal number 0 is commonly used for checking PID existence. -Smack treated such cases like any other kills, although no signal is -actually delivered when sig == 0. - -Checking permissions when sig == 0 didn't prevent an unprivileged caller -from learning whether PID exists or not. When it existed, kernel returned -EPERM, when it didn't - ESRCH. The only effect of policy check in such -case is noise in audit logs. - -This change lets Smack silently ignore kill() invocations with sig == 0. - -Signed-off-by: Rafal Krypa <r.krypa@samsung.com> -Acked-by: Casey Schaufler <casey@schaufler-ca.com> ---- - security/smack/smack_lsm.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c -index b2bcb14..cf8a93f 100644 ---- a/security/smack/smack_lsm.c -+++ b/security/smack/smack_lsm.c -@@ -2239,6 +2239,9 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info, - struct smack_known *tkp = smk_of_task_struct(p); - int rc; - -+ if (!sig) -+ return 0; /* null signal; existence test */ -+ - smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK); - smk_ad_setfield_u_tsk(&ad, p); - /* --- -2.7.4 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend index 6557ce03c..ead116b09 100644 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend @@ -1,17 +1,9 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" SRC_URI_append = "\ - ${@base_conditional('USE_FAYTECH_MONITOR', '1', 'file://0002-faytech-fix-rpi.patch', '', d)} \ + ${@base_conditional('USE_FAYTECH_MONITOR', '1', 'file://0002-faytech-fix-rpi.patch', '', d)} \ " -# Fix CVE-2017-1000364 -SRC_URI_append = "\ - file://0001-mm-larger-stack-guard-gap-between-vmas.patch \ - file://0002-Allow-stack-to-grow-up-to-address-space-limit.patch \ - file://0003-mm-fix-new-crash-in-unmapped_area_topdown.patch \ -" - - do_configure_append_smack() { # SMACK and Co kernel_configure_variable IP_NF_SECURITY m diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.4.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.4.bbappend deleted file mode 100644 index c96635ecd..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.4.bbappend +++ /dev/null @@ -1,11 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}-4.4:" - -#------------------------------------------------------------------------- -# smack patches for handling bluetooth - -SRC_URI_append_smack = "\ - file://0001-Smack-File-receive-for-sockets.patch \ - file://0002-smack-fix-cache-of-access-labels.patch \ - file://0003-Smack-ignore-null-signal-in-smack_task_kill.patch \ - file://0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch \ -" diff --git a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend index 53cd834aa..f1fd52d35 100644 --- a/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend +++ b/meta-agl-bsp/meta-ti/recipes-arago/gstreamer/gstreamer1.0-plugins-bad_%.bbappend @@ -19,8 +19,12 @@ DEPENDS_append_ti33x = " \ libdrm \ " -SRC_URI_append_ti43x = " \ +############## F I X M E ##################### +# FIXME pyro +SRC_URI_append = " \ file://0001-gstdrmallocator-Add-DRM-allocator-support.patch \ +" +DISABLED_SRC_URI_append_ti43x = " \ file://0002-parsers-Pick-previos-bug-fixes-on-different-parsers.patch \ file://0003-gstkmssink-Add-support-for-KMS-based-sink.patch \ file://0004-gstwaylandsink-Add-DRM-support-on-waylandsink.patch \ @@ -29,11 +33,13 @@ SRC_URI_append_ti43x = " \ file://0001-gstwaylandsink-add-input-format-I420-support.patch \ " -SRC_URI_append_ti33x = " \ +# FIXME pyro +DISABLED_SRC_URI_append_ti33x = " \ file://0001-gstwaylandsink-Add-mouse-drag-and-drop-support.patch \ " -SRC_URI_append_omap-a15 = " \ +# FIXME pyro +DISABLED_SRC_URI_append_omap-a15 = " \ file://0001-gstdrmallocator-Add-DRM-allocator-support.patch \ file://0002-parsers-Pick-previos-bug-fixes-on-different-parsers.patch \ file://0003-gstkmssink-Add-support-for-KMS-based-sink.patch \ @@ -43,6 +49,7 @@ SRC_URI_append_omap-a15 = " \ file://0001-gstwaylandsink-add-input-format-I420-support.patch \ file://0005-gstwaylandsink-Implement-callbacks-for-version-5-of-.patch \ " +################ F I X M E #################### PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-agl-bsp/meta-ti/recipes-arago/ipumm-fw/ipumm-fw_3.00.13.00.bb b/meta-agl-bsp/meta-ti/recipes-arago/ipumm-fw/ipumm-fw_3.00.13.00.bb index 4fdfd7ddb..a9653f4d3 100644 --- a/meta-agl-bsp/meta-ti/recipes-arago/ipumm-fw/ipumm-fw_3.00.13.00.bb +++ b/meta-agl-bsp/meta-ti/recipes-arago/ipumm-fw/ipumm-fw_3.00.13.00.bb @@ -1,5 +1,5 @@ python __anonymous() { - features = bb.data.getVar("MACHINE_FEATURES", d, 1) + features = d.getVar("MACHINE_FEATURES", 1) if not features: return if "mmip" not in features: diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston_%.bbappend b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston_%.bbappend index ed20c7420..8704908f2 100644 --- a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston_%.bbappend +++ b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston_%.bbappend @@ -8,8 +8,9 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" RDEPENDS_${PN} += "weston-conf" - -SRC_URI += " \ +####################### F I X M E ########################## +# FIXME pyro +DISABLED_SRC_URI += " \ file://0001-udev-seat-restrict-udev-enumeration-to-card0.patch \ file://0001-Add-soc-performance-monitor-utilites.patch \ file://0002-Weston-Allow-visual_id-to-be-0.patch \ @@ -18,5 +19,7 @@ SRC_URI += " \ file://0001-compositor-drm-fix-hotplug-weston-termination-proble.patch \ file://0001-compositor-drm-support-RGB565-with-pixman-renderer.patch \ " +####################### F I X M E ########################## + RDEPENDS_${PN}_remove = "weston-conf" diff --git a/meta-agl-bsp/meta-ti/recipes-bsp/alsa-state/alsa-state.bbappend b/meta-agl-bsp/meta-ti/recipes-bsp/alsa-state/alsa-state.bbappend index 72d991c7e..3b2b8beb8 100644 --- a/meta-agl-bsp/meta-ti/recipes-bsp/alsa-state/alsa-state.bbappend +++ b/meta-agl-bsp/meta-ti/recipes-bsp/alsa-state/alsa-state.bbappend @@ -1 +1 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +FILESEXTRAPATHS_prepend_dra7xx-evm := "${THISDIR}/${PN}:" diff --git a/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio-9.0/dra7xx-evm-set-default-sink-source.patch b/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio/dra7xx-evm-set-default-sink-source.patch index d45c5ef50..d45c5ef50 100644 --- a/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio-9.0/dra7xx-evm-set-default-sink-source.patch +++ b/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio/dra7xx-evm-set-default-sink-source.patch diff --git a/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend b/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend new file mode 100644 index 000000000..37c4179e5 --- /dev/null +++ b/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/pulseaudio:" + +################### F I X M E #################### +# FIXME pyro +DISABLED_SRC_URI += " \ + file://dra7xx-evm-set-default-sink-source.patch \ +" diff --git a/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio_9.0.bbappend b/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio_9.0.bbappend deleted file mode 100644 index dfddffcfd..000000000 --- a/meta-agl-bsp/meta-ti/recipes-multimedia/pulseaudio/pulseaudio_9.0.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/pulseaudio-9.0:" - -SRC_URI += " \ - file://dra7xx-evm-set-default-sink-source.patch \ -" diff --git a/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb b/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb index dfa0631a0..37abc5a50 100644 --- a/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb +++ b/meta-agl-bsp/recipes-bsp/u-boot/u-boot-ota_2015.07.bb @@ -9,10 +9,13 @@ LIC_FILES_CHKSUM = "file://Licenses/README;md5=0507cd7da8e7ad6d6701926ec9b84c95" # repo during parse SRCREV = "baba2f57e8f4ed3fa67fe213d22da0de5e00f204" -SRC_URI += "file://0001-Set-up-environment-for-OSTree-integration.patch \ - file://0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch \ - file://0001-fixup-build-with-gcc6.patch \ - " +SRC_URI = "\ + git://git.denx.de/u-boot.git;branch=master \ + file://0001-Set-up-environment-for-OSTree-integration.patch \ + file://0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch \ + file://0001-fixup-build-with-gcc6.patch \ +" +S = "${WORKDIR}/git" PV = "v2015.07+git${SRCPV}" diff --git a/meta-agl-bsp/recipes-bsp/u-boot/u-boot_2016.11.bb b/meta-agl-bsp/recipes-bsp/u-boot/u-boot_2016.11.bb deleted file mode 100644 index 2c7cc4bb9..000000000 --- a/meta-agl-bsp/recipes-bsp/u-boot/u-boot_2016.11.bb +++ /dev/null @@ -1,13 +0,0 @@ -require recipes-bsp/u-boot/u-boot.inc - -DEPENDS += "dtc-native" - -SRCREV = "5ea3e51fc481613a8dee8c02848d1b42c81ad892" - -PV = "v2016.11+git${SRCPV}" - -#This patch is not complacente with u-boot 2016.11 -#Version of u-boot from yocto 2.2 Morty is 2016.03 from: -# meta/recipes-bsp/u-boot/u-boot_2016.03.bb -SRC_URI_remove_raspberrypi3 = "file://0003-Include-lowlevel_init.o-for-rpi2.patch" -SRC_URI_remove_raspberrypi2 = "file://0003-Include-lowlevel_init.o-for-rpi2.patch" diff --git a/meta-agl-bsp/recipes-graphics/mesa/mesa/0001-Use-llvm_prefix-variable-directly.patch b/meta-agl-bsp/recipes-graphics/mesa/mesa/0001-Use-llvm_prefix-variable-directly.patch new file mode 100644 index 000000000..4f1905492 --- /dev/null +++ b/meta-agl-bsp/recipes-graphics/mesa/mesa/0001-Use-llvm_prefix-variable-directly.patch @@ -0,0 +1,25 @@ +From 0b316ee830765eb1d68cdece5fd4c991e9fba96c Mon Sep 17 00:00:00 2001 +From: Changhyeok Bae <changhyeok.bae@gmail.com> +Date: Sat, 8 Jul 2017 15:22:09 +0900 +Subject: [PATCH] Use $llvm_prefix variable directly + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index ac110e8..d094ca6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -896,7 +896,7 @@ fi + + if test -z "$LLVM_CONFIG"; then + if test -n "$llvm_prefix"; then +- AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"]) ++ AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix"]) + else + AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no]) + fi +-- +1.9.1 + diff --git a/meta-agl-bsp/recipes-graphics/mesa/mesa_12.%.bbappend b/meta-agl-bsp/recipes-graphics/mesa/mesa_%.bbappend index 49e527707..13273792b 100644 --- a/meta-agl-bsp/recipes-graphics/mesa/mesa_12.%.bbappend +++ b/meta-agl-bsp/recipes-graphics/mesa/mesa_%.bbappend @@ -1,3 +1,7 @@ +FILESEXTRAPATHS_prepend_qemux86-64 := "${THISDIR}/${BPN}:" +SRC_URI_append_qemux86-64 = " file://0001-Use-llvm_prefix-variable-directly.patch" +EXTRA_OECONF_qemux86-64 = "--enable-shared-glapi --with-llvm-prefix=${STAGING_BINDIR_CROSS}" + # The gallium-llvm is recommended as software 3D graphics renderer GALLIUM_LLVM = "gallium-llvm" PACKAGECONFIG_append_qemux86 = " gallium ${GALLIUM_LLVM}" diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.8-0001-SEC-Backport-Fix-CVE-2017-1000364-through-backport.patch b/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.8-0001-SEC-Backport-Fix-CVE-2017-1000364-through-backport.patch deleted file mode 100644 index f68a3747b..000000000 --- a/meta-agl-bsp/recipes-kernel/linux/linux-yocto/4.8-0001-SEC-Backport-Fix-CVE-2017-1000364-through-backport.patch +++ /dev/null @@ -1,899 +0,0 @@ -From 75349cc7326dd2aa645bf21fe65a40c68b386c29 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= <jsmoeller@linuxfoundation.org> -Date: Wed, 28 Jun 2017 00:35:18 +0200 -Subject: [PATCH] [SEC][Backport] Fix CVE-2017-1000364 through backport -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fix CVE-2017-1000364 through backport of upstream patches (from 4.9 branch): -- https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-4.9.y&id=cfc0eb403816c5c4f9667d959de5e22789b5421e -- https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-4.9.y&id=5d10ad6297260e9b85e7645ee544a6115bb229e4 -- https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-4.9.y&id=ce7fe8595902c3f03ef528c2dc1928b3f4b67fcf - -Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org> ---- - Documentation/kernel-parameters.txt | 7 ++ - arch/arc/mm/mmap.c | 2 +- - arch/arm/mm/mmap.c | 4 +- - arch/frv/mm/elf-fdpic.c | 2 +- - arch/mips/mm/mmap.c | 2 +- - arch/parisc/kernel/sys_parisc.c | 15 ++-- - arch/powerpc/mm/hugetlbpage-radix.c | 2 +- - arch/powerpc/mm/mmap.c | 4 +- - arch/powerpc/mm/slice.c | 2 +- - arch/s390/mm/mmap.c | 4 +- - arch/sh/mm/mmap.c | 4 +- - arch/sparc/kernel/sys_sparc_64.c | 4 +- - arch/sparc/mm/hugetlbpage.c | 2 +- - arch/tile/mm/hugetlbpage.c | 2 +- - arch/x86/kernel/sys_x86_64.c | 4 +- - arch/x86/mm/hugetlbpage.c | 2 +- - arch/xtensa/kernel/syscall.c | 2 +- - fs/hugetlbfs/inode.c | 2 +- - fs/proc/task_mmu.c | 4 - - include/linux/mm.h | 53 ++++++------ - mm/gup.c | 5 -- - mm/memory.c | 38 --------- - mm/mmap.c | 158 ++++++++++++++++++++++-------------- - 23 files changed, 159 insertions(+), 165 deletions(-) - -diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt -index 46726d4899fe..c1980b5c6a15 100644 ---- a/Documentation/kernel-parameters.txt -+++ b/Documentation/kernel-parameters.txt -@@ -3852,6 +3852,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. - spia_pedr= - spia_peddr= - -+ stack_guard_gap= [MM] -+ override the default stack gap protection. The value -+ is in page units and it defines how many pages prior -+ to (for stacks growing down) resp. after (for stacks -+ growing up) the main stack are reserved for no other -+ mapping. Default value is 256 pages. -+ - stacktrace [FTRACE] - Enabled the stack tracer on boot up. - -diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c -index 2e06d56e987b..cf4ae6958240 100644 ---- a/arch/arc/mm/mmap.c -+++ b/arch/arc/mm/mmap.c -@@ -64,7 +64,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c -index 66353caa35b9..641334ebf46d 100644 ---- a/arch/arm/mm/mmap.c -+++ b/arch/arm/mm/mmap.c -@@ -89,7 +89,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -140,7 +140,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c -index 836f14707a62..efa59f1f8022 100644 ---- a/arch/frv/mm/elf-fdpic.c -+++ b/arch/frv/mm/elf-fdpic.c -@@ -74,7 +74,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi - addr = PAGE_ALIGN(addr); - vma = find_vma(current->mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - goto success; - } - -diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c -index 353037699512..c5fdea5debe5 100644 ---- a/arch/mips/mm/mmap.c -+++ b/arch/mips/mm/mmap.c -@@ -92,7 +92,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c -index 0a393a04e891..1d7691fa8ab2 100644 ---- a/arch/parisc/kernel/sys_parisc.c -+++ b/arch/parisc/kernel/sys_parisc.c -@@ -88,7 +88,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) - { - struct mm_struct *mm = current->mm; -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - unsigned long task_size = TASK_SIZE; - int do_color_align, last_mmap; - struct vm_unmapped_area_info info; -@@ -115,9 +115,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - else - addr = PAGE_ALIGN(addr); - -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - goto found_addr; - } - -@@ -141,7 +142,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - const unsigned long len, const unsigned long pgoff, - const unsigned long flags) - { -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct mm_struct *mm = current->mm; - unsigned long addr = addr0; - int do_color_align, last_mmap; -@@ -175,9 +176,11 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = COLOR_ALIGN(addr, last_mmap, pgoff); - else - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - goto found_addr; - } - -diff --git a/arch/powerpc/mm/hugetlbpage-radix.c b/arch/powerpc/mm/hugetlbpage-radix.c -index 35254a678456..a2b2d97f7eda 100644 ---- a/arch/powerpc/mm/hugetlbpage-radix.c -+++ b/arch/powerpc/mm/hugetlbpage-radix.c -@@ -65,7 +65,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - /* -diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c -index 2f1e44362198..5bc2845cddf4 100644 ---- a/arch/powerpc/mm/mmap.c -+++ b/arch/powerpc/mm/mmap.c -@@ -106,7 +106,7 @@ radix__arch_get_unmapped_area(struct file *filp, unsigned long addr, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -142,7 +142,7 @@ radix__arch_get_unmapped_area_topdown(struct file *filp, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c -index 2b27458902ee..c4d5c9c61e0f 100644 ---- a/arch/powerpc/mm/slice.c -+++ b/arch/powerpc/mm/slice.c -@@ -105,7 +105,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr, - if ((mm->task_size - len) < addr) - return 0; - vma = find_vma(mm, addr); -- return (!vma || (addr + len) <= vma->vm_start); -+ return (!vma || (addr + len) <= vm_start_gap(vma)); - } - - static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice) -diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c -index eb9df2822da1..812368f274c9 100644 ---- a/arch/s390/mm/mmap.c -+++ b/arch/s390/mm/mmap.c -@@ -98,7 +98,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -136,7 +136,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c -index 6777177807c2..7df7d5944188 100644 ---- a/arch/sh/mm/mmap.c -+++ b/arch/sh/mm/mmap.c -@@ -63,7 +63,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -113,7 +113,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c -index fe8b8ee8e660..02e05e221b94 100644 ---- a/arch/sparc/kernel/sys_sparc_64.c -+++ b/arch/sparc/kernel/sys_sparc_64.c -@@ -118,7 +118,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi - - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -181,7 +181,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c -index 988acc8b1b80..58cde8d9be8a 100644 ---- a/arch/sparc/mm/hugetlbpage.c -+++ b/arch/sparc/mm/hugetlbpage.c -@@ -116,7 +116,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, HPAGE_SIZE); - vma = find_vma(mm, addr); - if (task_size - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c -index 77ceaa343fce..67508b249ede 100644 ---- a/arch/tile/mm/hugetlbpage.c -+++ b/arch/tile/mm/hugetlbpage.c -@@ -232,7 +232,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (current->mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c -index 10e0272d789a..136ad7c1ce7b 100644 ---- a/arch/x86/kernel/sys_x86_64.c -+++ b/arch/x86/kernel/sys_x86_64.c -@@ -143,7 +143,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (end - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -@@ -186,7 +186,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c -index 2ae8584b44c7..fe342e8ed529 100644 ---- a/arch/x86/mm/hugetlbpage.c -+++ b/arch/x86/mm/hugetlbpage.c -@@ -144,7 +144,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - if (mm->get_unmapped_area == arch_get_unmapped_area) -diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c -index 83cf49685373..3aaaae18417c 100644 ---- a/arch/xtensa/kernel/syscall.c -+++ b/arch/xtensa/kernel/syscall.c -@@ -87,7 +87,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, - /* At this point: (!vmm || addr < vmm->vm_end). */ - if (TASK_SIZE - len < addr) - return -ENOMEM; -- if (!vmm || addr + len <= vmm->vm_start) -+ if (!vmm || addr + len <= vm_start_gap(vmm)) - return addr; - addr = vmm->vm_end; - if (flags & MAP_SHARED) -diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c -index 4ea71eba40a5..aac9114728c3 100644 ---- a/fs/hugetlbfs/inode.c -+++ b/fs/hugetlbfs/inode.c -@@ -191,7 +191,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - addr = ALIGN(addr, huge_page_size(h)); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } - -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index 2750949397eb..5feada822930 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -309,11 +309,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) - - /* We don't show the stack guard page in /proc/maps */ - start = vma->vm_start; -- if (stack_guard_page_start(vma, start)) -- start += PAGE_SIZE; - end = vma->vm_end; -- if (stack_guard_page_end(vma, end)) -- end -= PAGE_SIZE; - - seq_setwidth(m, 25 + sizeof(void *) * 6 - 1); - seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ", -diff --git a/include/linux/mm.h b/include/linux/mm.h -index 582d30baaa86..31206cc2e99c 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -1392,39 +1392,11 @@ int clear_page_dirty_for_io(struct page *page); - - int get_cmdline(struct task_struct *task, char *buffer, int buflen); - --/* Is the vma a continuation of the stack vma above it? */ --static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr) --{ -- return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); --} -- - static inline bool vma_is_anonymous(struct vm_area_struct *vma) - { - return !vma->vm_ops; - } - --static inline int stack_guard_page_start(struct vm_area_struct *vma, -- unsigned long addr) --{ -- return (vma->vm_flags & VM_GROWSDOWN) && -- (vma->vm_start == addr) && -- !vma_growsdown(vma->vm_prev, addr); --} -- --/* Is the vma a continuation of the stack vma below it? */ --static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr) --{ -- return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP); --} -- --static inline int stack_guard_page_end(struct vm_area_struct *vma, -- unsigned long addr) --{ -- return (vma->vm_flags & VM_GROWSUP) && -- (vma->vm_end == addr) && -- !vma_growsup(vma->vm_next, addr); --} -- - int vma_is_stack_for_task(struct vm_area_struct *vma, struct task_struct *t); - - extern unsigned long move_page_tables(struct vm_area_struct *vma, -@@ -2153,6 +2125,7 @@ void page_cache_async_readahead(struct address_space *mapping, - pgoff_t offset, - unsigned long size); - -+extern unsigned long stack_guard_gap; - /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ - extern int expand_stack(struct vm_area_struct *vma, unsigned long address); - -@@ -2181,6 +2154,30 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m - return vma; - } - -+static inline unsigned long vm_start_gap(struct vm_area_struct *vma) -+{ -+ unsigned long vm_start = vma->vm_start; -+ -+ if (vma->vm_flags & VM_GROWSDOWN) { -+ vm_start -= stack_guard_gap; -+ if (vm_start > vma->vm_start) -+ vm_start = 0; -+ } -+ return vm_start; -+} -+ -+static inline unsigned long vm_end_gap(struct vm_area_struct *vma) -+{ -+ unsigned long vm_end = vma->vm_end; -+ -+ if (vma->vm_flags & VM_GROWSUP) { -+ vm_end += stack_guard_gap; -+ if (vm_end < vma->vm_end) -+ vm_end = -PAGE_SIZE; -+ } -+ return vm_end; -+} -+ - static inline unsigned long vma_pages(struct vm_area_struct *vma) - { - return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; -diff --git a/mm/gup.c b/mm/gup.c -index 22cc22e7432f..4b3723734623 100644 ---- a/mm/gup.c -+++ b/mm/gup.c -@@ -370,11 +370,6 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, - /* mlock all present pages, but do not fault in new pages */ - if ((*flags & (FOLL_POPULATE | FOLL_MLOCK)) == FOLL_MLOCK) - return -ENOENT; -- /* For mm_populate(), just skip the stack guard page. */ -- if ((*flags & FOLL_POPULATE) && -- (stack_guard_page_start(vma, address) || -- stack_guard_page_end(vma, address + PAGE_SIZE))) -- return -ENOENT; - if (*flags & FOLL_WRITE) - fault_flags |= FAULT_FLAG_WRITE; - if (*flags & FOLL_REMOTE) -diff --git a/mm/memory.c b/mm/memory.c -index 45f39f391cc2..527ef7841146 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -2695,40 +2695,6 @@ out_release: - } - - /* -- * This is like a special single-page "expand_{down|up}wards()", -- * except we must first make sure that 'address{-|+}PAGE_SIZE' -- * doesn't hit another vma. -- */ --static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address) --{ -- address &= PAGE_MASK; -- if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) { -- struct vm_area_struct *prev = vma->vm_prev; -- -- /* -- * Is there a mapping abutting this one below? -- * -- * That's only ok if it's the same stack mapping -- * that has gotten split.. -- */ -- if (prev && prev->vm_end == address) -- return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM; -- -- return expand_downwards(vma, address - PAGE_SIZE); -- } -- if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) { -- struct vm_area_struct *next = vma->vm_next; -- -- /* As VM_GROWSDOWN but s/below/above/ */ -- if (next && next->vm_start == address + PAGE_SIZE) -- return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM; -- -- return expand_upwards(vma, address + PAGE_SIZE); -- } -- return 0; --} -- --/* - * We enter with non-exclusive mmap_sem (to exclude vma changes, - * but allow concurrent faults), and pte mapped but not yet locked. - * We return with mmap_sem still held, but pte unmapped and unlocked. -@@ -2744,10 +2710,6 @@ static int do_anonymous_page(struct fault_env *fe) - if (vma->vm_flags & VM_SHARED) - return VM_FAULT_SIGBUS; - -- /* Check if we need to add a guard page to the stack */ -- if (check_stack_guard_page(vma, fe->address) < 0) -- return VM_FAULT_SIGSEGV; -- - /* - * Use pte_alloc() instead of pte_alloc_map(). We can't run - * pte_offset_map() on pmds where a huge pmd might be created -diff --git a/mm/mmap.c b/mm/mmap.c -index f3ebc5a54367..e1c1eb4b3942 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -176,6 +176,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) - unsigned long retval; - unsigned long newbrk, oldbrk; - struct mm_struct *mm = current->mm; -+ struct vm_area_struct *next; - unsigned long min_brk; - bool populate; - -@@ -221,7 +222,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) - } - - /* Check against existing mmap mappings. */ -- if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE)) -+ next = find_vma(mm, oldbrk); -+ if (next && newbrk + PAGE_SIZE > vm_start_gap(next)) - goto out; - - /* Ok, looks good - let it rip. */ -@@ -244,10 +246,22 @@ out: - - static long vma_compute_subtree_gap(struct vm_area_struct *vma) - { -- unsigned long max, subtree_gap; -- max = vma->vm_start; -- if (vma->vm_prev) -- max -= vma->vm_prev->vm_end; -+ unsigned long max, prev_end, subtree_gap; -+ -+ /* -+ * Note: in the rare case of a VM_GROWSDOWN above a VM_GROWSUP, we -+ * allow two stack_guard_gaps between them here, and when choosing -+ * an unmapped area; whereas when expanding we only require one. -+ * That's a little inconsistent, but keeps the code here simpler. -+ */ -+ max = vm_start_gap(vma); -+ if (vma->vm_prev) { -+ prev_end = vm_end_gap(vma->vm_prev); -+ if (max > prev_end) -+ max -= prev_end; -+ else -+ max = 0; -+ } - if (vma->vm_rb.rb_left) { - subtree_gap = rb_entry(vma->vm_rb.rb_left, - struct vm_area_struct, vm_rb)->rb_subtree_gap; -@@ -343,7 +357,7 @@ static void validate_mm(struct mm_struct *mm) - anon_vma_unlock_read(anon_vma); - } - -- highest_address = vma->vm_end; -+ highest_address = vm_end_gap(vma); - vma = vma->vm_next; - i++; - } -@@ -512,7 +526,7 @@ void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, - if (vma->vm_next) - vma_gap_update(vma->vm_next); - else -- mm->highest_vm_end = vma->vm_end; -+ mm->highest_vm_end = vm_end_gap(vma); - - /* - * vma->vm_prev wasn't known when we followed the rbtree to find the -@@ -765,7 +779,7 @@ again: - vma_gap_update(vma); - if (end_changed) { - if (!next) -- mm->highest_vm_end = end; -+ mm->highest_vm_end = vm_end_gap(vma); - else if (!adjust_next) - vma_gap_update(next); - } -@@ -1630,7 +1644,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) - - while (true) { - /* Visit left subtree if it looks promising */ -- gap_end = vma->vm_start; -+ gap_end = vm_start_gap(vma); - if (gap_end >= low_limit && vma->vm_rb.rb_left) { - struct vm_area_struct *left = - rb_entry(vma->vm_rb.rb_left, -@@ -1641,12 +1655,13 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) - } - } - -- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; -+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0; - check_current: - /* Check if current node has a suitable gap */ - if (gap_start > high_limit) - return -ENOMEM; -- if (gap_end >= low_limit && gap_end - gap_start >= length) -+ if (gap_end >= low_limit && -+ gap_end > gap_start && gap_end - gap_start >= length) - goto found; - - /* Visit right subtree if it looks promising */ -@@ -1668,8 +1683,8 @@ check_current: - vma = rb_entry(rb_parent(prev), - struct vm_area_struct, vm_rb); - if (prev == vma->vm_rb.rb_left) { -- gap_start = vma->vm_prev->vm_end; -- gap_end = vma->vm_start; -+ gap_start = vm_end_gap(vma->vm_prev); -+ gap_end = vm_start_gap(vma); - goto check_current; - } - } -@@ -1733,7 +1748,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) - - while (true) { - /* Visit right subtree if it looks promising */ -- gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; -+ gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0; - if (gap_start <= high_limit && vma->vm_rb.rb_right) { - struct vm_area_struct *right = - rb_entry(vma->vm_rb.rb_right, -@@ -1746,10 +1761,11 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) - - check_current: - /* Check if current node has a suitable gap */ -- gap_end = vma->vm_start; -+ gap_end = vm_start_gap(vma); - if (gap_end < low_limit) - return -ENOMEM; -- if (gap_start <= high_limit && gap_end - gap_start >= length) -+ if (gap_start <= high_limit && -+ gap_end > gap_start && gap_end - gap_start >= length) - goto found; - - /* Visit left subtree if it looks promising */ -@@ -1772,7 +1788,7 @@ check_current: - struct vm_area_struct, vm_rb); - if (prev == vma->vm_rb.rb_right) { - gap_start = vma->vm_prev ? -- vma->vm_prev->vm_end : 0; -+ vm_end_gap(vma->vm_prev) : 0; - goto check_current; - } - } -@@ -1810,7 +1826,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) - { - struct mm_struct *mm = current->mm; -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct vm_unmapped_area_info info; - - if (len > TASK_SIZE - mmap_min_addr) -@@ -1821,9 +1837,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, - - if (addr) { - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - return addr; - } - -@@ -1846,7 +1863,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - const unsigned long len, const unsigned long pgoff, - const unsigned long flags) - { -- struct vm_area_struct *vma; -+ struct vm_area_struct *vma, *prev; - struct mm_struct *mm = current->mm; - unsigned long addr = addr0; - struct vm_unmapped_area_info info; -@@ -1861,9 +1878,10 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, - /* requesting a specific address */ - if (addr) { - addr = PAGE_ALIGN(addr); -- vma = find_vma(mm, addr); -+ vma = find_vma_prev(mm, addr, &prev); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && -- (!vma || addr + len <= vma->vm_start)) -+ (!vma || addr + len <= vm_start_gap(vma)) && -+ (!prev || addr >= vm_end_gap(prev))) - return addr; - } - -@@ -1998,21 +2016,19 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr, - * update accounting. This is shared with both the - * grow-up and grow-down cases. - */ --static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow) -+static int acct_stack_growth(struct vm_area_struct *vma, -+ unsigned long size, unsigned long grow) - { - struct mm_struct *mm = vma->vm_mm; - struct rlimit *rlim = current->signal->rlim; -- unsigned long new_start, actual_size; -+ unsigned long new_start; - - /* address space limit tests */ - if (!may_expand_vm(mm, vma->vm_flags, grow)) - return -ENOMEM; - - /* Stack limit test */ -- actual_size = size; -- if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN))) -- actual_size -= PAGE_SIZE; -- if (actual_size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) -+ if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) - return -ENOMEM; - - /* mlock limit tests */ -@@ -2050,16 +2066,32 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns - int expand_upwards(struct vm_area_struct *vma, unsigned long address) - { - struct mm_struct *mm = vma->vm_mm; -+ struct vm_area_struct *next; -+ unsigned long gap_addr; - int error = 0; - - if (!(vma->vm_flags & VM_GROWSUP)) - return -EFAULT; - -- /* Guard against wrapping around to address 0. */ -- if (address < PAGE_ALIGN(address+4)) -- address = PAGE_ALIGN(address+4); -- else -+ /* Guard against exceeding limits of the address space. */ -+ address &= PAGE_MASK; -+ if (address >= TASK_SIZE) - return -ENOMEM; -+ address += PAGE_SIZE; -+ -+ /* Enforce stack_guard_gap */ -+ gap_addr = address + stack_guard_gap; -+ -+ /* Guard against overflow */ -+ if (gap_addr < address || gap_addr > TASK_SIZE) -+ gap_addr = TASK_SIZE; -+ -+ next = vma->vm_next; -+ if (next && next->vm_start < gap_addr) { -+ if (!(next->vm_flags & VM_GROWSUP)) -+ return -ENOMEM; -+ /* Check that both stack segments have the same anon_vma? */ -+ } - - /* We must make sure the anon_vma is allocated. */ - if (unlikely(anon_vma_prepare(vma))) -@@ -2104,7 +2136,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) - if (vma->vm_next) - vma_gap_update(vma->vm_next); - else -- mm->highest_vm_end = address; -+ mm->highest_vm_end = vm_end_gap(vma); - spin_unlock(&mm->page_table_lock); - - perf_event_mmap(vma); -@@ -2125,6 +2157,8 @@ int expand_downwards(struct vm_area_struct *vma, - unsigned long address) - { - struct mm_struct *mm = vma->vm_mm; -+ struct vm_area_struct *prev; -+ unsigned long gap_addr; - int error; - - address &= PAGE_MASK; -@@ -2132,6 +2166,17 @@ int expand_downwards(struct vm_area_struct *vma, - if (error) - return error; - -+ /* Enforce stack_guard_gap */ -+ gap_addr = address - stack_guard_gap; -+ if (gap_addr > address) -+ return -ENOMEM; -+ prev = vma->vm_prev; -+ if (prev && prev->vm_end > gap_addr) { -+ if (!(prev->vm_flags & VM_GROWSDOWN)) -+ return -ENOMEM; -+ /* Check that both stack segments have the same anon_vma? */ -+ } -+ - /* We must make sure the anon_vma is allocated. */ - if (unlikely(anon_vma_prepare(vma))) - return -ENOMEM; -@@ -2186,28 +2231,25 @@ int expand_downwards(struct vm_area_struct *vma, - return error; - } - --/* -- * Note how expand_stack() refuses to expand the stack all the way to -- * abut the next virtual mapping, *unless* that mapping itself is also -- * a stack mapping. We want to leave room for a guard page, after all -- * (the guard page itself is not added here, that is done by the -- * actual page faulting logic) -- * -- * This matches the behavior of the guard page logic (see mm/memory.c: -- * check_stack_guard_page()), which only allows the guard page to be -- * removed under these circumstances. -- */ -+/* enforced gap between the expanding stack and other mappings. */ -+unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT; -+ -+static int __init cmdline_parse_stack_guard_gap(char *p) -+{ -+ unsigned long val; -+ char *endptr; -+ -+ val = simple_strtoul(p, &endptr, 10); -+ if (!*endptr) -+ stack_guard_gap = val << PAGE_SHIFT; -+ -+ return 0; -+} -+__setup("stack_guard_gap=", cmdline_parse_stack_guard_gap); -+ - #ifdef CONFIG_STACK_GROWSUP - int expand_stack(struct vm_area_struct *vma, unsigned long address) - { -- struct vm_area_struct *next; -- -- address &= PAGE_MASK; -- next = vma->vm_next; -- if (next && next->vm_start == address + PAGE_SIZE) { -- if (!(next->vm_flags & VM_GROWSUP)) -- return -ENOMEM; -- } - return expand_upwards(vma, address); - } - -@@ -2229,14 +2271,6 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) - #else - int expand_stack(struct vm_area_struct *vma, unsigned long address) - { -- struct vm_area_struct *prev; -- -- address &= PAGE_MASK; -- prev = vma->vm_prev; -- if (prev && prev->vm_end == address) { -- if (!(prev->vm_flags & VM_GROWSDOWN)) -- return -ENOMEM; -- } - return expand_downwards(vma, address); - } - -@@ -2334,7 +2368,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, - vma->vm_prev = prev; - vma_gap_update(vma); - } else -- mm->highest_vm_end = prev ? prev->vm_end : 0; -+ mm->highest_vm_end = prev ? vm_end_gap(prev) : 0; - tail_vma->vm_next = NULL; - - /* Kill the cache */ --- -2.12.3 - diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend b/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend index 5e3594ef1..45c170661 100644 --- a/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -1,7 +1,14 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" # Backported fix for CVE-2017-1000364 -SRC_URI_append = " file://4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch \ - file://4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch \ - file://4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch \ - " +SRC_URI_append_core2-32-intel-common = "\ + file://4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch \ + file://4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch \ + file://4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch \ +" + +SRC_URI_append_corei7-64-intel-common = "\ + file://4.4-0001-mm-larger-stack-guard-gap-between-vmas.patch \ + file://4.4-0002-Allow-stack-to-grow-up-to-address-space-limit.patch \ + file://4.4-0003-mm-fix-new-crash-in-unmapped_area_topdown.patch \ +" diff --git a/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.8.bbappend b/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.8.bbappend deleted file mode 100644 index 39b651faa..000000000 --- a/meta-agl-bsp/recipes-kernel/linux/linux-yocto_4.8.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" - -# Backported fix for CVE-2017-1000364 -SRC_URI_append = " file://4.8-0001-SEC-Backport-Fix-CVE-2017-1000364-through-backport.patch " diff --git a/meta-agl-distro/conf/distro/poky-agl.conf b/meta-agl-distro/conf/distro/poky-agl.conf index 0e3d831c9..4931f96a8 100644 --- a/meta-agl-distro/conf/distro/poky-agl.conf +++ b/meta-agl-distro/conf/distro/poky-agl.conf @@ -56,13 +56,13 @@ DISTRO_FEATURES_remove = "x11" DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" -# Prefer GStreamer 1.8.x by default -PREFERRED_VERSION_gstreamer1.0 ?= "1.8.%" -PREFERRED_VERSION_gstreamer1.0-plugins-bad ?= "1.8.%" -PREFERRED_VERSION_gstreamer1.0-plugins-base ?= "1.8.%" -PREFERRED_VERSION_gstreamer1.0-plugins-good ?= "1.8.%" -PREFERRED_VERSION_gstreamer1.0-plugins-ugly ?= "1.8.%" -PREFERRED_VERSION_gstreamer1.0-libav ?= "1.8.%" +# Prefer GStreamer 1.10.x by default +PREFERRED_VERSION_gstreamer1.0 ?= "1.10.%" +PREFERRED_VERSION_gstreamer1.0-plugins-bad ?= "1.10.%" +PREFERRED_VERSION_gstreamer1.0-plugins-base ?= "1.10.%" +PREFERRED_VERSION_gstreamer1.0-plugins-good ?= "1.10.%" +PREFERRED_VERSION_gstreamer1.0-plugins-ugly ?= "1.10.%" +PREFERRED_VERSION_gstreamer1.0-libav ?= "1.10.%" PREFERRED_VERSION_gstreamer1.0-omx ?= "1.2.%" # Prefer libjpeg-turbo diff --git a/meta-agl/files/group b/meta-agl/files/group index dee2ad912..f84d528a6 100644 --- a/meta-agl/files/group +++ b/meta-agl/files/group @@ -84,3 +84,5 @@ opensaf::957: lldpd::956: postdrop::954: display::200: +agl-driver::1200: +agl-passenger::1201: diff --git a/meta-agl/files/passwd b/meta-agl/files/passwd index c992e52ff..28ba5bddc 100644 --- a/meta-agl/files/passwd +++ b/meta-agl/files/passwd @@ -56,3 +56,5 @@ opensaf::957:957::: lldpd::956:956::: cyrus::955:8::: display::200:200::: +agl-driver::1200:1200::: +agl-passenger::1201:1201::: diff --git a/meta-agl/recipes-connectivity/bluez5/.replaces.core b/meta-agl/recipes-connectivity/bluez5/.replaces.core deleted file mode 100644 index e69de29bb..000000000 --- a/meta-agl/recipes-connectivity/bluez5/.replaces.core +++ /dev/null diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5.inc b/meta-agl/recipes-connectivity/bluez5/bluez5.inc deleted file mode 100644 index 5869a1764..000000000 --- a/meta-agl/recipes-connectivity/bluez5/bluez5.inc +++ /dev/null @@ -1,121 +0,0 @@ -SUMMARY = "Linux Bluetooth Stack Userland V5" -DESCRIPTION = "Linux Bluetooth stack V5 userland components. These include a system configurations, daemons, tools and system libraries." -HOMEPAGE = "http://www.bluez.org" -SECTION = "libs" -LICENSE = "GPLv2+ & LGPLv2.1+" -LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \ - file://COPYING.LIB;md5=fb504b67c50331fc78734fed90fb0e09 \ - file://src/main.c;beginline=1;endline=24;md5=9bc54b93cd7e17bf03f52513f39f926e" -DEPENDS = "udev libusb dbus-glib glib-2.0 libcheck readline" -PROVIDES += "bluez-hcidump" -RPROVIDES_${PN} += "bluez-hcidump" - -RCONFLICTS_${PN} = "bluez4" - -PACKAGECONFIG ??= "obex-profiles" -PACKAGECONFIG[obex-profiles] = "--enable-obex,--disable-obex,libical" -PACKAGECONFIG[experimental] = "--enable-experimental,--disable-experimental," - -SRC_URI = "\ - git://git.kernel.org/pub/scm/bluetooth/bluez.git;protocol=https;branch=master \ - file://out-of-tree.patch \ - file://init \ - file://run-ptest \ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \ - file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ - file://bluetooth.conf \ -" -SRCREV = "c64b4d9e8dc3e36672061f39a9dba19ad0fb1ef1" -S = "${WORKDIR}/git" - -inherit autotools pkgconfig systemd update-rc.d distro_features_check ptest - -EXTRA_OECONF = "\ - --enable-tools \ - --disable-cups \ - --enable-test \ - --enable-datafiles \ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--enable-systemd', '--disable-systemd', d)} \ - --enable-library \ -" - -# bluez5 builds a large number of useful utilities but does not -# install them. Specify which ones we want put into ${PN}-noinst-tools. -NOINST_TOOLS_READLINE ??= "" -NOINST_TOOLS_EXPERIMENTAL ??= "" -NOINST_TOOLS = " \ - ${NOINST_TOOLS_READLINE} \ - ${@bb.utils.contains('PACKAGECONFIG', 'experimental', '${NOINST_TOOLS_EXPERIMENTAL}', '', d)} \ -" - -do_install_append() { - install -d ${D}${INIT_D_DIR} - install -m 0755 ${WORKDIR}/init ${D}${INIT_D_DIR}/bluetooth - - install -d ${D}${sysconfdir}/bluetooth/ - if [ -f ${S}/profiles/audio/audio.conf ]; then - install -m 0644 ${S}/profiles/audio/audio.conf ${D}/${sysconfdir}/bluetooth/ - fi - if [ -f ${S}/profiles/network/network.conf ]; then - install -m 0644 ${S}/profiles/network/network.conf ${D}/${sysconfdir}/bluetooth/ - fi - if [ -f ${S}/profiles/input/input.conf ]; then - install -m 0644 ${S}/profiles/input/input.conf ${D}/${sysconfdir}/bluetooth/ - fi - - install -m 0644 ${WORKDIR}/bluetooth.conf ${D}${sysconfdir}/dbus-1/system.d/bluetooth.conf - - if [ -f ${D}/${sysconfdir}/init.d/bluetooth ]; then - sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}/${sysconfdir}/init.d/bluetooth - fi - - # Install desired tools that upstream leaves in build area - for f in ${NOINST_TOOLS} ; do - install -m 755 ${B}/$f ${D}/${bindir} - done -} - -ALLOW_EMPTY_libasound-module-bluez = "1" -PACKAGES =+ "libasound-module-bluez ${PN}-testtools ${PN}-obex ${PN}-noinst-tools" - -FILES_libasound-module-bluez = "${libdir}/alsa-lib/lib*.so ${datadir}/alsa" -FILES_${PN} += "${libdir}/bluetooth/plugins/*.so ${base_libdir}/udev/ ${nonarch_base_libdir}/udev/ ${systemd_unitdir}/ ${datadir}/dbus-1" -FILES_${PN}-dev += "\ - ${libdir}/bluetooth/plugins/*.la \ - ${libdir}/alsa-lib/*.la \ -" - -FILES_${PN}-obex = "${libexecdir}/bluetooth/obexd \ - ${exec_prefix}/lib/systemd/user/obex.service \ - ${datadir}/dbus-1/services/org.bluez.obex.service \ - " -SYSTEMD_SERVICE_${PN}-obex = "obex.service" - -FILES_${PN}-testtools = "${libdir}/bluez/test/*" - -def get_noinst_tools_paths (d, bb, tools): - s = list() - bindir = d.getVar("bindir", True) - for bdp in tools.split(): - f = os.path.basename(bdp) - s.append("%s/%s" % (bindir, f)) - return "\n".join(s) - -FILES_${PN}-noinst-tools = "${@get_noinst_tools_paths(d, bb, d.getVar('NOINST_TOOLS', True))}" - -RDEPENDS_${PN}-testtools += "python python-dbus python-pygobject" - -SYSTEMD_SERVICE_${PN} = "bluetooth.service" -INITSCRIPT_PACKAGES = "${PN}" -INITSCRIPT_NAME_${PN} = "bluetooth" - -EXCLUDE_FROM_WORLD = "1" - -do_compile_ptest() { - oe_runmake buildtests -} - -do_install_ptest() { - cp -r ${B}/unit/ ${D}${PTEST_PATH} - rm -f ${D}${PTEST_PATH}/unit/*.o -} diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch b/meta-agl/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch deleted file mode 100644 index 2fde7bc06..000000000 --- a/meta-agl/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch +++ /dev/null @@ -1,63 +0,0 @@ -From: Giovanni Campagna <gcampagna-cNUdlRotFMnNLxjTenLetw@public.gmane.org> -Date: Sat, 12 Oct 2013 17:45:25 +0200 -Subject: [PATCH] Allow using obexd without systemd in the user session - -Not all sessions run systemd --user (actually, the majority -doesn't), so the dbus daemon must be able to spawn obexd -directly, and to do so it needs the full path of the daemon. - -Upstream-Status: Denied - -Not accepted by upstream maintainer for being a distro specific -configuration. See thread: - -http://thread.gmane.org/gmane.linux.bluez.kernel/38725/focus=38843 - -Signed-off-by: Javier Viguera <javier.viguera@digi.com> ---- - Makefile.obexd | 4 ++-- - obexd/src/org.bluez.obex.service | 4 ---- - obexd/src/org.bluez.obex.service.in | 4 ++++ - 3 files changed, 6 insertions(+), 6 deletions(-) - delete mode 100644 obexd/src/org.bluez.obex.service - create mode 100644 obexd/src/org.bluez.obex.service.in - -diff --git a/Makefile.obexd b/Makefile.obexd -index 2e33cbc72f2b..d5d858c857b4 100644 ---- a/Makefile.obexd -+++ b/Makefile.obexd -@@ -2,12 +2,12 @@ - if SYSTEMD - systemduserunitdir = @SYSTEMD_USERUNITDIR@ - systemduserunit_DATA = obexd/src/obex.service -+endif - - dbussessionbusdir = @DBUS_SESSIONBUSDIR@ - dbussessionbus_DATA = obexd/src/org.bluez.obex.service --endif - --EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service -+EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in - - obex_plugindir = $(libdir)/obex/plugins - -diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service -deleted file mode 100644 -index a53808884554..000000000000 ---- a/obexd/src/org.bluez.obex.service -+++ /dev/null -@@ -1,4 +0,0 @@ --[D-BUS Service] --Name=org.bluez.obex --Exec=/bin/false --SystemdService=dbus-org.bluez.obex.service -diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in -new file mode 100644 -index 000000000000..9c815f246b77 ---- /dev/null -+++ b/obexd/src/org.bluez.obex.service.in -@@ -0,0 +1,4 @@ -+[D-BUS Service] -+Name=org.bluez.obex -+Exec=@libexecdir@/obexd -+SystemdService=dbus-org.bluez.obex.service diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5/0001-tests-add-a-target-for-building-tests-without-runnin.patch b/meta-agl/recipes-connectivity/bluez5/bluez5/0001-tests-add-a-target-for-building-tests-without-runnin.patch deleted file mode 100644 index 24ddae6b6..000000000 --- a/meta-agl/recipes-connectivity/bluez5/bluez5/0001-tests-add-a-target-for-building-tests-without-runnin.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4bdf0f96dcaa945fd29f26d56e5b36d8c23e4c8b Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin <alex.kanavin@gmail.com> -Date: Fri, 1 Apr 2016 17:07:34 +0300 -Subject: [PATCH] tests: add a target for building tests without running them - -Upstream-Status: Inappropriate [oe specific] -Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> ---- - Makefile.am | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/Makefile.am b/Makefile.am -index 1a48a71..ba3b92f 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -425,6 +425,9 @@ endif - TESTS = $(unit_tests) - AM_TESTS_ENVIRONMENT = MALLOC_CHECK_=3 MALLOC_PERTURB_=69 - -+# This allows building tests without running them -+buildtests: $(TESTS) -+ - if DBUS_RUN_SESSION - AM_TESTS_ENVIRONMENT += dbus-run-session -- - endif --- -2.8.0.rc3 - diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5/bluetooth.conf b/meta-agl/recipes-connectivity/bluez5/bluez5/bluetooth.conf index 8e2204b22..1f2762de7 100644 --- a/meta-agl/recipes-connectivity/bluez5/bluez5/bluetooth.conf +++ b/meta-agl/recipes-connectivity/bluez5/bluez5/bluetooth.conf @@ -30,7 +30,7 @@ <allow send_destination="org.bluez"/> </policy> - <!-- allow users of lp group (printing subsystem) to + <!-- allow users of lp group (printing subsystem) to communicate with bluetoothd --> <policy group="lp"> <allow send_destination="org.bluez"/> diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5/init b/meta-agl/recipes-connectivity/bluez5/bluez5/init deleted file mode 100644 index 489e9b9eb..000000000 --- a/meta-agl/recipes-connectivity/bluez5/bluez5/init +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -PATH=/sbin:/bin:/usr/sbin:/usr/bin -DESC=bluetooth - -DAEMON=@LIBEXECDIR@/bluetooth/bluetoothd - -# If you want to be ignore error of "org.freedesktop.hostname1", -# please enable NOPLUGIN_OPTION. -# NOPLUGIN_OPTION="--noplugin=hostname" -NOPLUGIN_OPTION="" -SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION" - -test -f $DAEMON || exit 0 - -# FIXME: any of the sourced files may fail if/with syntax errors -test -f /etc/default/bluetooth && . /etc/default/bluetooth -test -f /etc/default/rcS && . /etc/default/rcS - -set -e - -case $1 in - start) - echo "Starting $DESC" - - if test "$BLUETOOTH_ENABLED" = 0; then - echo "disabled. see /etc/default/bluetooth" - exit 0 - fi - - start-stop-daemon --start --background $SSD_OPTIONS - echo "${DAEMON##*/}" - - ;; - stop) - echo "Stopping $DESC" - if test "$BLUETOOTH_ENABLED" = 0; then - echo "disabled." - exit 0 - fi - start-stop-daemon --stop $SSD_OPTIONS - echo "${DAEMON}" - ;; - restart|force-reload) - $0 stop - sleep 1 - $0 start - ;; - status) - pidof ${DAEMON} >/dev/null - status=$? - if [ $status -eq 0 ]; then - echo "bluetooth is running." - else - echo "bluetooth is not running" - fi - exit $status - ;; - *) - N=/etc/init.d/bluetooth - echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 - exit 1 - ;; -esac - -exit 0 - -# vim:noet diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5/out-of-tree.patch b/meta-agl/recipes-connectivity/bluez5/bluez5/out-of-tree.patch deleted file mode 100644 index 3ee79d704..000000000 --- a/meta-agl/recipes-connectivity/bluez5/bluez5/out-of-tree.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ed55b49a226ca3909f52416be2ae5ce1c5ca2cb2 Mon Sep 17 00:00:00 2001 -From: Ross Burton <ross.burton@intel.com> -Date: Fri, 22 Apr 2016 15:40:37 +0100 -Subject: [PATCH] Makefile.obexd: add missing mkdir in builtin.h generation - -In parallel out-of-tree builds it's possible that obexd/src/builtin.h is -generated before the target directory has been implicitly created. Solve this by -creating the directory before writing into it. - -Upstream-Status: Submitted -Signed-off-by: Ross Burton <ross.burton@intel.com> ---- - Makefile.obexd | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Makefile.obexd b/Makefile.obexd -index 2e33cbc..c8286f0 100644 ---- a/Makefile.obexd -+++ b/Makefile.obexd -@@ -105,2 +105,3 @@ obexd/src/plugin.$(OBJEXT): obexd/src/builtin.h - obexd/src/builtin.h: obexd/src/genbuiltin $(obexd_builtin_sources) -+ $(AM_V_at)$(MKDIR_P) $(dir $@) - $(AM_V_GEN)$(srcdir)/obexd/src/genbuiltin $(obexd_builtin_modules) > $@ --- -2.8.0.rc3 - diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5/run-ptest b/meta-agl/recipes-connectivity/bluez5/bluez5/run-ptest deleted file mode 100644 index 21df00c32..000000000 --- a/meta-agl/recipes-connectivity/bluez5/bluez5/run-ptest +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh - -cd unit - -failed=0 -all=0 - -for f in test-*; do - "./$f" - case "$?" in - 0) - echo "PASS: $f" - all=$((all + 1)) - ;; - 77) - echo "SKIP: $f" - ;; - *) - echo "FAIL: $f" - failed=$((failed + 1)) - all=$((all + 1)) - ;; - esac -done - -if [ "$failed" -eq 0 ] ; then - echo "All $all tests passed" -else - echo "$failed of $all tests failed" -fi - diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5_%.bbappend b/meta-agl/recipes-connectivity/bluez5/bluez5_%.bbappend new file mode 100644 index 000000000..ffb9d5b53 --- /dev/null +++ b/meta-agl/recipes-connectivity/bluez5/bluez5_%.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" +SRC_URI_append = " file://bluetooth.conf" + +do_install_append() { + install -m 0644 ${WORKDIR}/bluetooth.conf ${D}${sysconfdir}/dbus-1/system.d/bluetooth.conf +} diff --git a/meta-agl/recipes-connectivity/bluez5/bluez5_5.43.bb b/meta-agl/recipes-connectivity/bluez5/bluez5_5.43.bb deleted file mode 100644 index e10b82dd6..000000000 --- a/meta-agl/recipes-connectivity/bluez5/bluez5_5.43.bb +++ /dev/null @@ -1,55 +0,0 @@ -require bluez5.inc - -REQUIRED_DISTRO_FEATURES = "bluez5" - -SRC_URI[md5sum] = "698def88df96840dfbb0858bb6d73350" -SRC_URI[sha256sum] = "16c9c05d2a1da644ce3570d975ada3643d2e60c007a955bac09c0a0efeb58d15" - -# noinst programs in Makefile.tools that are conditional on READLINE -# support -NOINST_TOOLS_READLINE ?= " \ - attrib/gatttool \ - tools/obex-client-tool \ - tools/obex-server-tool \ - tools/bluetooth-player \ - tools/obexctl \ - tools/btmgmt \ -" - -# noinst programs in Makefile.tools that are conditional on EXPERIMENTAL -# support -NOINST_TOOLS_EXPERIMENTAL ?= " \ - emulator/btvirt \ - emulator/b1ee \ - emulator/hfp \ - tools/3dsp \ - tools/mgmt-tester \ - tools/gap-tester \ - tools/l2cap-tester \ - tools/sco-tester \ - tools/smp-tester \ - tools/hci-tester \ - tools/rfcomm-tester \ - tools/bdaddr \ - tools/avinfo \ - tools/avtest \ - tools/scotest \ - tools/amptest \ - tools/hwdb \ - tools/hcieventmask \ - tools/hcisecfilter \ - tools/btinfo \ - tools/btattach \ - tools/btsnoop \ - tools/btproxy \ - tools/btiotest \ - tools/mcaptest \ - tools/cltest \ - tools/oobtest \ - tools/seq2bseq \ - tools/ibeacon \ - tools/btgatt-client \ - tools/btgatt-server \ - tools/gatt-service \ - profiles/iap/iapd \ -" diff --git a/meta-agl/recipes-core/images/agl-image-minimal.inc b/meta-agl/recipes-core/images/agl-image-minimal.inc index a0818845c..825393978 100644 --- a/meta-agl/recipes-core/images/agl-image-minimal.inc +++ b/meta-agl/recipes-core/images/agl-image-minimal.inc @@ -2,7 +2,7 @@ IMAGE_LINGUAS = " " inherit core-image -IMAGE_INSTALL = "${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}" +IMAGE_INSTALL = "${CORE_IMAGE_EXTRA_INSTALL}" IMAGE_ROOTFS_SIZE ?= "8192" diff --git a/meta-agl/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend b/meta-agl/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend deleted file mode 100644 index c61d94e62..000000000 --- a/meta-agl/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend +++ /dev/null @@ -1,2 +0,0 @@ -RDEPENDS_${PN} =+ "nativesdk-cmake" - diff --git a/meta-agl/recipes-devtools/python/python-pycrypto/cross-compiling.patch b/meta-agl/recipes-devtools/python/python-pycrypto/cross-compiling.patch deleted file mode 100644 index 712f3e8dd..000000000 --- a/meta-agl/recipes-devtools/python/python-pycrypto/cross-compiling.patch +++ /dev/null @@ -1,23 +0,0 @@ -Index: pycrypto-2.6/setup.py -=================================================================== ---- pycrypto-2.6.orig/setup.py -+++ pycrypto-2.6/setup.py -@@ -271,7 +271,8 @@ class PCTBuildConfigure(Command): - if not os.path.exists("config.status"): - if os.system("chmod 0755 configure") != 0: - raise RuntimeError("chmod error") -- cmd = "sh configure" # we use "sh" here so that it'll work on mingw32 with standard python.org binaries -+ host = os.environ.get("HOST_SYS") -+ cmd = "ac_cv_func_malloc_0_nonnull=yes sh configure --host " + host # we use "sh" here so that it'll work on mingw32 with standard python.org binaries - if self.verbose < 1: - cmd += " -q" - if os.system(cmd) != 0: -@@ -370,7 +371,7 @@ kw = {'name':"pycrypto", - 'ext_modules': plat_ext + [ - # _fastmath (uses GNU mp library) - Extension("Crypto.PublicKey._fastmath", -- include_dirs=['src/','/usr/include/'], -+ include_dirs=['src/'], - libraries=['gmp'], - sources=["src/_fastmath.c"]), - diff --git a/meta-agl/recipes-devtools/python/python-pycrypto_2.6.1.bb b/meta-agl/recipes-devtools/python/python-pycrypto_2.6.1.bb deleted file mode 100644 index f7a69dc9a..000000000 --- a/meta-agl/recipes-devtools/python/python-pycrypto_2.6.1.bb +++ /dev/null @@ -1,23 +0,0 @@ -DESCRIPTION = "Cryptographic modules for Python." -HOMEPAGE = "http://www.pycrypto.org/" -LICENSE = "PSFv2" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=35f354d199e8cb7667b059a23578e63d" - -DEPENDS += " gmp" -PYPI_PACKAGE = "pycrypto" - -SRC_URI = "file://cross-compiling.patch" - -SRC_URI[md5sum] = "55a61a054aa66812daf5161a0d5d7eda" -SRC_URI[sha256sum] = "f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c" - -inherit pypi autotools-brokensep distutils -BBCLASSEXTEND = "native" -do_compile[noexec] = "1" - -# We explicitly call distutils_do_install, since we want it to run, but -# *don't* want the autotools install to run, since this package doesn't -# provide a "make install" target. -do_install() { - distutils_do_install -} diff --git a/meta-agl/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.service b/meta-agl/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.service deleted file mode 100644 index a486ac7ba..000000000 --- a/meta-agl/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Target Communication Framework agent -After=network.target - -[Service] -Type=forking -ExecStart=@SBINDIR@/tcf-agent -d -L- -l0 -KillSignal=USR2 -SuccessExitStatus=USR2 - -[Install] -WantedBy=multi-user.target diff --git a/meta-agl/recipes-devtools/tcf-agent/tcf-agent_git.bbappend b/meta-agl/recipes-devtools/tcf-agent/tcf-agent_git.bbappend deleted file mode 100644 index 6f444b32f..000000000 --- a/meta-agl/recipes-devtools/tcf-agent/tcf-agent_git.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -# This is a backport of: -# https://patchwork.openembedded.org/patch/140355/ -FILESEXTRAPATHS_prepend := "${THISDIR}/tcf-agent:" diff --git a/meta-agl/recipes-graphics/wayland/weston/0001-Allow-regular-users-to-launch-Weston.patch b/meta-agl/recipes-graphics/wayland/weston/0001-Allow-regular-users-to-launch-Weston_2.0.0.patch index 7b84a67ba..bd1a72b0f 100644 --- a/meta-agl/recipes-graphics/wayland/weston/0001-Allow-regular-users-to-launch-Weston.patch +++ b/meta-agl/recipes-graphics/wayland/weston/0001-Allow-regular-users-to-launch-Weston_2.0.0.patch @@ -1,20 +1,20 @@ -From f5555b045a64231d4beaba51cbbf5f5485173900 Mon Sep 17 00:00:00 2001 +From 6c145cea35f0b77613d6e3f48679c976b9839d7c Mon Sep 17 00:00:00 2001 From: Ronan Le Martret <ronan.lemartret@iot.bzh> -Date: Fri, 14 Apr 2017 19:04:32 +0200 +Date: Wed, 31 May 2017 22:48:18 +0000 Subject: [PATCH] Allow regular users to launch Weston Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> --- - configure.ac | 6 ++++++ - src/launcher-direct.c | 2 ++ + configure.ac | 6 ++++++ + libweston/launcher-direct.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac -index 1d11864..4e48d52 100644 +index 7e84c14..8b3e17e 100644 --- a/configure.ac +++ b/configure.ac -@@ -131,6 +131,12 @@ if test x$enable_xkbcommon = xyes; then - COMPOSITOR_MODULES="$COMPOSITOR_MODULES xkbcommon >= 0.3.0" +@@ -155,6 +155,12 @@ if test x$enable_xkbcommon = xyes; then + true) fi +AC_ARG_ENABLE(sys-uid, [ --enable-sys-uid],, @@ -26,11 +26,11 @@ index 1d11864..4e48d52 100644 AC_ARG_ENABLE(setuid-install, [ --enable-setuid-install],, enable_setuid_install=yes) AM_CONDITIONAL(ENABLE_SETUID_INSTALL, test x$enable_setuid_install = xyes) -diff --git a/src/launcher-direct.c b/src/launcher-direct.c -index 29d9c28..1ac6651 100644 ---- a/src/launcher-direct.c -+++ b/src/launcher-direct.c -@@ -272,8 +272,10 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * +diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c +index 4fc1c3c..8f16a69 100644 +--- a/libweston/launcher-direct.c ++++ b/libweston/launcher-direct.c +@@ -275,8 +275,10 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * { struct launcher_direct *launcher; @@ -42,5 +42,5 @@ index 29d9c28..1ac6651 100644 launcher = zalloc(sizeof(*launcher)); if (launcher == NULL) -- -2.6.6 +2.7.4 diff --git a/meta-agl/recipes-graphics/wayland/weston/0001-compositor-drm.c-Launch-without-input-devices.patch b/meta-agl/recipes-graphics/wayland/weston/0001-compositor-drm.c-Launch-without-input-devices.patch deleted file mode 100644 index 93b7739fd..000000000 --- a/meta-agl/recipes-graphics/wayland/weston/0001-compositor-drm.c-Launch-without-input-devices.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 43f66e20a6788388df4fc052d257f005c359080f Mon Sep 17 00:00:00 2001 -From: Leon Anavi <leon.anavi@konsulko.com> -Date: Wed, 14 Dec 2016 12:26:31 +0200 -Subject: [PATCH] compositor-drm.c: Launch without input devices - -Launch Weston 11 even if input devices (such as -a keyboard, a mouse or a touchscreen) are not -present. - -Signed-off-by: Leon Anavi <leon.anavi@konsulko.com> ---- - src/compositor-drm.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/compositor-drm.c b/src/compositor-drm.c -index fd89627..f66e0af 100644 ---- a/src/compositor-drm.c -+++ b/src/compositor-drm.c -@@ -3123,7 +3123,6 @@ drm_backend_create(struct weston_compositor *compositor, - if (udev_input_init(&b->input, - compositor, b->udev, seat_id) < 0) { - weston_log("failed to create input devices\n"); -- goto err_sprite; - } - - if (create_outputs(b, config->connector, drm_device) < 0) { --- -2.7.4 diff --git a/meta-agl/recipes-graphics/wayland/weston_%.bbappend b/meta-agl/recipes-graphics/wayland/weston_%.bbappend deleted file mode 100644 index 0fe75ede6..000000000 --- a/meta-agl/recipes-graphics/wayland/weston_%.bbappend +++ /dev/null @@ -1,8 +0,0 @@ -FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" - -SRC_URI_append = "\ - file://0001-compositor-drm.c-Launch-without-input-devices.patch \ - file://0001-Allow-regular-users-to-launch-Weston.patch \ - " - -EXTRA_OECONF_append = " --enable-sys-uid" diff --git a/meta-agl/recipes-graphics/wayland/weston_2.0.0.bbappend b/meta-agl/recipes-graphics/wayland/weston_2.0.0.bbappend new file mode 100644 index 000000000..65f34bc24 --- /dev/null +++ b/meta-agl/recipes-graphics/wayland/weston_2.0.0.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" + +SRC_URI_append = "\ + file://0001-Allow-regular-users-to-launch-Weston_2.0.0.patch \ + " + +EXTRA_OECONF_append = " --enable-sys-uid" diff --git a/meta-agl/recipes-multimedia/faac/faac_%.bbappend b/meta-agl/recipes-multimedia/faac/faac_%.bbappend deleted file mode 100644 index eb975881b..000000000 --- a/meta-agl/recipes-multimedia/faac/faac_%.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" -SRC_URI += "file://0001-frontend-Fix-format-string-security-error.patch \ - file://0002-mp4v2-Define-__STRING-if-cdefs.h-does-not-exist.patch \ - " diff --git a/meta-agl/recipes-multimedia/faac/files/0001-frontend-Fix-format-string-security-error.patch b/meta-agl/recipes-multimedia/faac/files/0001-frontend-Fix-format-string-security-error.patch deleted file mode 100644 index 75e003eac..000000000 --- a/meta-agl/recipes-multimedia/faac/files/0001-frontend-Fix-format-string-security-error.patch +++ /dev/null @@ -1,26 +0,0 @@ -From c1d7a8b992dc36d0012cc3d54b7d3abf4ad4d5d8 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Tue, 28 Mar 2017 21:33:01 -0700 -Subject: [PATCH 1/2] frontend: Fix format string security error - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - frontend/main.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/frontend/main.c b/frontend/main.c -index 02146a8..cb9329c 100644 ---- a/frontend/main.c -+++ b/frontend/main.c -@@ -715,7 +715,7 @@ int main(int argc, char *argv[]) - break; - #endif - case 'L': -- fprintf(stderr, faac_copyright_string); -+ fprintf(stderr, "%s", faac_copyright_string); - dieMessage = license; - break; - case 'X': --- -2.12.1 - diff --git a/meta-agl/recipes-multimedia/faac/files/0002-mp4v2-Define-__STRING-if-cdefs.h-does-not-exist.patch b/meta-agl/recipes-multimedia/faac/files/0002-mp4v2-Define-__STRING-if-cdefs.h-does-not-exist.patch deleted file mode 100644 index d845ddf59..000000000 --- a/meta-agl/recipes-multimedia/faac/files/0002-mp4v2-Define-__STRING-if-cdefs.h-does-not-exist.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 46cc9298c38b9dd735fec3f39aa2d6e56a362410 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Tue, 28 Mar 2017 21:33:36 -0700 -Subject: [PATCH 2/2] mp4v2: Define __STRING if cdefs.h does not exist - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - common/mp4v2/mp4util.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/common/mp4v2/mp4util.h b/common/mp4v2/mp4util.h -index 1f9cb64..1e7aced 100644 ---- a/common/mp4v2/mp4util.h -+++ b/common/mp4v2/mp4util.h -@@ -23,6 +23,10 @@ - #define __MP4_UTIL_INCLUDED__ - #include <assert.h> - -+#ifndef __STRING -+#define __STRING(x) #x -+#endif -+ - #ifndef ASSERT - #define ASSERT(expr) \ - if (!(expr)) { \ --- -2.12.1 - diff --git a/meta-agl/recipes-support/gpm/.appends.meta-oe b/meta-agl/recipes-support/gpm/.appends.meta-oe deleted file mode 100644 index e69de29bb..000000000 --- a/meta-agl/recipes-support/gpm/.appends.meta-oe +++ /dev/null diff --git a/meta-agl/recipes-support/gpm/gpm_1.99.7.bbappend b/meta-agl/recipes-support/gpm/gpm_1.99.7.bbappend deleted file mode 100644 index 5f68521d5..000000000 --- a/meta-agl/recipes-support/gpm/gpm_1.99.7.bbappend +++ /dev/null @@ -1,7 +0,0 @@ -# Original src_uri n/a, Use mirror. -SRC_URI = "http://www.nico.schottelius.org/software/gpm/archives/gpm-1.99.7.tar.bz2 \ - file://no-docs.patch \ - file://processcreds.patch \ - file://eglibc-2.17.patch \ - file://init \ - " diff --git a/meta-agl/recipes-support/libsoup/libsoup-2.4_%.bbappend b/meta-agl/recipes-support/libsoup/libsoup-2.4_%.bbappend new file mode 100644 index 000000000..06651fc11 --- /dev/null +++ b/meta-agl/recipes-support/libsoup/libsoup-2.4_%.bbappend @@ -0,0 +1 @@ +EXTRA_OECONF_append_class-native = " --disable-tls-check" diff --git a/meta-app-framework/recipes-core/af-main/af-main_1.0.inc b/meta-app-framework/recipes-core/af-main/af-main_1.0.inc index 2d910c562..e872fd769 100644 --- a/meta-app-framework/recipes-core/af-main/af-main_1.0.inc +++ b/meta-app-framework/recipes-core/af-main/af-main_1.0.inc @@ -23,7 +23,7 @@ afm_name = "afm" afm_confdir = "${sysconfdir}/${afm_name}" afm_datadir = "/var/local/lib/${afm_name}" afb_binding_dir = "${libdir}/afb" -systemd_units_root = "/usr/local/lib/systemd" +systemd_units_root = "/var/local/lib/systemd" CFLAGS_append_agl-devel = " -DAGL_DEVEL" diff --git a/meta-app-framework/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home-native.patch b/meta-app-framework/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home-native.patch deleted file mode 100644 index ff420d8a2..000000000 --- a/meta-app-framework/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home-native.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 008637fc8bd7f601eb6554d572bba025613913b7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Wed, 8 Mar 2017 14:10:10 +0100 -Subject: [PATCH] useradd: copy extended attributes of home (native) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Home directory wasn't getting the extended attributes -of /etc/skel. This patch fixes that issue and adds the copy -of the extended attributes of the root of the home directory. - -Change-Id: Ib6836e1b18c4c7f73e02c1f1fc9558dc749ba9da -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - src/useradd.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/useradd.c b/src/useradd.c -index 4c418af..8ba8af6 100644 ---- a/src/useradd.c -+++ b/src/useradd.c -@@ -55,6 +55,9 @@ - #include <sys/stat.h> - #include <sys/types.h> - #include <time.h> -+#ifdef WITH_ATTR -+#include <attr/libattr.h> -+#endif - #include "chkname.h" - #include "defines.h" - #include "faillog.h" -@@ -1950,6 +1953,9 @@ static void create_home (void) - chown (user_home, user_id, user_gid); - chmod (user_home, - 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK)); -+#ifdef WITH_ATTR -+ attr_copy_file (def_template, user_home, NULL, NULL); -+#endif - home_added = true; - #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_USER, Prog, --- -2.9.3 - diff --git a/meta-app-framework/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home.patch b/meta-app-framework/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home.patch deleted file mode 100644 index f231c3cfe..000000000 --- a/meta-app-framework/recipes-extended/shadow/files/0001-useradd-copy-extended-attributes-of-home.patch +++ /dev/null @@ -1,45 +0,0 @@ -From acec93540eba6899661c607408498ac72ab07a47 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Tue, 7 Mar 2017 16:03:03 +0100 -Subject: [PATCH] useradd: copy extended attributes of home -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Home directory wasn't getting the extended attributes -of /etc/skel. This patch fixes that issue and adds the copy -of the extended attributes of the root of the home directory. - -Change-Id: Icd633f7c6c494efd2a30cb8f04c306f749ad0c3b -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - src/useradd.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/useradd.c b/src/useradd.c -index a8a1f76..8aefb9c 100644 ---- a/src/useradd.c -+++ b/src/useradd.c -@@ -52,6 +52,9 @@ - #include <sys/stat.h> - #include <sys/types.h> - #include <time.h> -+#ifdef WITH_ATTR -+#include <attr/libattr.h> -+#endif - #include "chkname.h" - #include "defines.h" - #include "faillog.h" -@@ -1915,6 +1918,9 @@ static void create_home (void) - chown (user_home, user_id, user_gid); - chmod (user_home, - 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK)); -+#ifdef WITH_ATTR -+ attr_copy_file (def_template, user_home, NULL, NULL); -+#endif - home_added = true; - #ifdef WITH_AUDIT - audit_logger (AUDIT_ADD_USER, Prog, --- -2.9.3 - diff --git a/meta-app-framework/recipes-extended/shadow/shadow_%.bbappend b/meta-app-framework/recipes-extended/shadow/shadow_%.bbappend deleted file mode 100644 index f08435502..000000000 --- a/meta-app-framework/recipes-extended/shadow/shadow_%.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -SRC_URI_append_class-target = " file://0001-useradd-copy-extended-attributes-of-home.patch " -SRC_URI_append_class-native = " file://0001-useradd-copy-extended-attributes-of-home-native.patch " diff --git a/meta-app-framework/recipes-security/cynara/cynara_git.bbappend b/meta-app-framework/recipes-security/cynara/cynara_git.bbappend new file mode 100644 index 000000000..9a61e7044 --- /dev/null +++ b/meta-app-framework/recipes-security/cynara/cynara_git.bbappend @@ -0,0 +1,39 @@ +pkg_postinst_${PN} () { + # Fail on error. + set -e + + # It would be nice to run the code below while building an image, + # but currently the calls to cynara-db-chsgen (a binary) in + # cynara-db-migration (a script) prevent that. Rely instead + # on OE's support for running failed postinst scripts at first boot. + if [ x"$D" != "x" ]; then + exit 1 + fi + + mkdir -p $D${sysconfdir}/cynara + ${CHSMACK} -a System $D${sysconfdir}/cynara + + # Strip git patch level information, the version comparison code + # in cynara-db-migration only expect major.minor.patch version numbers. + VERSION=${@d.getVar('PV',d,1).split('+git')[0]} + if [ -d $D${localstatedir}/cynara ] ; then + # upgrade + echo "NOTE: updating cynara DB to version $VERSION" + $D${sbindir}/cynara-db-migration upgrade -f 0.0.0 -t $VERSION + else + # install + echo "NOTE: creating cynara DB for version $VERSION" + mkdir -p $D${localstatedir}/cynara + ${CHSMACK} -a System $D${localstatedir}/cynara + $D${sbindir}/cynara-db-migration install -t $VERSION + fi + + # Workaround for systemd.bbclass issue: it would call + # "systemctl start" without "--no-block", but because + # the service is not ready to run at the time when + # this scripts gets executed by run-postinsts.service, + # booting deadlocks. + echo "NOTE: enabling and starting cynara service" + systemctl enable cynara + systemctl start --no-block cynara +} diff --git a/meta-app-framework/recipes-security/security-manager/security-manager_git.bbappend b/meta-app-framework/recipes-security/security-manager/security-manager_git.bbappend new file mode 100644 index 000000000..424b49358 --- /dev/null +++ b/meta-app-framework/recipes-security/security-manager/security-manager_git.bbappend @@ -0,0 +1,2 @@ +do_patch[depends] += "quilt-native:do_populate_sysroot libcap:do_populate_sysroot" +APPLY = "no" diff --git a/meta-ivi-common/recipes-core/packagegroups/packagegroup-ivi-common-core-multimedia.bb b/meta-ivi-common/recipes-core/packagegroups/packagegroup-ivi-common-core-multimedia.bb index b43215b99..58b8f38e0 100644 --- a/meta-ivi-common/recipes-core/packagegroups/packagegroup-ivi-common-core-multimedia.bb +++ b/meta-ivi-common/recipes-core/packagegroups/packagegroup-ivi-common-core-multimedia.bb @@ -13,7 +13,6 @@ ALLOW_EMPTY_${PN} = "1" RDEPENDS_${PN} += "\ agl-audio-plugin \ - alsa-lib \ alsa-utils \ pulseaudio-server \ pulseaudio-misc \ diff --git a/meta-ivi-common/recipes-extended/dlt-daemon/dlt-daemon_2.11.1.bb b/meta-ivi-common/recipes-extended/dlt-daemon/dlt-daemon_2.11.1.bb index e6204c46f..b521bca91 100644 --- a/meta-ivi-common/recipes-extended/dlt-daemon/dlt-daemon_2.11.1.bb +++ b/meta-ivi-common/recipes-extended/dlt-daemon/dlt-daemon_2.11.1.bb @@ -13,7 +13,8 @@ LICENSE = "MPLv2" LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=99ba60c3fad7eaf8c56bca6dd75cba09 \ file://MPL.txt;md5=ccdb2761cef70c8b2612624c323f89dc" -DEPENDS = "dbus zlib" +DEPENDS = "dbus zlib pigz-native" +do_unpack[depends] += "pigz-native:do_populate_sysroot" # FIX ME # This should be TAG = "v${PV}" but yocto doesn't support lightweight tags for now @@ -27,7 +28,7 @@ SRC_URI = "git://git.projects.genivi.org/${PN}.git;branch=${BRANCH};tag=${TAG} \ file://0004-Modify-systemd-config-directory.patch" S = "${WORKDIR}/git" -inherit gzipnative autotools gettext cmake systemd +inherit autotools gettext cmake systemd # -fPIC is needed to prevent relocation errors when we compile gtest with # Yocto security flags. See this issue for more details: diff --git a/meta-ivi-common/recipes-extended/dlt-daemon/dlt-daemon_2.15.0.bb b/meta-ivi-common/recipes-extended/dlt-daemon/dlt-daemon_2.15.0.bb index cdd80de50..dbc87c9ac 100644 --- a/meta-ivi-common/recipes-extended/dlt-daemon/dlt-daemon_2.15.0.bb +++ b/meta-ivi-common/recipes-extended/dlt-daemon/dlt-daemon_2.15.0.bb @@ -12,7 +12,8 @@ SECTION = "console/utils" LICENSE = "MPLv2" LIC_FILES_CHKSUM = "file://LICENSE;md5=8184208060df880fe3137b93eb88aeea" -DEPENDS = "dbus zlib" +DEPENDS = "dbus zlib pigz-native" +do_unpack[depends] += "pigz-native:do_populate_sysroot" SRCREV = "e9a486a08fff6d3cc7133a350cec3ee10f463207" SRC_URI = "git://git.projects.genivi.org/${BPN}.git;protocol=http \ @@ -21,7 +22,7 @@ SRC_URI = "git://git.projects.genivi.org/${BPN}.git;protocol=http \ " S = "${WORKDIR}/git" -inherit gzipnative autotools gettext cmake systemd +inherit autotools gettext cmake systemd # -fPIC is needed to prevent relocation errors when we compile gtest with # Yocto security flags. See this issue for more details: diff --git a/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension/0001-Fix-ivi-application-lib-install.patch b/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension/0001-Fix-ivi-application-lib-install.patch deleted file mode 100644 index 4140ce576..000000000 --- a/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension/0001-Fix-ivi-application-lib-install.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1e13c6d494a8b542c2a7f8251afc7aec401e3ad8 Mon Sep 17 00:00:00 2001 -From: Ronan Le Martret <ronan.lemartret@iot.bzh> -Date: Tue, 7 Feb 2017 17:13:47 +0100 -Subject: [PATCH] Fix ivi-application lib install - - * libivi-application.so must be a link to - libivi-application.so.X.X.XX - * fix yocto package QA - -Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> ---- - protocol/CMakeLists.txt | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/protocol/CMakeLists.txt b/protocol/CMakeLists.txt -index 613a1a6..09d5126 100644 ---- a/protocol/CMakeLists.txt -+++ b/protocol/CMakeLists.txt -@@ -170,6 +170,8 @@ install( - DESTINATION include/ilm - ) - -+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${ILM_API_VERSION} SOVERSION ${ILM_API_VERSION}) -+ - #============================================================================================= - # generate documentation for ivi-application API - #============================================================================================= --- -2.6.6 - diff --git a/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension_1.11.0.bb b/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension_1.11.0.bb index 581cc5b13..0ed8d9c7c 100644 --- a/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension_1.11.0.bb +++ b/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension_1.11.0.bb @@ -5,12 +5,12 @@ BUGTRACKER = "http://bugs.genivi.org/enter_bug.cgi?product=Wayland%20IVI%20Exten LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=1f1a56bb2dadf5f2be8eb342acf4ed79" -SRCREV = "c9001582b10ce209c37b42dd560947c5aa8928b3" +SRCREV = "3ebb7b74e60a35d549284e7f77183de66bef18e0" SRC_URI = "git://github.com/GENIVI/${BPN}.git;protocol=http \ " S = "${WORKDIR}/git" -DEPENDS = "weston virtual/libgles2 pixman" +DEPENDS = "weston virtual/libgles2 pixman wayland-native" inherit cmake diff --git a/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension_1.11.0.bbappend b/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension_1.11.0.bbappend index 6e0789f26..9508dc6d1 100755 --- a/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension_1.11.0.bbappend +++ b/meta-ivi-common/recipes-graphics/wayland/wayland-ivi-extension_1.11.0.bbappend @@ -1,12 +1,6 @@ FILESEXTRAPATHS_prepend := ":${THISDIR}/wayland-ivi-extension:" - -SRC_URI_append = " \ - file://0001-Fix-ivi-application-lib-install.patch \ - " - -SRC_URI_append_wandboard = "file://wandboard_fix_build.patch" - +SRC_URI_append_wandboard = " file://wandboard_fix_build.patch" # workaround paralellism issue: -PARALLEL_MAKE = ""
\ No newline at end of file +PARALLEL_MAKE = "" diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0001-install-files-for-a-module-development.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0001-install-files-for-a-module-development.patch index 8c5f9efd4..8c5f9efd4 100644 --- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0001-install-files-for-a-module-development.patch +++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0001-install-files-for-a-module-development.patch diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0002-volume-ramp-additions-to-the-low-level-infra.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0002-volume-ramp-additions-to-the-low-level-infra.patch index 9cee6f5de..9cee6f5de 100644 --- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0002-volume-ramp-additions-to-the-low-level-infra.patch +++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0002-volume-ramp-additions-to-the-low-level-infra.patch diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0003-volume-ramp-adding-volume-ramping-to-sink-input.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0003-volume-ramp-adding-volume-ramping-to-sink-input.patch index eb485ca7c..eb485ca7c 100644 --- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0003-volume-ramp-adding-volume-ramping-to-sink-input.patch +++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0003-volume-ramp-adding-volume-ramping-to-sink-input.patch diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0004-sink-input-Code-cleanup-regarding-volume-ramping.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0004-sink-input-Code-cleanup-regarding-volume-ramping.patch index 64d7b141d..64d7b141d 100644 --- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0004-sink-input-Code-cleanup-regarding-volume-ramping.patch +++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0004-sink-input-Code-cleanup-regarding-volume-ramping.patch diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch index e371b7ec5..e371b7ec5 100644 --- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch +++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch index 50110bd14..50110bd14 100644 --- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch +++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/enable-ofono-hfp-backend.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/enable-ofono-hfp-backend.patch index 85b1ae03d..85b1ae03d 100644 --- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-9.0/enable-ofono-hfp-backend.patch +++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-10.0/enable-ofono-hfp-backend.patch diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_9.0.bbappend b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_10.0.bbappend index d87693ad2..f59ee89d5 100644 --- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_9.0.bbappend +++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_10.0.bbappend @@ -1,4 +1,4 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/pulseaudio-9.0:" +FILESEXTRAPATHS_prepend := "${THISDIR}/pulseaudio-10.0:" SRC_URI += " \ file://0001-install-files-for-a-module-development.patch \ diff --git a/meta-ivi-common/recipes-test/freetype/freetype_%.bbappend b/meta-ivi-common/recipes-test/freetype/freetype_2.7.1.bbappend index a5c67299b..0593cf573 100644 --- a/meta-ivi-common/recipes-test/freetype/freetype_%.bbappend +++ b/meta-ivi-common/recipes-test/freetype/freetype_2.7.1.bbappend @@ -4,8 +4,8 @@ SRC_URI =+ "${SOURCEFORGE_MIRROR}/freetype/ft2demos-${PV}.tar.bz2;name=ft2demos file://0001-Makefile-dont-build-gfx-demos.patch;patchdir=../ft2demos-${PV} \ file://0001-ft2demos-Makefile-Do-not-hardcode-libtool-path.patch;patchdir=../ft2demos-${PV} \ " -SRC_URI[ft2demos.md5sum] = "b8185d15751e9decd21d0e7e63cccbf6" -SRC_URI[ft2demos.sha256sum] = "568a8f3a6301189a881d2f7ec95da280d20c862de94d81815341870e380b00e6" +SRC_URI[ft2demos.md5sum] = "5c10cb35bec755dbd3f7999e0f97aee3" +SRC_URI[ft2demos.sha256sum] = "d3f8a0d5a3f0d58701133458a8c1d3f97f658869f3c904b1fda447ed3b290ecd" PACKAGES =+ "${PN}-demos" |