From owner-freebsd-security@freebsd.org Thu Jun 4 14:23:23 2020 Return-Path: Delivered-To: freebsd-security@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC2422F4EF8 for ; Thu, 4 Jun 2020 14:23:23 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49d7L22Qmdz3g6p for ; Thu, 4 Jun 2020 14:23:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f54.google.com with SMTP id q8so6496824iow.7 for ; Thu, 04 Jun 2020 07:23:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=sPoTAJuGu4tgjdUjv/A+IX9Yu8DSReRnZBDbDoQwiNg=; b=XE8Yh4u/ZFQR9g37fbOrHoi7eveosBGvn8pmV6LBwr/kNtyH/rfokk/KpWdMvI0iJl IagYy924nNeM+C1QWdjf9iEds3X3nz9fTKVcydqDJW1S/fiajz6TW6GhvBF9dxOVJv/L LnU1v437NTFtexC6RRSsfBj2Q3Hg3ZvAzNg+H4UAupuyifPmkXrsFsg8NGR9CMZTVnlv /nwAWITAVcE7IVXopAKZ89oVM7tckY8EZHAPgXeV3+pKuOwzXMry5Lw3qZDcnyZ/U56n 4IBBgQ+TQb74Zh5WR69eS5MN+ryGjXsBF2BFpba3bGZT8s4CbkXq2BmNlI6aa0Hho806 E1Ww== X-Gm-Message-State: AOAM533DRaBISaSeiDU3fRjdWsRcb/GeWYggUhCRw0KDO5KnTztaZz33 1kYiqDctL49FYoGmDETEGSsrsOh2MBnc0PNdaRdV61oo X-Google-Smtp-Source: ABdhPJyACgbq35TCMIs5ZU11SWc6f09eum7kc+7QrQ8f+VvrO2AO1wOoFCvijkjAhtySIx9QQRLyZDYEY20rJWyVdD4= X-Received: by 2002:a05:6638:dd3:: with SMTP id m19mr4668934jaj.106.1591280600555; Thu, 04 Jun 2020 07:23:20 -0700 (PDT) MIME-Version: 1.0 From: Ed Maste Date: Thu, 4 Jun 2020 10:23:08 -0400 Message-ID: Subject: Improved PIE binary tooling To: freebsd-security@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 49d7L22Qmdz3g6p X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.54 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-0.20 / 15.00]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-security@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.15)[-0.152]; DMARC_NA(0.00)[freebsd.org]; NEURAL_SPAM_SHORT(0.07)[0.068]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.54:from]; NEURAL_HAM_MEDIUM(-0.12)[-0.120]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.54:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; TO_DOM_EQ_FROM_DOM(0.00)[] X-BeenThere: freebsd-security@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Security issues \[members-only posting\]" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jun 2020 14:23:23 -0000 Kostik and I recently committed a couple of changes to improve PIE binary support: r361725 Do not allow to load ET_DYN object with DF_1_PIE flag set. r361740 lld: Set DF_1_PIE for -pie Previously there could be ambiguity as to whether an object is a shared library (DSO) or Position Independent Executable (PIE) binary; a PIE is in fact a special type of DSO. These changes add a .dynamic flag DF_1_PIE that's used to unambiguously indicate that an object is a PIE binary, and disallow the use of dlopen() or DT_NEEDED on that binary. Future changes should have file(1) report "position independent executable" or similar instead of "shared object". Some desktop environments / file managers have had issues refusing to execute PIE binaries, and tagging them should also address those.