From patchwork Fri May 2 19:15:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 29572 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 41E78203F3 for ; Fri, 2 May 2014 19:16:51 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i11sf5768962oag.8 for ; Fri, 02 May 2014 12:16:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=CppPNN/IEPMC2joS1+yZa+E0MgSVuLfu5B2TAlitUXA=; b=TmSB7xxqSFNBzx/Gq4BFU9biYFaexx6A01JoVs8AuK2QvUSiUvhEO1DyYlonXZorXx lD7e/wri8xKk96bBH6qfgmbU8ugvbnSUMzc4gx31hjSQpV0D+Gy4bqxxuziWu1HlyGGQ Q8TxaNCyGX+me/+D5mZp8ADidGWxhuEZDOBIoObAMwDsivL/px/Y3cifG39n/A3SW2dW LtmVDs+fkfE9k8n/bZXV7CmyPUBwN/EX5GnOveKwdN3zvV58j05XTnpd1WAlpet56Wbe GPwzAOD7xtmePspt6HD4Ztu78bmPLLKviB1bWzLuqgCiCGR2d8X54tC3j0HDG1phuqEH eehw== X-Gm-Message-State: ALoCoQmqYm41rABUMYfg30n/fXUMFi3TvPICPNeImIJBKsNe63GWqBS4aui46YvIM7RGYr2KRfhw X-Received: by 10.182.98.230 with SMTP id el6mr9949572obb.10.1399058210829; Fri, 02 May 2014 12:16:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.201 with SMTP id e67ls1769805qgf.94.gmail; Fri, 02 May 2014 12:16:50 -0700 (PDT) X-Received: by 10.58.90.99 with SMTP id bv3mr1007035veb.34.1399058210650; Fri, 02 May 2014 12:16:50 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id u18si1183074vew.30.2014.05.02.12.16.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 May 2014 12:16:50 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so5809265veb.33 for ; Fri, 02 May 2014 12:16:50 -0700 (PDT) X-Received: by 10.58.38.40 with SMTP id d8mr998148vek.61.1399058210591; Fri, 02 May 2014 12:16:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp125790vcb; Fri, 2 May 2014 12:16:50 -0700 (PDT) X-Received: by 10.140.30.99 with SMTP id c90mr23378212qgc.13.1399058210206; Fri, 02 May 2014 12:16:50 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p7si13014480qga.170.2014.05.02.12.16.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 02 May 2014 12:16:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:45940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIwz-0000UB-Nb for patch@linaro.org; Fri, 02 May 2014 15:16:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIw8-000815-O1 for qemu-devel@nongnu.org; Fri, 02 May 2014 15:16:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgIw4-00008d-L3 for qemu-devel@nongnu.org; Fri, 02 May 2014 15:15:56 -0400 Received: from afflict.kos.to ([92.243.29.197]:48054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIw4-0008WL-Bt for qemu-devel@nongnu.org; Fri, 02 May 2014 15:15:52 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 93204264C7; Fri, 2 May 2014 21:15:50 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 2 May 2014 22:15:36 +0300 Message-Id: X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org, Maxim Ostapenko Subject: [Qemu-devel] [PULL 01/14] linux-user: Add /proc/self/exe open forwarding X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Maxim Ostapenko QEMU already supports /proc/self/{maps,stat,auxv} so addition of /proc/self/exe is rather trivial. Fixes https://bugs.launchpad.net/qemu/+bug/1299190 Signed-off-by: Maxim Ostapenko Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 9864813..5203cc4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5225,6 +5225,11 @@ static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode) { NULL, NULL, NULL } }; + if (is_proc_myself(pathname, "exe")) { + int execfd = qemu_getauxval(AT_EXECFD); + return execfd ? execfd : get_errno(open(exec_path, flags, mode)); + } + for (fake_open = fakes; fake_open->filename; fake_open++) { if (fake_open->cmp(pathname, fake_open->filename)) { break;