From owner-svn-src-head@freebsd.org Tue Sep 3 14:06:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B448DD05F; Tue, 3 Sep 2019 14:06:51 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7zv0j4mz4PyK; Tue, 3 Sep 2019 14:06:51 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 1F9191AC7F; Tue, 3 Sep 2019 14:06:19 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 0C3D7170EA; Sun, 14 Apr 2019 15:19:41 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 66B036DE0C; Sun, 14 Apr 2019 15:19:40 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0FCF4170A4; Sun, 14 Apr 2019 15:19:40 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id D4D2C170A1; Sun, 14 Apr 2019 15:19:37 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 03EEC6DDF8; Sun, 14 Apr 2019 15:19:37 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm1-x331.google.com with SMTP id z24so17043469wmi.5; Sun, 14 Apr 2019 08:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wIAcKt77BrlhQeePUMwhnHR7UZrckdVrnOdVhiE+e8Y=; b=ejxeVdj0TFOOinK6twoT3j5lNQVitHFsP3EOQpLTa8FkW+Nh/O+D3CouXT3DwZrHGk K+RcIbUByiSKh9VIsRnAETCeGQE/RKcsBUfNSkmsjftDWqjTMaoR0daNU/VWRZSPCcqn pEMAAEdNO03CMW47K7fCQbdL5IeMINFh00ZnF2ZyuYw9b2J02BzOdXDnMjVplv5cyJVz QESDP7R4/CumhKZ7r317vUDmaACg3zuEjUOogm9axZ/R1SETtKs0gAyQnvMlb+uVEeJj FJ1wwdShPPzQisopnbJ1wEF012ksQfh7wl/RtZavXh7K/zih90Y1lQ3kVuOHnpG2wQUl d+ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wIAcKt77BrlhQeePUMwhnHR7UZrckdVrnOdVhiE+e8Y=; b=mQbKTcqyfsVY8O6lSNyCwmQYanSZ1bPYQCPzQem+AGc96BEg2Hygx1u5/OMBMiDVSV TU0KTzRAZRwj5yUh64EcTRPmr4Da1oBqQPaY67VEAEnRTgTSPx+exPDZ/Dc9gO2xBSeA Ar12w0Jj5fdoTpm8biDA0PxFa3XBT8Ibfdwwp/5oHhcBm7vnrWO1W6KxEkpkx1ipDg2U c8BylCtqO8b33zxOVflHBr/H/nxIPz3FrEe6ojGgUgPpIUw+16RuLghAVFCWGD3pVKbY DDD04EeaauVU6392GkLU5eNniRoOOe5aLMuQKoZBSSwE3J7kWaGzcEf7Ygyc7IBCGNxK JyTw== X-Gm-Message-State: APjAAAUE5LICVVubYJu7ca6kDcV7UEsHB4asth8vdufksnnp+lyJZpsJ ERRNnsTd1nKyOJA9oL6T2Wuq61cyu2oXbndUzcpZKA== X-Google-Smtp-Source: APXvYqy5Sset3BB2gJ2DJd6mCD1PRRc3CkGtoG/CAtT1RmbUEaWkU764VKjBoxtZy0Y0G/057JDtISms0sW9rBWvL+o= X-Received: by 2002:a1c:6309:: with SMTP id x9mr18538818wmb.101.1555255174900; Sun, 14 Apr 2019 08:19:34 -0700 (PDT) MIME-Version: 1.0 References: <201904041632.x34GWR4Z006164@repo.freebsd.org> In-Reply-To: <201904041632.x34GWR4Z006164@repo.freebsd.org> From: Adrian Chadd Message-ID: Subject: Re: svn commit: r345875 - in head: contrib/elftoolchain/strings usr.bin/strings To: Mariusz Zaborski Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 66B036DE0C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:06:52 -0000 X-Original-Date: Sun, 14 Apr 2019 08:19:22 -0700 X-List-Received-Date: Tue, 03 Sep 2019 14:06:52 -0000 This exposed a fun bug - gcc mips 6.4.0 complains about an unused arg (fa) in fileargs_fopen() in the strings change when you compile without casper support. I do that on mips. I have a local change that converts the #define to an inline function so the unused arg can be (void)'ed away. Mind if I commit it? -adrian On Thu, 4 Apr 2019 at 09:32, Mariusz Zaborski wrote: > Author: oshogbo > Date: Thu Apr 4 16:32:27 2019 > New Revision: 345875 > URL: https://svnweb.freebsd.org/changeset/base/345875 > > Log: > strings: capsicumize it > > Reviewed by: cem > Discussed with: emaste > Differential Revision: https://reviews.freebsd.org/D18038 > > Modified: > head/contrib/elftoolchain/strings/strings.c > head/usr.bin/strings/Makefile > > Modified: head/contrib/elftoolchain/strings/strings.c > > ============================================================================== > --- head/contrib/elftoolchain/strings/strings.c Thu Apr 4 12:02:48 2019 > (r345874) > +++ head/contrib/elftoolchain/strings/strings.c Thu Apr 4 16:32:27 2019 > (r345875) > @@ -25,8 +25,10 @@ > */ > > #include > +#include > #include > > +#include > #include > #include > #include > @@ -44,6 +46,9 @@ > #include > #include > > +#include > +#include > + > #include "_elftc.h" > > ELFTC_VCSID("$Id: strings.c 3648 2018-11-22 23:26:43Z emaste $"); > @@ -85,7 +90,7 @@ static struct option strings_longopts[] = { > }; > > int getcharacter(FILE *, long *); > -int handle_file(const char *); > +int handle_file(fileargs_t *fa, const char *); > int handle_elf(const char *, FILE *); > int handle_binary(const char *, FILE *, size_t); > int find_strings(const char *, FILE *, off_t, off_t); > @@ -99,6 +104,8 @@ void usage(void); > int > main(int argc, char **argv) > { > + fileargs_t *fa; > + cap_rights_t rights; > int ch, rc; > > rc = 0; > @@ -187,27 +194,41 @@ main(int argc, char **argv) > argc -= optind; > argv += optind; > > + cap_rights_init(&rights, CAP_READ, CAP_SEEK, CAP_FSTAT, CAP_FCNTL); > + fa = fileargs_init(argc, argv, O_RDONLY, 0, &rights); > + if (fa == NULL) > + err(1, "Unable to initialize casper fileargs"); > + > + caph_cache_catpages(); > + if (caph_limit_stdio() < 0 && caph_enter_casper() < 0) { > + fileargs_free(fa); > + err(1, "Unable to enter capability mode"); > + } > + > if (min_len == 0) > min_len = 4; > if (*argv == NULL) > rc = find_strings("{standard input}", stdin, 0, 0); > else while (*argv != NULL) { > - if (handle_file(*argv) != 0) > + if (handle_file(fa, *argv) != 0) > rc = 1; > argv++; > } > + > + fileargs_free(fa); > + > return (rc); > } > > int > -handle_file(const char *name) > +handle_file(fileargs_t *fa, const char *name) > { > FILE *pfile; > int rt; > > if (name == NULL) > return (1); > - pfile = fopen(name, "rb"); > + pfile = fileargs_fopen(fa, name, "rb"); > if (pfile == NULL) { > warnx("'%s': %s", name, strerror(errno)); > return (1); > > Modified: head/usr.bin/strings/Makefile > > ============================================================================== > --- head/usr.bin/strings/Makefile Thu Apr 4 12:02:48 2019 > (r345874) > +++ head/usr.bin/strings/Makefile Thu Apr 4 16:32:27 2019 > (r345875) > @@ -10,6 +10,12 @@ PROG= strings > > LIBADD= elftc elf > > +.if ${MK_CASPER} != "no" && !defined(BOOTSTRAPPING) > +LIBADD+= casper > +LIBADD+= cap_fileargs > +CFLAGS+= -DWITH_CASPER > +.endif > + > CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common > > .include > >