From patchwork Mon Oct 21 11:48:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nuDilwro"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZhV3Fjmz9sNw for ; Mon, 21 Oct 2019 22:50:32 +1100 (AEDT) Received: from localhost ([::1]:38958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWCi-0005Um-2V for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:50:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52716) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBW-0005UE-ID for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBR-00039U-PB for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:13 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:37096) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBP-000381-EN for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:09 -0400 Received: by mail-wr1-x444.google.com with SMTP id e11so4889576wrv.4 for ; Mon, 21 Oct 2019 04:49:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vNMFynTjAmTxUUIwIswr/6MOiNNDJT5kgZOoy66ko1A=; b=nuDilwroNJijyV1WSInoXJb25iNFWyRxRGMtDGhqvLqjpMAkuCjMQDHLGOTfW8BTKG XSeXLYlV3YZpHJk1vtwtQzyWEscD3yV3OWaYMAw2zfNlKwXyrpveb5ehmaYi6r4D8fWS +6wSdTZpwE/erOseZecq86W68SxW7l1ezu7CSzuwN4Ha96g7U0Ji+nRvAiSianxG7vOW q4IENIO+3Ps2mH9UdYDrNTimZ0EgGy3IBzWy8zFAgenL8Wmjm3VD13HRbT4nfCDkj9kq w48tLEbg0pAQPmPJ3063+n2jhRNS0DE9DHkffbVAtqTCwN+1jZbeoQfErFYyLWCESEGl oOgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vNMFynTjAmTxUUIwIswr/6MOiNNDJT5kgZOoy66ko1A=; b=JpcZRExNU3uMWK6l0wIuj2NYtiddvy7fJgaerMKVrMvzRY8eu2jYLE0JR3Glkn4wmP lJuoUHNCBFxeoto6wfFJmEXaqG/iXxE2t1UB66/vd2V3gsPnXLBnCRiDZ8gEziPok3FA 1DuM9wAawLntPE+kKKlkdqQfNfgfLfuW30Zozf01u71Ofau0kB4hRPyFG1GWUPA6R0Un AynCEXp77+f6EuUld7CIbCclNkMyk23rScPnSQvWNlnUcTBaukgZcQrqMiKuHMxTWjXx 3FGGNMVjfgGdZFUOob2lrRfNzlpvRL+OjzR5WLeMQeJfbLf26vV1scl4LMCqKAb6AUeX Bzlg== X-Gm-Message-State: APjAAAUaoKJUKoVTZ7lLrS3d9t0p+jHVq/ZTviIQas7lUD7IHMZBB9D9 RXJm2xON4oYPbeg+fGfYapudXVLX X-Google-Smtp-Source: APXvYqwVJ0air9VZ4mVA/BMhrx7laBNxaLO2+49JsWC8jmbYilD1ZO6xWaEVrDSnfM+m7di9g8w/Tw== X-Received: by 2002:a05:6000:149:: with SMTP id r9mr14753575wrx.90.1571658541947; Mon, 21 Oct 2019 04:49:01 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 1/9] linux-user/strace: Display invalid pointer in print_timeval() Date: Mon, 21 Oct 2019 13:48:49 +0200 Message-Id: <20191021114857.20538-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Suggested-by: Laurent Vivier Reviewed-by: Laurent Vivier Signed-off-by: Philippe Mathieu-Daudé --- linux-user/strace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index c80e93b5db..f326c357a2 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1243,8 +1243,10 @@ print_timeval(abi_ulong tv_addr, int last) struct target_timeval *tv; tv = lock_user(VERIFY_READ, tv_addr, sizeof(*tv), 1); - if (!tv) + if (!tv) { + print_pointer(tv_addr, last); return; + } gemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s", tswapal(tv->tv_sec), tswapal(tv->tv_usec), get_comma(last)); unlock_user(tv, tv_addr, 0); From patchwork Mon Oct 21 11:48:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LZRyyZdw"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZqd00cHz9sNw for ; Mon, 21 Oct 2019 22:56:44 +1100 (AEDT) Received: from localhost ([::1]:39092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWIk-0005Q4-Tv for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:56:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52727) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBX-0005UK-FV for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBV-0003AT-H9 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:15 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:37654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBR-00038H-Pg for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:12 -0400 Received: by mail-wm1-x343.google.com with SMTP id f22so12459462wmc.2 for ; Mon, 21 Oct 2019 04:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8NQh2EnS1JgP+wDg616iXQrQceQKStyvquiY+j2RVrE=; b=LZRyyZdwseS7+zVS+ewx1DMbss0zeH8x4kMndWUwewVGpkooXJdLhKtYUO+EXxG3o6 Wx9cbGv52MF20MvlFdCaGDWI/xxByiRokPQsCMw6hhL+5xphf08s1KPN4ZRO/OgZRrGo nSVVZrs6o2sXO+l62a36lESrzcIrxrf7N47ifpyPGVpYidkUxmiAAVjqLLNS2XLmJHoz IVj4uXI1puPT6yaOx0fPuroMYhrMeUvVnKwBFPUWUobJDkNt3Qux4OMYh1JrvZNPgHVX jc3TjjJydswOtjdQjm5WlPjRPxarIzq/HIxoJwf7Lm1DYIRlP3Z3ZFtz8m6M2hUWq45K 1L9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8NQh2EnS1JgP+wDg616iXQrQceQKStyvquiY+j2RVrE=; b=DwnZPdm2/2MHsSNB6lHX+tf8Vf6GHd0geiRZA/VoJn7t/z5ImB7QnqZUqruD6Bxgv7 gVfk/Z4KRudoXu6RnNtO1goOqsnVw0NIfAN8hPpFkilYC2pJwfy1XwDfqCvSaOH9C/nk Ln1WSb6fqNf9qdH4tSItVGS0lmMWOMJXsZ7SBF93mJZVRAIYP5tkQQdlqY6vuHcZEBDl 65J3gN17YEnqG5uZj0+uq3GNYKloE9u9YWM48kbLNzfMG8tMPMCk+yvMwtJIqfVKrlWQ +zH6Si6StvgYxTGd9b6g3sWTkOEHymqk/m3YDBgpM4BIA9allytMdX2kRHJO/W2a2UJG Z4QQ== X-Gm-Message-State: APjAAAXqYbUxmncVM/g9V1KK3g8aWWBfm0//oCFiJ92FRTJiqEQuC5MA N7BYq9HckZruVeDFlVF7NnejQS/3 X-Google-Smtp-Source: APXvYqx20xKnmyWBhq/jF7o50m+V4hM/+XJ98M+7wgwfjssqrnqwa7RPAwoOaPRyjKVdQySnJr9lLA== X-Received: by 2002:a7b:cb0a:: with SMTP id u10mr19518924wmj.48.1571658543471; Mon, 21 Oct 2019 04:49:03 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 2/9] linux-user/strace: Add print_timezone() Date: Mon, 21 Oct 2019 13:48:50 +0200 Message-Id: <20191021114857.20538-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Suggested-by: Laurent Vivier Reviewed-by: Laurent Vivier Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier --- v7: tz_minuteswest and tz_dsttime are abi_int -> %d/tswap32 (lvivier) checkpatch error: ERROR: storage class should be at the beginning of the declaration #9: FILE: linux-user/strace.c:66: +UNUSED static void print_timezone(abi_ulong, int); --- linux-user/strace.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/linux-user/strace.c b/linux-user/strace.c index f326c357a2..2cd6687cd9 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -63,6 +63,7 @@ UNUSED static void print_string(abi_long, int); UNUSED static void print_buf(abi_long addr, abi_long len, int last); UNUSED static void print_raw_param(const char *, abi_long, int); UNUSED static void print_timeval(abi_ulong, int); +UNUSED static void print_timezone(abi_ulong, int); UNUSED static void print_number(abi_long, int); UNUSED static void print_signal(abi_ulong, int); UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen); @@ -1254,6 +1255,25 @@ print_timeval(abi_ulong tv_addr, int last) gemu_log("NULL%s", get_comma(last)); } +static void +print_timezone(abi_ulong tz_addr, int last) +{ + if (tz_addr) { + struct target_timezone *tz; + + tz = lock_user(VERIFY_READ, tz_addr, sizeof(*tz), 1); + if (!tz) { + print_pointer(tz_addr, last); + return; + } + gemu_log("{%d,%d}%s", tswap32(tz->tz_minuteswest), + tswap32(tz->tz_dsttime), get_comma(last)); + unlock_user(tz, tz_addr, 0); + } else { + gemu_log("NULL%s", get_comma(last)); + } +} + #undef UNUSED #ifdef TARGET_NR_accept From patchwork Mon Oct 21 11:48:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZaaQZMEI"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZhm3hypz9sNw for ; Mon, 21 Oct 2019 22:50:48 +1100 (AEDT) Received: from localhost ([::1]:38978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWCz-0005mo-Sw for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:50:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52744) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBZ-0005UW-El for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBX-0003Au-E2 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:17 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:33728) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBR-00038a-Q1 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:14 -0400 Received: by mail-wm1-x342.google.com with SMTP id 6so1186856wmf.0 for ; Mon, 21 Oct 2019 04:49:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kVPn/TqsVrLsIWtsYnTYm7mIPjPA8vCaNQCpnpdWJRs=; b=ZaaQZMEIekiB+mZvzO3UPAfQ63y7KMYcpOfBE+mCuBT9eIucUiGueEjleHuz+pY+o3 OEqHcFUCrmYAXu7fhCO9qF0o42w6c+gyj/9mBvj3pwp/frvH6x6J6sjVEnx5zFSP/HEZ 86ooKHw/gIfQYYMoUwV3uBcDXDzpAgw26o42uWY47ht6LNQy7TjdFTfp/ioM+oO9wNvu I5tVZy7t2cqDQNvOqJKgRMDwiPvDacgyQKvYIskTA/zHUUsFrfxXGXOc/ohC5vmvOa7M wkyhp5SFFFuaoRFrK2Sx18HzS7qBGvmnn8uIDbHwseFraW974YJu2FaeI6vL64hO5wbd fWKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kVPn/TqsVrLsIWtsYnTYm7mIPjPA8vCaNQCpnpdWJRs=; b=GpioHnBlvnXgGuwI99CzaUZbef8zbI0ZBxsPne7EfIzrzMwVKDM3Ze42IMPmBAdvqR +mj1h0g3cjJkTyvuxKKgICsUwnyZalZhtoDJYEAP6in37xQb79t0/eqHdIpimM3EBEVc OH9C5bcK53q/j7oOITB2KLhUiSnSw92d6idVLDYTqnaThIRiLjVlKgOO0LBcKAkZp2bg DiklXBinofByQHJ5WKdFGB88F3107b8B3XBrRY2Ts8JfOwkpSS2BB25SDfHOb0lkOG9x nB7AyAhYNOZivN2CR40sHtzh45P046uXcUU3H+fHmwlMoREXEYwzMSuvb5IX2XK7x+oh z0rw== X-Gm-Message-State: APjAAAV6nkKQG4qFXNca/PkdOpPR+wHSV1jYdhugu+XFwsVRDitclEk+ vi7ktXOZINKCAubfJdQ73X7Tu02f X-Google-Smtp-Source: APXvYqzVG8jajY24keh4SgZ1BdA+Q7TLB9Q9vV203Y3HpCMvA89X8iHHiqI/Cd/iKltuVXObltLc3A== X-Received: by 2002:a1c:b6c4:: with SMTP id g187mr2974263wmf.54.1571658545489; Mon, 21 Oct 2019 04:49:05 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 3/9] linux-user/strace: Improve settimeofday() Date: Mon, 21 Oct 2019 13:48:51 +0200 Message-Id: <20191021114857.20538-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Guido_G=C3=BCnther?= , Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Tested-By: Guido Günther Reviewed-by: Laurent Vivier --- linux-user/strace.c | 13 +++++++++++++ linux-user/strace.list | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 2cd6687cd9..fd5596a640 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1583,6 +1583,19 @@ print_futimesat(const struct syscallname *name, } #endif +#ifdef TARGET_NR_settimeofday +static void +print_settimeofday(const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_timeval(arg0, 0); + print_timezone(arg1, 1); + print_syscall_epilogue(name); +} +#endif + #ifdef TARGET_NR_link static void print_link(const struct syscallname *name, diff --git a/linux-user/strace.list b/linux-user/strace.list index 63a946642d..1ff9168369 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1345,7 +1345,7 @@ { TARGET_NR_set_tid_address, "set_tid_address" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_settimeofday -{ TARGET_NR_settimeofday, "settimeofday" , NULL, NULL, NULL }, +{ TARGET_NR_settimeofday, "settimeofday" , NULL, print_settimeofday, NULL }, #endif #ifdef TARGET_NR_setuid { TARGET_NR_setuid, "setuid" , NULL, NULL, NULL }, From patchwork Mon Oct 21 11:48:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Hw5E9q12"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZlc0s1lz9sNw for ; Mon, 21 Oct 2019 22:53:16 +1100 (AEDT) Received: from localhost ([::1]:39006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWFN-00013s-P8 for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:53:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52787) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBb-0005VS-KZ for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBX-0003B1-EE for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBR-00038j-Po for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:14 -0400 Received: by mail-wr1-x442.google.com with SMTP id v9so2350152wrq.5 for ; Mon, 21 Oct 2019 04:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L1ZRC5xfl7LAc8y7XcDjWKXdgHuMKTnYncwldrjeKoE=; b=Hw5E9q123R3Tvz1vaTdDmL8+/eQKpTsEt3Qgu1/klh48i+Z9puQ/jxBxlIBNIJiJAD XLSla8eh1r0PXmCUAlSDKSB3Q649GBdIXDqIl5V7M38uGtS0Jx+dHMXIdZ7ncLHqiqvq vaze0JZa9fANNtde143lXJ6Q466W87v1gwbL66k3R0gwaXdSRDjVj8+s0XS69PsnhixP H25q1qxm7MJ91L6OvN+BxG6cRDW+v9KbHR72tKnyW8wYTi/hIcMeJ2eo45ZyC+WYByyv ckqhtNyKw9fqVBx07N8LaqBvq+zrTNUVAORn+vFyKHYuZshJgLuccqAZWqcBeDjk/Vyb Dc0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=L1ZRC5xfl7LAc8y7XcDjWKXdgHuMKTnYncwldrjeKoE=; b=Xb54AYDarHtRqRvftP6qrTBBm1T+Zq+Tw89BXfwY9WJGEdiS3P5isCj0kYyWH4guGg cx4zslK2VMgPSWG9NexOOOiPT0ZN8Ellagkz+7dwVQzjYicsFSUshJsM0CqQ0ClIx6ND g53UoZlT+/YJ63Qkmci+VbhWvxLBCnhPdLvJqoRsn2c3i8U1dPgtEBtgOo+ipXfEN/Ca B4XhCKLC+SDcGYmOSDvxqd01HoI/EyCtVQX50ksrJ3x4mDDxi0QZK6A7k1dqgAYG/Fwa acj0YBiX3OpSnngKnR1jGR2ASFUUYoa7dLnn4LmgwQhuX+96RRVj0k5jiABIG5KudZQz sHfw== X-Gm-Message-State: APjAAAVUVAD8/SDbc5GcHtBjUfUkUlSwnOLozrLvzjAcnM4HKlg2RtSI ahSvpsdrUDF6kbUk3lacSrqnwPDR X-Google-Smtp-Source: APXvYqyhC2xqhen9lmC1sFAEfA0NBjNDe8SFmARNqljeJrKlGw0ydnjwfWaWvLqNIpG74ouKi+C2zA== X-Received: by 2002:adf:91e1:: with SMTP id 88mr7747800wri.16.1571658546821; Mon, 21 Oct 2019 04:49:06 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 4/9] linux-user/syscall: Introduce target_sockaddr_nl Date: Mon, 21 Oct 2019 13:48:52 +0200 Message-Id: <20191021114857.20538-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Guido_G=C3=BCnther?= , Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Tested-By: Guido Günther Reviewed-by: Laurent Vivier Signed-off-by: Philippe Mathieu-Daudé --- v7: use abi_ushort and abi_uint to keep alignments good (lvivier) --- linux-user/syscall.c | 6 ++++-- linux-user/syscall_defs.h | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e2af3c1494..f1ab81b917 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1496,8 +1496,10 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, sizeof(target_saddr->sa_family)) { target_saddr->sa_family = tswap16(addr->sa_family); } - if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) { - struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr; + if (addr->sa_family == AF_NETLINK && + len >= sizeof(struct target_sockaddr_nl)) { + struct target_sockaddr_nl *target_nl = + (struct target_sockaddr_nl *)target_saddr; target_nl->nl_pid = tswap32(target_nl->nl_pid); target_nl->nl_groups = tswap32(target_nl->nl_groups); } else if (addr->sa_family == AF_PACKET) { diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index fa69c6ab8d..7694d72446 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -153,6 +153,13 @@ struct target_sockaddr_un { uint8_t sun_path[108]; }; +struct target_sockaddr_nl { + abi_ushort nl_family; /* AF_NETLINK */ + abi_ushort __pad; + abi_uint nl_pid; + abi_uint nl_groups; +}; + struct target_in_addr { uint32_t s_addr; /* big endian */ }; From patchwork Mon Oct 21 11:48:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CU09G/Hs"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZny4CjLz9sNw for ; Mon, 21 Oct 2019 22:55:18 +1100 (AEDT) Received: from localhost ([::1]:39054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWHL-0003mu-TZ for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:55:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52745) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBZ-0005UX-FS for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBX-0003B0-E2 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:17 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:41673) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBR-000392-Qg for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:14 -0400 Received: by mail-wr1-x444.google.com with SMTP id p4so13598282wrm.8 for ; Mon, 21 Oct 2019 04:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dMQ78h47SvHockU3ttNHy6APkGlBQkuPUPTng3logyU=; b=CU09G/Hsz+sEJQ4zDhaleaQtFCLKtZyWf2IxCk2Pd2PpNwBI/PW9odvVSXiKSmoFAl DisrriQ/tcL5Ys5WnhhrweMZl1PnUAIUqmzrgMQJmr6U7LU8N6fPLlZKbZTwSeEB0IYr bY93wmdotRZoKOBmz6Tun8TlTzMh3Y/t4gtgrnuRSZ+m7TPw6MOYmSMra7U0xFnRyi3u AezRa/iTZCSoYeT8rwRUcaZpzdpEId0QrzA5zTOCL4ByMEV2Ej43eaNO2uLkQtquABdR stvcLDNr771yn3E6gD3FDI302jyi8E3BCxdrZgua4DBDgijQy7/5ZvbpXg4hQpwTXn1Y /6AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dMQ78h47SvHockU3ttNHy6APkGlBQkuPUPTng3logyU=; b=kF+WrSOsBX39FXQFNl5NxXXvdkaX3n0stD+1x7/a7K/UNF4dCAs/a+55uAyi3yZSjJ MnNOgWt73eojNKvcvME9Rl0wS4sgM8sqqiSfyEg8C8LgSINZUmWHG6BFttqyqU6sPuTD Fhp2x/bqmT4PdHbYsxsIHcM6EMqj33iyNpMjRA9W2rQ0+PZ6YiLBkOyZyXp9Unp6jQSW Sdw347zNiRfpfSfQeI8ghdaoei4QSqd+I7bVZPNAmsqK8PgSR1g9aqYKcHu9rd/TrnNn 49JbjM11OxCn8vYQVryf1E50MzwYAfmcRDQE6tjZGYnYqLda9rcvvYVMnkiPm6LPqfWb TeSA== X-Gm-Message-State: APjAAAXXdlIumKJ2/YYVaZLiWOwjkTpNMOaX1ifWpYT6aOxrap3vIoxM +3y6GOPAc8/MClR67rfpJXLB331c X-Google-Smtp-Source: APXvYqyOd0DZ4TR3zHbiiTzi2IM9Yd6tWSY7M8I5q95YpamU4jVWm6UZsvz6ADUFWOjShSrAHGOXAA== X-Received: by 2002:a05:6000:149:: with SMTP id r9mr14753989wrx.90.1571658548392; Mon, 21 Oct 2019 04:49:08 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:07 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 5/9] linux-user/strace: Dump AF_NETLINK sockaddr content Date: Mon, 21 Oct 2019 13:48:53 +0200 Message-Id: <20191021114857.20538-6-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Guido_G=C3=BCnther?= , Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Tested-By: Guido Günther Reviewed-by: Laurent Vivier --- v8: use tswap32 (lvivier) --- linux-user/strace.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/linux-user/strace.c b/linux-user/strace.c index fd5596a640..5fa7748427 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "qemu.h" @@ -398,6 +399,12 @@ print_sockaddr(abi_ulong addr, abi_long addrlen) gemu_log("}"); break; } + case AF_NETLINK: { + struct target_sockaddr_nl *nl = (struct target_sockaddr_nl *)sa; + gemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}", + tswap32(nl->nl_pid), tswap32(nl->nl_groups)); + break; + } default: gemu_log("{sa_family=%d, sa_data={", sa->sa_family); for (i = 0; i < 13; i++) { @@ -424,6 +431,9 @@ print_socket_domain(int domain) case PF_INET: gemu_log("PF_INET"); break; + case PF_NETLINK: + gemu_log("PF_NETLINK"); + break; case PF_PACKET: gemu_log("PF_PACKET"); break; @@ -473,6 +483,33 @@ print_socket_protocol(int domain, int type, int protocol) return; } + if (domain == PF_NETLINK) { + switch (protocol) { + case NETLINK_ROUTE: + gemu_log("NETLINK_ROUTE"); + break; + case NETLINK_AUDIT: + gemu_log("NETLINK_AUDIT"); + break; + case NETLINK_NETFILTER: + gemu_log("NETLINK_NETFILTER"); + break; + case NETLINK_KOBJECT_UEVENT: + gemu_log("NETLINK_KOBJECT_UEVENT"); + break; + case NETLINK_RDMA: + gemu_log("NETLINK_RDMA"); + break; + case NETLINK_CRYPTO: + gemu_log("NETLINK_CRYPTO"); + break; + default: + gemu_log("%d", protocol); + break; + } + return; + } + switch (protocol) { case IPPROTO_IP: gemu_log("IPPROTO_IP"); From patchwork Mon Oct 21 11:48:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180534 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SwEWUgt4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZs35TtQz9sNw for ; Mon, 21 Oct 2019 22:57:59 +1100 (AEDT) Received: from localhost ([::1]:39106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWJx-0006Sm-GV for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:57:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52788) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBb-0005VV-Kv for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBX-0003BD-F9 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:34577) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBW-00039m-Hi for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:15 -0400 Received: by mail-wr1-x441.google.com with SMTP id t16so8471319wrr.1 for ; Mon, 21 Oct 2019 04:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2SbHTSN9heUjHZHZr60mvvzx0DMavYLdULN0Nc21EaA=; b=SwEWUgt4cjSVAgyd/Slb9Q/7XdBThBAZUJfMlFg3HtV+A3anxFf6y3+pWYdeUVNqZy aBrRq1WlgozbG0bNV2GBPedKUMR8PSW5JsZK0UWAmbV2I/0L7di4TrZjbh1gOFNGfCPZ hF1NQpXUgrMPQHFCzkZV0CWAVwAcktOkAwUGK7+FtPB7JKFnJtXcYGK0Z0+9yCYewdnr f5CT+geenw8mbXctqD8qIrwnJhxFTPGqT8lnZiZvtxLD8TsZa6amh2Exsn6ojtIgEunU XHuxc2C74593g3dTdxHJ7jq0hgDOFpr9S0fR8KEPwtsR2G2AXsiAYCOiv2BwqlhYUi17 KwoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2SbHTSN9heUjHZHZr60mvvzx0DMavYLdULN0Nc21EaA=; b=Xr/MerggoXjA33McDWveVxjCG3kKQ49DzBBdWAnU2PPxVF2ew5R5ky0DAbwGV/ptGE lOLdrQ5kiyhzkpFUx5skym4/RgsOOA3YkIa6X7lQE71ACUb1MS9vw0w0X8kmCSrEUUXc AGnpEIW67ZuSFR+F4RVmnbbFlJuZEUQEq3i0RTJ6UA8m577GVLqFLb0H9qxYsr5gve0i gBSrJy6g9zCA1f7cDs/gWSC9uC7IN2cAZF8UMNxs/71+BjcqhUUVhP/q+pBnsmuUIVwt VdZHskFa7LR9g4UNOqBXcoohHqdkDerwuK4vAGRN7WrcAoTz87T5JeSHadLYymD7F6MQ qp2g== X-Gm-Message-State: APjAAAVNfFilxKjCFisZPexrdEo57dWV1E7BTeXG282uEJcQSxCajM71 ZfDcja2U+jo3z8Rmm5a9hRTlH7Ai X-Google-Smtp-Source: APXvYqxLrWSAVOP3pSpEsoOOzcX6QOi9oISCevAkDQPhs5fesW+Kc0O27HltHPdicW5rJGCfgogDpA== X-Received: by 2002:a5d:4b8b:: with SMTP id b11mr5069585wrt.78.1571658550029; Mon, 21 Oct 2019 04:49:10 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 6/9] linux-user/strace: Add print_sockfd() Date: Mon, 21 Oct 2019 13:48:54 +0200 Message-Id: <20191021114857.20538-7-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Extract common print_sockfd() from various socket related syscalls. Reviewed-by: Laurent Vivier Signed-off-by: Philippe Mathieu-Daudé --- v6: use another ifdef TARGET_NR_socketcall --- linux-user/strace.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 5fa7748427..0ce2b658a5 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1709,6 +1709,15 @@ print_socket(const struct syscallname *name, #if defined(TARGET_NR_socketcall) +static void print_sockfd(abi_long sockfd, int last) +{ + print_raw_param(TARGET_ABI_FMT_ld, sockfd, last); +} + +#endif + +#if defined(TARGET_NR_socketcall) + #define get_user_ualx(x, gaddr, idx) \ get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long)) @@ -1741,7 +1750,7 @@ static void do_print_sockaddr(const char *name, abi_long arg1) get_user_ualx(addrlen, arg1, 2); gemu_log("%s(", name); - print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0); + print_sockfd(sockfd, 0); print_sockaddr(addr, addrlen); gemu_log(")"); } @@ -1754,7 +1763,7 @@ static void do_print_listen(const char *name, abi_long arg1) get_user_ualx(backlog, arg1, 1); gemu_log("%s(", name); - print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0); + print_sockfd(sockfd, 0); print_raw_param(TARGET_ABI_FMT_ld, backlog, 1); gemu_log(")"); } @@ -1789,7 +1798,7 @@ static void do_print_sendrecv(const char *name, abi_long arg1) get_user_ualx(flags, arg1, 3); gemu_log("%s(", name); - print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0); + print_sockfd(sockfd, 0); print_buf(msg, len, 0); print_raw_param(TARGET_ABI_FMT_ld, len, 0); print_flags(msg_flags, flags, 1); @@ -1808,7 +1817,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1) get_user_ualx(addrlen, arg1, 5); gemu_log("%s(", name); - print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0); + print_sockfd(sockfd, 0); print_buf(msg, len, 0); print_raw_param(TARGET_ABI_FMT_ld, len, 0); print_flags(msg_flags, flags, 0); @@ -1824,7 +1833,7 @@ static void do_print_shutdown(const char *name, abi_long arg1) get_user_ualx(how, arg1, 1); gemu_log("shutdown("); - print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0); + print_sockfd(sockfd, 0); switch (how) { case SHUT_RD: gemu_log("SHUT_RD"); @@ -1851,7 +1860,7 @@ static void do_print_msg(const char *name, abi_long arg1) get_user_ualx(flags, arg1, 2); gemu_log("%s(", name); - print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0); + print_sockfd(sockfd, 0); print_pointer(msg, 0); print_flags(msg_flags, flags, 1); gemu_log(")"); @@ -1868,7 +1877,7 @@ static void do_print_sockopt(const char *name, abi_long arg1) get_user_ualx(optlen, arg1, 4); gemu_log("%s(", name); - print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0); + print_sockfd(sockfd, 0); switch (level) { case SOL_TCP: gemu_log("SOL_TCP,"); From patchwork Mon Oct 21 11:48:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180528 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dk8w9heP"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZlS2XbVz9sNw for ; Mon, 21 Oct 2019 22:53:08 +1100 (AEDT) Received: from localhost ([::1]:39000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWFF-0000nW-8a for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:53:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52793) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBb-0005Vf-O7 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBZ-0003Bx-F9 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:43419) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBY-0003AH-H8 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:17 -0400 Received: by mail-wr1-x441.google.com with SMTP id c2so8366713wrr.10 for ; Mon, 21 Oct 2019 04:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7PzhWDBr2TcCErcmKtgx3wheeZHdViTC2eISH3wD2UY=; b=dk8w9hePxNkOKwNpLUhu6Towyzx2uLJfblQUVXUARx7NMmTDwkm++HEiRpPdDRzRJI nN3mErDQsO+gYGhWXJ3bkNJf5L+a5HaAWI9BIPcR6tBecuBxm5kcc4XYWKGZhzgxW57M SLL2ohdfoZK8NIC6drmN2jEYv1IK91AxP57Oj1Kt6NZLxe4wFa5v621oyisalKwaXO4A +HVj1f94ydYTS6H/+YLmhAidxB7u1I41TqR8azBS2j0WuKVB8o/lGF9WY4IUT6IeMmZ3 YJ8uv9lpde+Wd7V7950dRrUneOwRdrflN4ttFQTB9+csF/kzV4NpjxYw5z3a/w5lP8NZ KMmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7PzhWDBr2TcCErcmKtgx3wheeZHdViTC2eISH3wD2UY=; b=QWir43sCpKP80SHOYfA3YWWWvGF7E6W86ZcDyZo4OrUUxljNbbcg1malgbZe3DQBR3 KUAe5Daaq3qj7L+/KsNomoE7NAInDd4X+WwwR37TgJgD43KIdmkcR+ycXeca0h1/wQ6h g2hqsa3f9fX93hb8GcDLSC5daAxuF1xGpTRY0YgN+MjQxd8sa2L1fqp3FqPqWExyP6// o1kaZo+RMFy9huLh/sRZg/AAL1tLg9LQz1luRHJZ8lgJFgd9UVULEQKL9Kj8RiQgdEV4 9QRvs77lONzwX/mP5giNaVIwtKsS8p82JiwUMvnBIXmFH+o8COhL6wcucHA8Hy5m13nT cWSQ== X-Gm-Message-State: APjAAAXYCAlgBy76+20bGWPwlfUrR4iMo9HqWMEtBZ49s/MfxDAlWaDc uDyaEhFxGIZgLJxVkE8Ag5wWlN/m X-Google-Smtp-Source: APXvYqziiHIr8QyYjiYEWS+bR7m1eROI0BOYgDA0cPB70Ywo+HVr8tgMhlvdLGNpJ4z4VvtSARw/Zg== X-Received: by 2002:adf:91e1:: with SMTP id 88mr7748134wri.16.1571658551794; Mon, 21 Oct 2019 04:49:11 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:10 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 7/9] linux-user/strace: Improve bind() output Date: Mon, 21 Oct 2019 13:48:55 +0200 Message-Id: <20191021114857.20538-8-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Guido_G=C3=BCnther?= , Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Tested-By: Guido Günther Reviewed-by: Laurent Vivier Signed-off-by: Philippe Mathieu-Daudé --- v6: use TARGET_NR_socketcall || TARGET_NR_bind (lvivier) --- linux-user/strace.c | 15 ++++++++++++++- linux-user/strace.list | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 0ce2b658a5..cd92c77d33 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1707,7 +1707,7 @@ print_socket(const struct syscallname *name, #endif -#if defined(TARGET_NR_socketcall) +#if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind) static void print_sockfd(abi_long sockfd, int last) { @@ -2054,6 +2054,19 @@ print_socketcall(const struct syscallname *name, } #endif +#if defined(TARGET_NR_bind) +static void +print_bind(const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_sockfd(arg0, 0); + print_sockaddr(arg1, arg2, 1); + print_syscall_epilogue(name); +} +#endif + #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \ defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) static void diff --git a/linux-user/strace.list b/linux-user/strace.list index 1ff9168369..957aa720af 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -41,7 +41,7 @@ { TARGET_NR_bdflush, "bdflush" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_bind -{ TARGET_NR_bind, "bind" , NULL, NULL, NULL }, +{ TARGET_NR_bind, "bind" , NULL, print_bind, NULL }, #endif #ifdef TARGET_NR_bpf { TARGET_NR_bpf, "bpf" , NULL, NULL, NULL }, From patchwork Mon Oct 21 11:48:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WXlnwYB5"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZjk5s90z9sP3 for ; Mon, 21 Oct 2019 22:51:38 +1100 (AEDT) Received: from localhost ([::1]:38984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWDo-0006t3-FP for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:51:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52786) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBb-0005VR-Kh for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBZ-0003Bv-F6 for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:34580) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBY-0003Ac-Fk for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:17 -0400 Received: by mail-wr1-x443.google.com with SMTP id t16so8471560wrr.1 for ; Mon, 21 Oct 2019 04:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DHS2SKkFIjzeTftKW046CihOKHK4sJ21ouhmUQVVWVk=; b=WXlnwYB5TO5sc5oj7MWKLEmf9dMi9e/Pa+hDs/EOgCXlfMCJtLrMO4R0gexqV+E6Vu xir/fHW6ERSIja+E6Kh0bHQz4UBS4JY5k5T15OCqP5+ok7LiRFR2wccUoDP5mLQyRjJW vao5mjh29l0aE2aAf8kmQGKpXISGvu2knqcuBIjRpQZVS2tyI+fRxJ701BVsi1pmgojh TOiYE0lj2B0jBLMuFFGmEO6PZQ8Eba5QLbl+qBo3uyC6/DEH+2EI+HC3fsha999rF4lU LWlz6++gNnbxPHI5MBzoF4zSOObkrD8Avk05TsyVmkj2yRBb8DhHGqLwM647/O8WkugU QIKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DHS2SKkFIjzeTftKW046CihOKHK4sJ21ouhmUQVVWVk=; b=jMhY05pRW4z4l/rTGgCVDEdZXLSL0KphyWBwTqix+9jlU5CvFF1fqGhv94V+a/S4M9 lRH15QgZ3A3+Um069XdYWri1dkSfcUf7pl15qUdpnM3leT+roRhQCUveeDtga+0+Y4lV ZS/RpDD4DZybCY0j6P1/1+ov+SjP9boM6nLf2Lt7D5SKhx1OFBRJKRqeD16gNLF/q8G9 rQxvA+A6CKvKT7CUy3HNSlkfx5cHswV2PJRa5qegg4WoukTUBfxWfoIPw1dLG75B/Fds 2aROyZzx/jTMAptS72ReehUKgr0EaIvjwJx/VWgogp8dKerrbuj6O1jYUj3Tj/ieKP0V dhSw== X-Gm-Message-State: APjAAAUQZs4OhCQvhW5keA39tub9nHSDq6V08JoV8FYCpcFhjR5Ua4+a so67w0+K1+meLZscOTJqkKbMUBri X-Google-Smtp-Source: APXvYqx6rfoIDlDSRqAjNEeojfpztr0NuoFOjQd8tKdCWqpu0bAHuh7pslWOtAD1XhCk+s5lT4xltQ== X-Received: by 2002:a5d:4b51:: with SMTP id w17mr2932131wrs.357.1571658553659; Mon, 21 Oct 2019 04:49:13 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 8/9] linux-user/strace: Let print_sockaddr() have a 'last' argument Date: Mon, 21 Oct 2019 13:48:56 +0200 Message-Id: <20191021114857.20538-9-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If the format is not the syscall last argument, a comma is append. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Reviewed-by: Laurent Vivier --- v8: do not name prototype arguments checkpatch error: ERROR: storage class should be at the beginning of the declaration #10: FILE: linux-user/strace.c:70: +UNUSED static void print_sockaddr(abi_ulong, abi_long, int); --- linux-user/strace.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index cd92c77d33..3d4d684450 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -67,7 +67,7 @@ UNUSED static void print_timeval(abi_ulong, int); UNUSED static void print_timezone(abi_ulong, int); UNUSED static void print_number(abi_long, int); UNUSED static void print_signal(abi_ulong, int); -UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen); +UNUSED static void print_sockaddr(abi_ulong, abi_long, int); UNUSED static void print_socket_domain(int domain); UNUSED static void print_socket_type(int type); UNUSED static void print_socket_protocol(int domain, int type, int protocol); @@ -336,7 +336,7 @@ static void print_siginfo(const target_siginfo_t *tinfo) } static void -print_sockaddr(abi_ulong addr, abi_long addrlen) +print_sockaddr(abi_ulong addr, abi_long addrlen, int last) { struct target_sockaddr *sa; int i; @@ -418,7 +418,7 @@ print_sockaddr(abi_ulong addr, abi_long addrlen) } else { print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0); } - gemu_log(", "TARGET_ABI_FMT_ld, addrlen); + gemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last)); } static void @@ -1751,7 +1751,7 @@ static void do_print_sockaddr(const char *name, abi_long arg1) gemu_log("%s(", name); print_sockfd(sockfd, 0); - print_sockaddr(addr, addrlen); + print_sockaddr(addr, addrlen, 0); gemu_log(")"); } @@ -1821,7 +1821,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1) print_buf(msg, len, 0); print_raw_param(TARGET_ABI_FMT_ld, len, 0); print_flags(msg_flags, flags, 0); - print_sockaddr(addr, addrlen); + print_sockaddr(addr, addrlen, 0); gemu_log(")"); } From patchwork Mon Oct 21 11:48:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1180525 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YA8XifHw"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xZhc2ZFgz9sNw for ; Mon, 21 Oct 2019 22:50:40 +1100 (AEDT) Received: from localhost ([::1]:38962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWCs-0005YU-2C for incoming@patchwork.ozlabs.org; Mon, 21 Oct 2019 07:50:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52791) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBb-0005Vd-Mw for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBZ-0003CA-Ic for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:35353) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBZ-0003BP-Cr for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:17 -0400 Received: by mail-wr1-x434.google.com with SMTP id l10so13182327wrb.2 for ; Mon, 21 Oct 2019 04:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M3aCjLzoSIL7ixb0kk9ystt7R8xUSVOY/bvuxxJ0uh4=; b=YA8XifHwosXQTF7oe0vMEXhR9jchg+Wm9KVRH80wPckh14xp6exDlmarHVXqt2RXTf IknPCUODpEyb1XMuL/iS9iwyNV1uKH4pxEEFQpdVGxpkDzr5mnIglWC+7Rg2gBqcFL5a 0rEsF9mnYgW8gKzyWpyfAdFIJ3cIDjvqfXUshAsqimX0JAJ2SRBc8ZWuiLR55SORN7ps PvlZDMw85li4QfV9qX25i3YNwbbMiw2BD7OoSmqMvgLGKjC2BxtFfoHTSM2FW60VHCrx C129a2sNCpn0K9Md+HI1RTG77nLUrivbE9sCtMpTfeHPz1vdQZrToapecmftNLAuIkE6 JO5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=M3aCjLzoSIL7ixb0kk9ystt7R8xUSVOY/bvuxxJ0uh4=; b=S8lY6sN62B1iISESv+9mDH4N104poJk1AEg0Vuh7JEluJdxyLtOeeEjVLRMZIQdKds 7Z8VacxoyOu3ftd1Eb6mQm4oYR++ppDOMjlrETP1wG1ClrttvBQT8hs/xI7B+LQgKNl+ eOU+7ch7bdsRBPiJUZhJ1bD9Vpi/woxCaxS4pVDu0hdGRQltK8XZnqkLT7ZdTKEQWNpz DEOWQI4J88sXEyiJv+d7X90hY0p3P5cVe9q2sWMMpldptEPpXYyajyN/ClU4nwCimvWR EgkIEMit12qM3jQIRQcSK5R0n2ctUZ6sFtrZ3uoJidaQkH94OcOMdqXiijM/X8VreVFW hr5w== X-Gm-Message-State: APjAAAVsyCARRYN07R34b3U6c/oAECfJt5z0TXzVfWjLYiXMXhrn8qcK IExEW1sTGXrG3WmeqetrlGj7aO+M X-Google-Smtp-Source: APXvYqwxrHqbdH7yTo4kSeuX+KqpF26sTgSHv6ohKMUSYKbINZKTGlsIWmJBDTcK20FUWInWxTJxOQ== X-Received: by 2002:a05:6000:149:: with SMTP id r9mr14754388wrx.90.1571658555467; Mon, 21 Oct 2019 04:49:15 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 9/9] linux-user/syscall: Align target_sockaddr fields using ABI types Date: Mon, 21 Oct 2019 13:48:57 +0200 Message-Id: <20191021114857.20538-10-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Target architectures align types differently for instance m68k aligns on 16bit whereas others on 32bit). Use ABI types to keep alignments good. Suggested-by: Laurent Vivier Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier --- v8: Use abi_int for target_sockaddr_ll.sll_ifindex --- linux-user/syscall_defs.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 7694d72446..98c2119de9 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -134,22 +134,22 @@ #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) struct target_sockaddr { - uint16_t sa_family; + abi_ushort sa_family; uint8_t sa_data[14]; }; struct target_sockaddr_ll { - uint16_t sll_family; /* Always AF_PACKET */ - uint16_t sll_protocol; /* Physical layer protocol */ - int sll_ifindex; /* Interface number */ - uint16_t sll_hatype; /* ARP hardware type */ - uint8_t sll_pkttype; /* Packet type */ - uint8_t sll_halen; /* Length of address */ - uint8_t sll_addr[8]; /* Physical layer address */ + abi_ushort sll_family; /* Always AF_PACKET */ + abi_ushort sll_protocol; /* Physical layer protocol */ + abi_int sll_ifindex; /* Interface number */ + abi_ushort sll_hatype; /* ARP hardware type */ + uint8_t sll_pkttype; /* Packet type */ + uint8_t sll_halen; /* Length of address */ + uint8_t sll_addr[8]; /* Physical layer address */ }; struct target_sockaddr_un { - uint16_t su_family; + abi_ushort su_family; uint8_t sun_path[108]; }; @@ -161,24 +161,24 @@ struct target_sockaddr_nl { }; struct target_in_addr { - uint32_t s_addr; /* big endian */ + abi_uint s_addr; /* big endian */ }; struct target_sockaddr_in { - uint16_t sin_family; - int16_t sin_port; /* big endian */ + abi_ushort sin_family; + abi_short sin_port; /* big endian */ struct target_in_addr sin_addr; uint8_t __pad[sizeof(struct target_sockaddr) - - sizeof(uint16_t) - sizeof(int16_t) - + sizeof(abi_ushort) - sizeof(abi_short) - sizeof(struct target_in_addr)]; }; struct target_sockaddr_in6 { - uint16_t sin6_family; - uint16_t sin6_port; /* big endian */ - uint32_t sin6_flowinfo; /* big endian */ + abi_ushort sin6_family; + abi_ushort sin6_port; /* big endian */ + abi_uint sin6_flowinfo; /* big endian */ struct in6_addr sin6_addr; /* IPv6 address, big endian */ - uint32_t sin6_scope_id; + abi_uint sin6_scope_id; }; struct target_sock_filter {