Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'practice,': 0.07; 'bits': 0.09; 'cc:addr:python-list': 0.11; '4gb': 0.16; 'disaster,': 0.16; 'discarded': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'likely.': 0.16; 'subject:bit': 0.16; 'unlikely': 0.16; 'work"': 0.16; 'size,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'integer': 0.24; 'pointer': 0.24; 'environment': 0.24; 'cc:2**0': 0.24; '15,': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; 'compatible': 0.32; 'used,': 0.33; 'subject:the': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'done,': 0.36; 'ibm': 0.36; 'possible': 0.36; 'so,': 0.37; 'pm,': 0.38; 'even': 0.60; 'most': 0.60; 'lowest': 0.74; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=HwUp4mRLqgrIk18ORdpio4G0xL4w/cGmjdUDns/WjxM=; b=p3RSnbJ1TcnKbLgohqp5JM/MvJIGW0sZbwtEQWPK5H0A6/LecP5JIqm7tOLVk451A7 1MUUwSeXJGrMntQ50UTgVFpyMNPrjlCjyZZt+ZX9FH9L6ADR954qiN5D/8iL7m8wClFL 27DYviyNbg6LLPQE33rt9YJmfTC9Eya92JIS8/YcEGwaepJZrIybcZ4mRvoq09kBT54f f/ofbXYK3zyVSTDf2lWloYEP16cZT/7T1vUUnjwQT5Vdj4gefpZswV6mTC7sEoS3QwJM 1pz4JMYFodDvtj2JTo7Ny/jhA9f+dAM3+C/KuSOBXr6Ii4JEWo47umZQ4TpcRvd//S5R A41g== MIME-Version: 1.0 X-Received: by 10.52.76.102 with SMTP id j6mr167770vdw.38.1397549910713; Tue, 15 Apr 2014 01:18:30 -0700 (PDT) In-Reply-To: References: Date: Tue, 15 Apr 2014 18:18:30 +1000 Subject: Re: Python, Linux, and the setuid bit From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397549919 news.xs4all.nl 2873 [2001:888:2000:d::a6]:55208 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70256 On Tue, Apr 15, 2014 at 6:15 PM, Chris Angelico wrote: > then two's complement arithmetic will give the right result > even if the discarded bits differ. Clarification: Two's complement isn't the only way this could be done, but it is the most likely. So, in theory, there are several possible causes of disaster, but in practice, on any IBM PC compatible architecture, casting a pointer to an integer will usually take the lowest N bits, and two's complement arithmetic will be used, and the environment is unlikely to hit 4GB in size, so the program will "happen to work" in >99.999% of cases. ChrisA