From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: 24703@debbugs.gnu.org
Subject: bug#24703: Store references in 8-byte chunks in compiled code
Date: Mon, 31 Oct 2016 12:37:09 +0100 [thread overview]
Message-ID: <87pomgrbq2.fsf@gnu.org> (raw)
In-Reply-To: <87oa21c9fe.fsf@netris.org> (Mark H. Weaver's message of "Mon, 31 Oct 2016 02:35:49 -0400")
Hi Mark,
Mark H Weaver <mhw@netris.org> skribis:
> ludo@gnu.org (Ludovic Courtès) writes:
[...]
>>> So, if our approach is to use -fno-builtin-strcpy, then we will have to
>>> apply it system-wide, and rebuild all of 'core-updates' from scratch.
>>
>> Another approach would be to patch GCC, specifically ‘expand_movstr’ in
>> gcc/builtins.c, which is the part responsible for this optimization,
>> along these lines (untested):
>>
>> --- gcc-5.3.0/gcc/builtins.c.orig 2016-10-18 10:45:35.042826368 +0200
>> +++ gcc-5.3.0/gcc/builtins.c 2016-10-18 10:50:46.080616285 +0200
>> @@ -3470,6 +3470,19 @@ expand_builtin_mempcpy_args (tree dest,
>> # define CODE_FOR_movstr CODE_FOR_nothing
>> #endif
>>
>> +/* Return true if STR is a string denoting a "/gnu/store" file name. */
>> +
>> +static bool
>> +store_reference_p (tree str)
>> +{
>> + const char *store;
>> +
>> + store = getenv ("NIX_STORE") ?: "/gnu/store";
>> +
>> + return (TREE_STRING_LENGTH (str) > strlen (store)
>> + && strncmp (TREE_STRING_POINTER (str), store, strlen (store)));
>> +}
>
> [...]
>
>> WDYT?
>
> I think it's not sufficient to apply this workaround only for string
> literals that _begin_ with the store directory. In some cases, the
> store name may appear only in the middle of a string.
Do you have examples? I think this is unlikely: the common case here is
that we’re capturing the installation prefix as in:
#define PREFIX "/gnu/store/…"
strcpy (file, PREFIX);
>> In the meantime, we need a workaround. The only option I can think of
>> is to retain a reference to the ungrafted item by adding a symlink to
>> it, like:
>
> I consider it a potentially serious security problem that ungrafted
> outputs are being used. Papering over the problem by preventing this
> buggy software from being deleted is, in my opinion, not acceptable.
In practice, only data from the ungrafted input would be used, AFAICS.
I’m not saying that this is a good solution, I’m just trying to think of
solutions that we can deploy now while waiting for something better,
which may involve a full rebuild.
> The GCC approach is okay with me in the short term, but I'll likely want
> to revisit this issue in the future.
From your message, it’s unclear to me what you are proposing:
1. as the short term solution;
2. as the long term solution.
To me short-term is symlink and long-term is GCC patch.
Thanks for your feedback,
Ludo’.
next prev parent reply other threads:[~2016-10-31 11:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-16 3:49 bug#24703: fontconfig keeps obfuscated reference to itself, not grafted Mark H Weaver
2016-10-16 4:26 ` Mark H Weaver
2016-10-16 5:00 ` Mark H Weaver
2016-10-16 6:24 ` bug#24703: Store references in 8-byte chunks in compiled code Mark H Weaver
2016-10-16 9:03 ` Mark H Weaver
2016-10-16 9:25 ` Mark H Weaver
2016-10-16 10:15 ` Mark H Weaver
2016-10-16 19:04 ` Ludovic Courtès
2016-10-17 7:46 ` bug#24703: " Török Edwin
2016-10-17 9:42 ` Mark H Weaver
2016-10-17 12:09 ` Ludovic Courtès
2016-10-18 3:36 ` Mark H Weaver
2016-10-18 8:59 ` Ludovic Courtès
2016-10-31 6:35 ` Mark H Weaver
2016-10-31 11:37 ` Ludovic Courtès [this message]
2016-10-24 19:40 ` Leo Famulari
2016-10-24 20:18 ` Ludovic Courtès
2016-11-04 23:15 ` Ludovic Courtès
2016-11-05 18:36 ` Leo Famulari
2016-11-06 20:58 ` Ludovic Courtès
2016-11-09 20:40 ` Ludovic Courtès
2016-11-09 23:16 ` Leo Famulari
2016-11-10 8:01 ` Ludovic Courtès
2017-04-02 22:19 ` Ludovic Courtès
2016-11-11 10:39 ` Ludovic Courtès
2016-10-19 21:25 ` Török Edwin
2016-10-20 12:25 ` Ludovic Courtès
2016-10-16 14:42 ` bug#24703: fontconfig keeps obfuscated reference to itself, not grafted Ludovic Courtès
2016-10-16 15:06 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pomgrbq2.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=24703@debbugs.gnu.org \
--cc=mhw@netris.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.