From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 3A5EB1F97E for ; Mon, 26 Nov 2018 11:38:49 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id B66DD120E3C; Mon, 26 Nov 2018 20:38:46 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 4C597120E1C for ; Mon, 26 Nov 2018 20:38:42 +0900 (JST) Received: by filter0010p3iad2.sendgrid.net with SMTP id filter0010p3iad2-4049-5BFBDB3D-37 2018-11-26 11:38:37.897590861 +0000 UTC m=+328645.517493255 Received: from herokuapp.com (ec2-54-144-43-237.compute-1.amazonaws.com [54.144.43.237]) by ismtpd0031p1iad2.sendgrid.net (SG) with ESMTP id jhavyDZBSSWzrXUnbHD1_g Mon, 26 Nov 2018 11:38:37.932 +0000 (UTC) Date: Mon, 26 Nov 2018 11:38:38 +0000 (UTC) From: v.ondruch@tiscali.cz To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 65470 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15335 X-Redmine-Issue-Author: vo.x X-Redmine-Issue-Assignee: ioquatix X-Redmine-Sender: vo.x X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS7LMC4pkDpigWF4jwukPamIzf2ibZzuERpw8b GgSEf/hHYzN9FrMfsV9qJWUtTqZvFBLfOU7qb6k9lNQSbshaudUdzFrLNxennckroO/tUjzvksbeJD Y3VgncSmx9LCKqSaiV/oUVpUbrhMcqavh1VNdefmfNdEVJBLCAYbO0N0Eg== X-ML-Name: ruby-core X-Mail-Count: 90074 Subject: [ruby-core:90074] [Ruby trunk Bug#15335] Ruby 2.6.0 is not properly fortified X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15335 has been updated by vo.x (Vit Ondruch). Testing with r65990 on x86_64 and the test passed. I guess I should not try to build on other arches yet, right? ---------------------------------------- Bug #15335: Ruby 2.6.0 is not properly fortified https://bugs.ruby-lang.org/issues/15335#change-75198 * Author: vo.x (Vit Ondruch) * Status: Assigned * Priority: Normal * Assignee: ioquatix (Samuel Williams) * Target version: * ruby -v: ruby 2.6.0dev (2018-11-22 trunk 65928) [x86_64-linux] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- For some while, we carry this test in Fedora package [1]: ~~~ checksec -f libruby.so.%{ruby_version} | \ grep "Full RELRO.*Canary found.*NX enabled.*DSO.*No RPATH.*No RUNPATH.*Yes.*\d*.*\d*.*libruby.so.%{ruby_version}" ~~~ This should ensure, that the library is properly fortified [2]. This test was passing with preview3, but it started to fail, testing with r65928: ~~~ $ checksec -f libruby.so.2.6.0 WARNING: 'openssl' not found! It's required for most checks. WARNING: Not all necessary commands found. Some tests might not work! RELRO STACK CANARY NX PIE RPATH RUNPATH FORTIFY Fortified Fortifiable FILE Full RELRO Canary found NX disabled DSO No RPATH No RUNPATH Yes 16 42 libruby.so.2.6.0 ~~~ The `NX disabled` is the difference. Looking at the log, it is definitely not about configuration options. So if I should point finger at something, it seems to me that this must be it: ~~~ ... snip ... assembling coroutine/amd64/Context.s gcc -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/10.0.0 -o coroutine/amd64/Context.o -c coroutine/amd64/Context.s ... snip ... gcc -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-soname,libruby.so.2.6 -fstack-protector-strong -m64 dln.o localeinit.o loadpath.o array.o ast.o bignum.o class.o compar.o compile.o complex.o cont.o debug.o debug_counter.o dir.o dln_find.o encoding.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o iseq.o load.o marshal.o math.o mjit.o mjit_compile.o node.o numeric.o object.o pack.o parse.o proc.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o symbol.o thread.o time.o transcode.o transient_heap.o util.o variable.o version.o vm.o vm_backtrace.o vm_dump.o vm_trace.o coroutine/amd64/Context.o probes.o enc/ascii.o enc/us_ascii.o enc/unicode.o enc/utf_8.o enc/trans/newline.o setproctitle.o strlcat.o strlcpy.o addr2line.o prelude.o dmyext.o dmyenc.o -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm -o libruby.so.2.6.0 ... snip ... ~~~ I.e. the coroutines assembly. Not sure how to prove it nor fix it. [1]: https://src.fedoraproject.org/rpms/ruby/blob/c80ecd9db905f328079a9c8afee70a34e1dcc18c/f/ruby.spec#_735 [2]: https://fedoraproject.org/wiki/Changes/Harden_All_Packages#How_To_Test -- https://bugs.ruby-lang.org/