Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2509475imm; Mon, 24 Sep 2018 05:40:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV63qYGCm0JAGpsNYTWgnqA3Rv4B+4LeCLYfOP/Y4BGh3ShCtd6GcceY3fss8EMcw/MfE2Eak X-Received: by 2002:a17:902:784a:: with SMTP id e10-v6mr10523575pln.197.1537792836236; Mon, 24 Sep 2018 05:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792836; cv=none; d=google.com; s=arc-20160816; b=LHBE1treM4r5prDzoT1D/L+G7Gd0OblWH4vbQ2CeHXlc/0+M8uZf4OS0lacM2c6AzT JXtkY4JaAg7b5rZMeOzqytRmx/f52qtZrhiSV0Jabo4+gphWPdUdSheqZLC4sANUL/Nw qHLebytbzdN/CZG+cBkjmzeR4498PiGGNJ1dDv/0UKezlo30swvbp+7Kxx1AuWro4mEn kY5A4sqdH4xawf5/GbAscg2OtkLAtc4guXCmWqn391SISGDCXDoy/2ZsiI2NmeU6O0jI Hxnf2NTu7Yvqh11AZcorZ+0PCjzxwiKy2mfJRCLxB+qDS/+mUWi9OJloqlQKOHHCxbNj OgVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=D2Dlb87Unp6SWtBPJUsOKAFDjSTaad5jWsABKWAwjG0=; b=dYjU1lAXLybP167WRbxhI4mbcCTx0UK8Sg5dnJP3+LNKKs83ETT2UBb3+n0G7CY36E QnIUm6JJZWR7xqR6r+0f391m+FZMhr3Y8dOSldlLCjy7LdegqyKZ4Ce/m55ZubAk3Jge bEkeZuTAuJIxPZGAb81LAH/tpKQ+l4OXFQ1h8HX177JbBP5figpaTzV0ZTJ9jYdbC9RB J8u2OVaVgFq8ZMSd31cfZvDG7xFzC2/7WdW5ye2/MNV8AoCjLav8wDdewHMLG8Xf5kSC uk6nWRjR+fHdx7/nLpnY4kZhuM6T9UEvQt46z3XO4L/RvsI/RuJisCyKUoal95VIeQnt tpXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t29-v6si8115008pgn.442.2018.09.24.05.40.20; Mon, 24 Sep 2018 05:40:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388479AbeIXSlV (ORCPT + 99 others); Mon, 24 Sep 2018 14:41:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58840 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732534AbeIXSlV (ORCPT ); Mon, 24 Sep 2018 14:41:21 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4F3101092; Mon, 24 Sep 2018 12:39:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Paul Burton , Alexander Viro , James Hogan , Ralf Baechle , linux-fsdevel@vger.kernel.org, linux-mips@linux-mips.org, Sasha Levin Subject: [PATCH 4.18 146/235] binfmt_elf: Respect error return from `regset->active Date: Mon, 24 Sep 2018 13:52:12 +0200 Message-Id: <20180924113120.136586856@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Maciej W. Rozycki" [ Upstream commit 2f819db565e82e5f73cd42b39925098986693378 ] The regset API documented in defines -ENODEV as the result of the `->active' handler to be used where the feature requested is not available on the hardware found. However code handling core file note generation in `fill_thread_core_info' interpretes any non-zero result from the `->active' handler as the regset requested being active. Consequently processing continues (and hopefully gracefully fails later on) rather than being abandoned right away for the regset requested. Fix the problem then by making the code proceed only if a positive result is returned from the `->active' handler. Signed-off-by: Maciej W. Rozycki Signed-off-by: Paul Burton Fixes: 4206d3aa1978 ("elf core dump: notes user_regset") Patchwork: https://patchwork.linux-mips.org/patch/19332/ Cc: Alexander Viro Cc: James Hogan Cc: Ralf Baechle Cc: linux-fsdevel@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/binfmt_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1751,7 +1751,7 @@ static int fill_thread_core_info(struct const struct user_regset *regset = &view->regsets[i]; do_thread_regset_writeback(t->task, regset); if (regset->core_note_type && regset->get && - (!regset->active || regset->active(t->task, regset))) { + (!regset->active || regset->active(t->task, regset) > 0)) { int ret; size_t size = regset_size(t->task, regset); void *data = kmalloc(size, GFP_KERNEL);