From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 569E5C47080 for ; Thu, 7 Apr 2022 01:21:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239271AbiDGBWl (ORCPT ); Wed, 6 Apr 2022 21:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240433AbiDGBUA (ORCPT ); Wed, 6 Apr 2022 21:20:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D64D418649A; Wed, 6 Apr 2022 18:16:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 72DD561DEA; Thu, 7 Apr 2022 01:16:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE5EDC385A7; Thu, 7 Apr 2022 01:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649294178; bh=o3GpRpC76NWR3J6t4H4CjoQ2OFisugaAToagBe6t9Vg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrwMyAXt1AQLolDjKbAn+dywqofvu08PaEHX0PTbCRDGspFAYsblL9f7pUvqcB/uJ hCh9MJs/GZ3/pWxkVKpAao00XSGimaZBAeFsvKwO0hDKkFM++EtL6jOCGZjLASHlGe 7nPpT9+DyrU5X797AbM+Qp1cvqn4scOSO3BzJyCEmMrYYPGtLMVfaYfYGM24ZaFQtu Vo+ZN0UqThsI++YEvPFebdY4HIQGxXEYXtXLzwJvCYXXX9htlln1dl9oIRaFJ6cMIN aroVnVogzt4hlHAY+VPG3yC2I2LMjHtJVBv8tph1PZcXnwSUdqVw8/oyUqcdujc7iD 87gZsKb5mEbVQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Glenn Washburn , Richard Weinberger , Sasha Levin , anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net, linux-um@lists.infradead.org Subject: [PATCH AUTOSEL 4.19 03/11] um: port_user: Improve error handling when port-helper is not found Date: Wed, 6 Apr 2022 21:16:00 -0400 Message-Id: <20220407011609.115258-3-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011609.115258-1-sashal@kernel.org> References: <20220407011609.115258-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Glenn Washburn [ Upstream commit 3cb5a7f167c620a8b0e38b0446df2e024d2243dc ] Check if port-helper exists and is executable. If not, write an error message to the kernel log with information to help the user diagnose the issue and exit with an error. If UML_PORT_HELPER was not set, write a message suggesting that the user set it. This makes it easier to understand why telneting to the UML instance is failing and what can be done to fix it. Signed-off-by: Glenn Washburn Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/um/drivers/port_user.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index 5f56d11b886f..f66dc4efc64e 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -175,6 +176,17 @@ int port_connection(int fd, int *socket, int *pid_out) if (new < 0) return -errno; + err = os_access(argv[2], X_OK); + if (err < 0) { + printk(UM_KERN_ERR "port_connection : error accessing port-helper " + "executable at %s: %s\n", argv[2], strerror(-err)); + if (env == NULL) + printk(UM_KERN_ERR "Set UML_PORT_HELPER environment " + "variable to path to uml-utilities port-helper " + "binary\n"); + goto out_close; + } + err = os_pipe(socket, 0, 0); if (err < 0) goto out_close; -- 2.35.1