From patchwork Tue May 19 00:52:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11556621 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5782D739 for ; Tue, 19 May 2020 00:54:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F91320578 for ; Tue, 19 May 2020 00:54:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="WbWtUo4R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726374AbgESAyY (ORCPT ); Mon, 18 May 2020 20:54:24 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50510 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727012AbgESAyX (ORCPT ); Mon, 18 May 2020 20:54:23 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04J0pM2k008190; Tue, 19 May 2020 00:54:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=QAN6/rXCWhE+0I0saiof7BklL1bDqN23aFRnAlTx/Gk=; b=WbWtUo4R5eLUUvFVTWmUmJnnK+RMjW5w9acSSaW6u5p3sZXeUGfftcRswmUm5tMIovM1 ar0IpMvZyr/JPTxijPWia/Wvn82+u8AQIeufp20uA524aCP9IxC4/i9okBTkyaHr4bDb GfnSBG20wS+pRRRnL6UxVC4MKSpWcKX9uLZt29Au8cQCjYQQvxTYR3aQ2MATEkJ8TDAA NBx1D1SmUEVUB7Qh8N2wvxBBAuqtN0WuKbEDykCOMK+dN5M36VhCHEft0bre+t8qpCWx 8KoM3mgShfYi4h3lirqaEiDxvdHB3cQBOZP3gwM4kjrB8DuJTHTR7mWPvCZqkPNUOVR9 hQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 3128tna33c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 May 2020 00:54:21 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04J0gvPA045850; Tue, 19 May 2020 00:52:21 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 312t32k57e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 May 2020 00:52:21 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 04J0qJvt015663; Tue, 19 May 2020 00:52:20 GMT Received: from localhost (/10.159.132.30) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 18 May 2020 17:52:19 -0700 Subject: [PATCH 1/3] xfs_db: don't crash if el_gets returns null From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 18 May 2020 17:52:17 -0700 Message-ID: <158984953767.623441.453227281468842512.stgit@magnolia> In-Reply-To: <158984953155.623441.15225705949586714685.stgit@magnolia> References: <158984953155.623441.15225705949586714685.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9625 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 malwarescore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005190005 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9625 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 bulkscore=0 spamscore=0 clxscore=1015 cotscore=-2147483648 suspectscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005190006 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong el_gets returns NULL if it fails to read any characters (due to EOF or errors occurred). strdup will crash if it is fed a NULL string, so check the return value to avoid segfaulting. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- db/input.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/db/input.c b/db/input.c index 553025bc..448e84b0 100644 --- a/db/input.c +++ b/db/input.c @@ -230,14 +230,21 @@ fetchline(void) } if (inputstacksize == 1) { - line = xstrdup(el_gets(el, &count)); - if (line) { - if (count > 0) - line[count-1] = '\0'; - if (*line) { - history(hist, &hevent, H_ENTER, line); - logprintf("%s", line); - } + const char *cmd; + + cmd = el_gets(el, &count); + if (!cmd) + return NULL; + + line = xstrdup(cmd); + if (!line) + return NULL; + + if (count > 0) + line[count-1] = '\0'; + if (*line) { + history(hist, &hevent, H_ENTER, line); + logprintf("%s", line); } } else { line = fetchline_internal(); From patchwork Tue May 19 00:52:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11556617 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42815739 for ; Tue, 19 May 2020 00:52:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A6BB2075F for ; Tue, 19 May 2020 00:52:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="WHGArEZq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726573AbgESAwb (ORCPT ); Mon, 18 May 2020 20:52:31 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60736 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726374AbgESAwa (ORCPT ); Mon, 18 May 2020 20:52:30 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04J0l3ic144873; Tue, 19 May 2020 00:52:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=QLZ+5BIOrivyTEWNJEHDfDPxqgV+I3kUiRR6MOj6GWQ=; b=WHGArEZqWrTPSNdTCwx2HSx/RQSU15s2d9jLDt4aUtZwZ3HB/sIVNB0sm4XXo8jLKp4M dDEpDD15oLmh1PntC+6ACWvgsX8ayoJmptFznAPoZv7nZ81QWl/YEo0alPxQTFKrVDvp oN+29HDCTF34KY4o7XkHOjQN+q92Nzry1r4SO3gOvfc4IyyGgYlFNdhz+hbrf8lHf4k3 GGaXYF9IUPLcFUPeNtuZIf2UtOTq6TZVPdQ3wba0C3beNMkoad1I965AD90GGu3OIi0Y n5fJ0XZy0b2RiYsssIZwqH7k7u4xbdeobEoCZ8D5C5MrjbLi6jb7BXTnWzHA9gF/aHMl Ww== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 3127kr2707-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 May 2020 00:52:28 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04J0gv0G045911; Tue, 19 May 2020 00:52:28 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 312t32k5ea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 May 2020 00:52:28 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 04J0qQUA002487; Tue, 19 May 2020 00:52:27 GMT Received: from localhost (/10.159.132.30) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 18 May 2020 17:52:26 -0700 Subject: [PATCH 2/3] xfs_db: fix rdbmap_boundscheck From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 18 May 2020 17:52:23 -0700 Message-ID: <158984954380.623441.11000410439582315428.stgit@magnolia> In-Reply-To: <158984953155.623441.15225705949586714685.stgit@magnolia> References: <158984953155.623441.15225705949586714685.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9625 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 malwarescore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005190005 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9625 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 impostorscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 cotscore=-2147483648 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005190005 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong This predicate should check the a rt block number against number of rtblocks, not the number of AG blocks. Ooops. Fixes: 7161cd21b3ed ("xfs_db: bounds-check access to the dbmap array") Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- db/check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/check.c b/db/check.c index c6fce605..12c03b6d 100644 --- a/db/check.c +++ b/db/check.c @@ -1490,7 +1490,7 @@ static inline bool rdbmap_boundscheck( xfs_rfsblock_t bno) { - return bno < mp->m_sb.sb_agblocks; + return bno < mp->m_sb.sb_rblocks; } static void From patchwork Tue May 19 00:52:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11556619 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38E91618 for ; Tue, 19 May 2020 00:52:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2066A2075F for ; Tue, 19 May 2020 00:52:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="W+kipASU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726696AbgESAwh (ORCPT ); Mon, 18 May 2020 20:52:37 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60800 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726374AbgESAwh (ORCPT ); Mon, 18 May 2020 20:52:37 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04J0lAVL144908; Tue, 19 May 2020 00:52:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=RFuQHU7NFQ7RAaIVDiIXLXZcrs2D0wqhuySliKsgMdw=; b=W+kipASUtB77iqdqR70EmViZa/Khmr7WgArEAhjXVFznqbAvdbqhNW+RcS5Qop5A6xhx AvUSqe1oaB1v2k7RqgjONUE0cdYgi//X3Ldn8D5c2/TQG1BoJIwcId8J1pS9+6gPpJhH uYkcP56m7Kru6ukB0tyFqI3DJButWDv1bjDUTuR+dKjneGvwDdqzYhvzNLGO5tXW7tdd Ca1PctGS4s/+ONTbSW76MQ1GrIPv+x7dw3u9yuuqw1WMz/c3S9exNkcsHG7k58wFCoeN GoeMtyjUov8buxj9nPmIK0QWHrkKJbFZJOnh9v339sitpSP1u7zAjKR9Olxwhh4RZB+Y tg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 3127kr270c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 May 2020 00:52:35 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04J0qVqG085167; Tue, 19 May 2020 00:52:34 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 313gj0tbud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 May 2020 00:52:34 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 04J0qXOs002499; Tue, 19 May 2020 00:52:33 GMT Received: from localhost (/10.159.132.30) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 18 May 2020 17:52:33 -0700 Subject: [PATCH 3/3] debian: replace libreadline with libedit From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 18 May 2020 17:52:30 -0700 Message-ID: <158984955088.623441.1505969186471077833.stgit@magnolia> In-Reply-To: <158984953155.623441.15225705949586714685.stgit@magnolia> References: <158984953155.623441.15225705949586714685.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9625 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005190006 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9625 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 impostorscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 cotscore=-2147483648 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005190005 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Now that upstream has dropped libreadline support entirely, switch the debian package over to libedit. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- debian/control | 2 +- debian/rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 0b3205f5..ddd17850 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: admin Priority: optional Maintainer: XFS Development Team Uploaders: Nathan Scott , Anibal Monsalve Salazar -Build-Depends: uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libreadline-gplv2-dev, libblkid-dev (>= 2.17), linux-libc-dev, libdevmapper-dev, libattr1-dev, libicu-dev, dh-python, pkg-config +Build-Depends: uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libedit-dev, libblkid-dev (>= 2.17), linux-libc-dev, libdevmapper-dev, libattr1-dev, libicu-dev, dh-python, pkg-config Standards-Version: 4.0.0 Homepage: https://xfs.wiki.kernel.org/ diff --git a/debian/rules b/debian/rules index e8509fb3..7304222c 100755 --- a/debian/rules +++ b/debian/rules @@ -25,7 +25,7 @@ stdenv = @GZIP=-q; export GZIP; options = export DEBUG=-DNDEBUG DISTRIBUTION=debian \ INSTALL_USER=root INSTALL_GROUP=root \ - LOCAL_CONFIGURE_OPTIONS="--enable-readline=yes --enable-blkid=yes --disable-ubsan --disable-addrsan --disable-threadsan --enable-lto" ; + LOCAL_CONFIGURE_OPTIONS="--enable-editline=yes --enable-blkid=yes --disable-ubsan --disable-addrsan --disable-threadsan --enable-lto" ; diopts = $(options) \ export OPTIMIZER=-Os LOCAL_CONFIGURE_OPTIONS="--enable-gettext=no --disable-ubsan --disable-addrsan --disable-threadsan --enable-lto" ; checkdir = test -f debian/rules