From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38522 invoked by alias); 5 Aug 2019 18:18:58 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 38514 invoked by uid 89); 5 Aug 2019 18:18:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*F:D*gov, H*MI:prod X-HELO: nihcesxwayst06.hub.nih.gov Received: from nihcesxwayst06.hub.nih.gov (HELO nihcesxwayst06.hub.nih.gov) (165.112.13.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Aug 2019 18:18:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nih.gov; i=@nih.gov; q=dns/txt; s=NIH; t=1565029134; x=1596565134; h=from:to:subject:date:message-id: content-transfer-encoding:mime-version; bh=YQbz/I6LMTZluGWgZLPMlYMEFeuBfGWkvLy9yRKlWug=; b=FF4S+ZvuK1sxz8Jc+aGytGPLDDd2Td5K6PQIG9NNNMQkhyYIrVHnUz35 6XZYZYhb5LHyM2fMprrh9TdHiTt3+saycGW9s8YZ8up3BJ6YQPueoaaEL RcbSE/OWnezr0aiA7I60cmd8mQWRkqVMSgFGdl54WtF/CdTwAurhEFQxM ueGdgi7+40/jaGkg5T+GfgWCAWbbw8u1DUmpe3ahTrmL4SGsBmhKUB3mR iF5TPDpPa9SLPl+M24KgJeZ4I/L82XMMlRPWMODe5l4EVZPbTRWBSxbtW GXoZEh/hZzrcTYQDYeW4KryRl+P0s6H8pMPpZOPYd6IcywLAwrnV8aKI4 w==; IronPort-SDR: BHjT0iPWYNgv4NsUTXTdbUQgAC3yTlStRhS5Ih4Cmr/nmh83L1caXUUsPsOV5K/DxCRAyp8T41 LMJQUU+4ooDQ== Received: from uccbx01.nih.gov (HELO ces.nih.gov) ([156.40.79.151]) by nihcesxwayst06.hub.nih.gov with ESMTP/TLS/ECDHE-RSA-AES256-SHA384; 05 Aug 2019 14:18:53 -0400 Received: from uccbX02.nih.gov (156.40.79.152) by uccbX01.nih.gov (156.40.79.151) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 5 Aug 2019 14:18:53 -0400 Received: from GCC02-BL0-obe.outbound.protection.outlook.com (156.40.79.134) by uccbX02.nih.gov (156.40.79.152) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 5 Aug 2019 14:18:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8Jqm3S+Sdey2Mh2PmndnMRuBXFDzYMqcEU8typkv2JTGpA92q8plHk2mt3xnDZSq5myVckxSkL8ve3ixHaJXcWdCCWL+LhnFBaMEMrWjKdTQGF6vBI0NdeG92O72BNfs9BR0vsZ0EkU/ssYDi2h0R+VVg4LbKsfBMAqiOZZkDBUAkeBFJDTvjIf8CEX9z8gqvboSmIW8RXoTThYfFxztZLKLmZoysmZjgQQzVxsAKqdqntHppw4chUPAHEoCcPUAjt0PmEcn9vodegxN4elDNYqf8Fed14sBxf01TRO0YgODZ5BTReqz/4rtnxzk2AsYLeKlVPWi2LTlcD18cdLNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YQbz/I6LMTZluGWgZLPMlYMEFeuBfGWkvLy9yRKlWug=; b=bGtZOKvZwAnsXb10vXVhqZaMggSt3pPbL6xIRGi5ghA0WJoWnO/uSv7tGnhItt1V93BzoqQacWFBCnHggva+QBI8dt6/AnESpICqe3ua/oRISs3D1TLDOakuBi7wqvg5R7E17970/cmUV/L3qD8emaL9ybZ8oi9A08ikX9af2LczUTo4aOlnIivGIC5oD0PcJW8w15R9nfTmIoLlKVw5Pb5zdNw07pbNM3PB8xmcoTDdfMipWYBwPOc22HPKdxSmKTk2jYsgT+tK7fv/BTrRFnRNfgsWT8proKXutSYQ9oixYrK4E3E2HvKEYFop8HhBLAP1W2l3wGO2URVqOKbDNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=ncbi.nlm.nih.gov;dmarc=pass action=none header.from=ncbi.nlm.nih.gov;dkim=pass header.d=ncbi.nlm.nih.gov;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nih.onmicrosoft.com; s=selector1-nih-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YQbz/I6LMTZluGWgZLPMlYMEFeuBfGWkvLy9yRKlWug=; b=EafgerdsFSd1Yu5F/5hTbQlfZmIdqf5ikHzfeEmKlYBVhkeV5lWe53eOZ8LDhLhx2FasH2OnshX/2Sm/ISLoizmJdYGEC5nlL6WnTYekxwgwhACARtK2yuHc37Fj1E0/hLpsgkDiKRCDv3cmFUjL89ofqRD10X3KPnBLW6yqoQQ= Received: from BL0PR0901MB4308.namprd09.prod.outlook.com (52.135.47.83) by BL0PR0901MB3795.namprd09.prod.outlook.com (52.132.25.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.16; Mon, 5 Aug 2019 18:18:52 +0000 Received: from BL0PR0901MB4308.namprd09.prod.outlook.com ([fe80::8052:3866:283f:306c]) by BL0PR0901MB4308.namprd09.prod.outlook.com ([fe80::8052:3866:283f:306c%3]) with mapi id 15.20.2136.018; Mon, 5 Aug 2019 18:18:52 +0000 From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin" Reply-To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" To: "'cygwin@cygwin.com'" Subject: Empty file without "x" permission is successfully executable on Cygwin Date: Mon, 05 Aug 2019 18:18:00 -0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=lavr@ncbi.nlm.nih.gov; x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lavr@nih.gov Return-Path: lavr@ncbi.nlm.nih.gov X-SW-Source: 2019-08/txt/msg00054.txt.bz2 Hi, Please consider the following shell session: $ cat dummy.c #include int main() { return 0; } $ gcc -o dummy dummy.c $ mv dummy.exe dummy $ ./dummy $ echo $? 0 $ chmod a-x dummy $ ./dummy -bash: ./dummy: Permission denied $ rm dummy $ touch dummy $ ./dummy $ echo $? 0 So Cygwin lets the shell to execute a zero-sized file regardless of the "x"= perm (non-empty files are not executable if they do not have "x", as shown above= ). Is that expected? On Unix, an empty file can only be executed (exit code 0= ) if there's the "x" permission granted. There's more. If I put some rubbish in a file, Cygwin still tries to execu= te it even if the "x" is not there: $ rm dummy $ echo "1" > dummy $ ./dummy ./dummy: line 1: 1: command not found So Cygwin knows about "dummy" being a PE32 executable missing the "x" (top = of my session), and properly denies the execution when there's no "x", but still lets all other file contents execute blindly= (regardless of "x"). That's very dangerous! Thanks, Anton Lavrentiev -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple