From owner-svn-src-head@freebsd.org Sun Apr 14 15:19:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A228157857C; Sun, 14 Apr 2019 15:19:38 +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 Date: Sun, 14 Apr 2019 08:19:22 -0700 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 X-Rspamd-Queue-Id: 03EEC6DDF8 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=ejxeVdj0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of adrianchadd@gmail.com designates 2a00:1450:4864:20::331 as permitted sender) smtp.mailfrom=adrianchadd@gmail.com X-Spamd-Result: default: False [-6.69 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[1.3.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; IP_SCORE(-2.79)[ip: (-9.32), ipnet: 2a00:1450::/32(-2.39), asn: 15169(-2.19), country: US(-0.06)]; NEURAL_HAM_SHORT(-0.89)[-0.890,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] 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 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2019 15:19:38 -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 > >