From patchwork Thu Jun 7 18:31:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Kamboju X-Patchwork-Id: 137897 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2432825lji; Thu, 7 Jun 2018 11:31:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLx4jEACT/US3mG082VyHKIN9fZeg2C7hN3SKw2ZrP96BpCqs7UfynQ6jcOi693ftT2oA5f X-Received: by 2002:a17:902:900a:: with SMTP id a10-v6mr3142966plp.41.1528396305391; Thu, 07 Jun 2018 11:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528396305; cv=none; d=google.com; s=arc-20160816; b=VumWiLNVHA1iLLhD5p1Bcb9kwCDQsiDuptXo/y3eOPfP8T+mz/yw76flLiNFJ+FJPC c8kKmHQgY+shsCf4dSUnmUWHEP5raZU7Gy+v8z3OPzptUp80gT3AqeUwTLdpZdS9Csqv 7DvcI4/kboTrz6GZmheIx6oSzHuEA05XvotLnsiviUVmg6SIggfTBqCOmw/89TyAXdf7 OLxztWjC4zi+FkLkh7a/fHX9DjcmQPaLg4yPRxo73NdxAViLDtlWa/EtDxoS31AL5Bw9 4qABWLI+TP4UgokPwWeHZ0+G9t58Icz7UiahGMLipqnjNWY+8KRksE3/pINtzLTPvl1A kUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=x9ykwPTTWBnv2bxIb4p4QAGUx2QGblwqctC/aUIMHQA=; b=quley9Zp6hm9SfvQkMHTRj2/0Nj9pRWmliA2qx4M1XeME6ZwnNJMxJbxOoPS4xYBqy QHcbHQqNldGDQm36epAm4y9ERvSY3FU/3l5OhXxke+cUJIZrTNq+eJSVhYdQHHAdQJ2L M/y1+RFKLqN2ItR5sPBx85GNEV83mRxbMiXuIhIqpnIysb4awewm40eolhO6u2RI9W52 VnNDE/NjVW7KcX+y+hrMh/m+qRNszl+WwgTO8Gbc4xA3fDEylNXpoKNbK29m1KaTBinn efJskYK5pQBMq+RszWuoFoqwpFe8yXqafhhrH5MJmB2OzcHWanjwRO1OQa9csBLc7hs9 Scsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JHbo8Bm9; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id v66-v6si54370912pfv.48.2018.06.07.11.31.44; Thu, 07 Jun 2018 11:31:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JHbo8Bm9; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from layers.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id AE9F978658; Thu, 7 Jun 2018 18:31:40 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by mail.openembedded.org (Postfix) with ESMTP id AB49E75485 for ; Thu, 7 Jun 2018 18:31:38 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id r11-v6so5323161pfl.6 for ; Thu, 07 Jun 2018 11:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=biYeXcyo4syORNhXm60JLcJqoAHfhZn8g7nSp9GMbYw=; b=JHbo8Bm96EXAgdYr1QFq3sdTWyuYpJxAqsM3UkFyFaTufHWro001x4KLCghX5WAlma aa7v3+uT1HXTmUY3bsgK7EHx/K/wz4VP3MTaUuQ+oz+e+fOn6ZVEf2QnYHYvo8WOFF1c iaseIbL/FPXDM1nVSK/ON3uUiT66P91cO82xM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=biYeXcyo4syORNhXm60JLcJqoAHfhZn8g7nSp9GMbYw=; b=SVQu9d++8MclZSY9AoLQVq6AqTI1S69v81Y6C2EatyVJRf1YipZRiBBZ+j1NuyhWRo KU6ZBeLfVzZLEdGHCj33ptu5VL2mAQsT4QZxXnH2j14qFBGVGyE20GlsVDKhXts08yIB l5mnlfuB6iBJEVovsXPEE1dJ5RUVpdofe/nsnqGMTWRFZNhhjON1NQFeeQEPFqx7J1tX m/zCtEzEu5MAPLOu5R9rhzJfwbTCEy19wsf21WLN511rv7O1OhiyYroe5USFn0oD3hLK x/hBCS0m0p7FcvLvIVZYoFX8mix6yMcfL6nAfwcpwt3JOEypqFiAcBt2pGR70BDG+6Qt qbjg== X-Gm-Message-State: APt69E0QJ22COwjAtRPPpurAtSVzqzIfJLI+K40S8Um4LMq12Kq10uhr 7UJs/guLYi/SepnPA0+t5SJKTpfoptY= X-Received: by 2002:a65:4d47:: with SMTP id j7-v6mr2451621pgt.19.1528396299071; Thu, 07 Jun 2018 11:31:39 -0700 (PDT) Received: from localhost.localdomain ([183.82.210.238]) by smtp.gmail.com with ESMTPSA id l8-v6sm32168024pfb.102.2018.06.07.11.31.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jun 2018 11:31:37 -0700 (PDT) From: Naresh Kamboju To: openembedded-core@lists.openembedded.org Date: Fri, 8 Jun 2018 00:01:33 +0530 Message-Id: <1528396293-24735-1-git-send-email-naresh.kamboju@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [OE-core] [PATCH] ltp: fix cve-2017-5669 X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Adding cve-2017-5669 test fix patch which is accepted upstream in LTP repo. Ref: cve-2017-5669: shmat() for 0 (or --- ...69-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch | 96 ++++++++++++++++++++++ meta/recipes-extended/ltp/ltp_20180515.bb | 1 + 2 files changed, 97 insertions(+) create mode 100644 meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch -- 2.7.4 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch b/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch new file mode 100644 index 0000000..38ccee8 --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch @@ -0,0 +1,96 @@ +From b767b73ef027ba8d35f297c7d3659265ac80425b Mon Sep 17 00:00:00 2001 +From: Rafael David Tinoco +Date: Wed, 30 May 2018 09:14:34 -0300 +Subject: [PATCH] cve-2017-5669: shmat() for 0 (or +Date: Fri May 25 14:47:30 2018 -0700 + + ipc/shm: fix shmat() nil address after round-down when remapping + +commit a73ab244f0da +Author: Davidlohr Bueso +Date: Fri May 25 14:47:27 2018 -0700 + + Revert "ipc/shm: Fix shmat mmap nil-page protection" + +For previously test, and now broken, made based on: + +commit 95e91b831f87 +Author: Davidlohr Bueso +Date: Mon Feb 27 14:28:24 2017 -0800 + + ipc/shm: Fix shmat mmap nil-page protection + +Signed-off-by: Rafael David Tinoco +Tested-by: Naresh Kamboju +Reviewed-by: Jan Stancek + +Upstream-Status: Accepted [https://github.com/linux-test-project/ltp/pull/324] +CVE: cve-2017-5669 +--- + testcases/cve/cve-2017-5669.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/testcases/cve/cve-2017-5669.c b/testcases/cve/cve-2017-5669.c +index 1ca5983..0834626 100644 +--- a/testcases/cve/cve-2017-5669.c ++++ b/testcases/cve/cve-2017-5669.c +@@ -28,7 +28,20 @@ + * is just to see if we get an access error or some other unexpected behaviour. + * + * See commit 95e91b831f (ipc/shm: Fix shmat mmap nil-page protection) ++ * ++ * The commit above disallowed SHM_RND maps to zero (and rounded) entirely and ++ * that broke userland for cases like Xorg. New behavior disallows REMAPs to ++ * lower addresses (0<=PAGESIZE). ++ * ++ * See commit a73ab244f0da (Revert "ipc/shm: Fix shmat mmap nil-page protect...) ++ * See commit 8f89c007b6de (ipc/shm: fix shmat() nil address after round-dow...) ++ * See https://github.com/linux-test-project/ltp/issues/319 ++ * ++ * This test needs root permissions or else security_mmap_addr(), from ++ * get_unmapped_area(), will cause permission errors when trying to mmap lower ++ * addresses. + */ ++ + #include + #include + #include +@@ -60,7 +73,11 @@ static void cleanup(void) + static void run(void) + { + tst_res(TINFO, "Attempting to attach shared memory to null page"); +- shm_addr = shmat(shm_id, ((void *)1), SHM_RND); ++ /* ++ * shmat() for 0 (or < PAGESIZE with RND flag) has to fail with REMAPs ++ * https://github.com/linux-test-project/ltp/issues/319 ++ */ ++ shm_addr = shmat(shm_id, ((void *)1), SHM_RND | SHM_REMAP); + if (shm_addr == (void *)-1) { + shm_addr = NULL; + if (errno == EINVAL) { +@@ -89,6 +106,7 @@ static void run(void) + } + + static struct tst_test test = { ++ .needs_root = 1, + .setup = setup, + .cleanup = cleanup, + .test_all = run, +-- +2.7.4 + diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb index b07c1b9..48739f1 100644 --- a/meta/recipes-extended/ltp/ltp_20180515.bb +++ b/meta/recipes-extended/ltp/ltp_20180515.bb @@ -41,6 +41,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \ file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \ file://0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch \ file://0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch \ + file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \ " S = "${WORKDIR}/git"