LLVM Backend for the VideoCore4, Raspberry Pi 2 VPU

README.md

This is mostly based on the work done by David Given (cowlark). It works, and can compile and produce reasonable code. I did this so I could have a decent compiler to develop my Raspberry Pi firmware on.

The actual VideoCore4 target is in lib/Target/VideoCore4/. To build this, you’ll need to use CMake.

What works

  • Pretty much everything that isn’t listed under the ‘Issues’ section. Some corner cases may still lead to LLC errors such as using certain builtins.

Issues

  • Variable length arrays do not work (because of FP not being implemented)
  • MC code emisssion is not supported
  • Use any floating point arithmetic at your own risk, I have not tested it
  • BB reordering is not implemented so you’ll have to live with redundant branches being generated
  • TableGen code is not ideal, I tried to improve it and get rid of some of the hacks used in the original one but there’s still a long way to go.
  • Some directives emmited by LLC confuse VASM so at the moment I just sed them out in the Makefile (I’ve included an example).

Using it

For now, you should just build LLC and use a stock Clang that can target XCore and emit LL files. As the VideoCore4 target does not currently support MC code emission, you will have to rely on an external assembler/linker, namely VASM and VLINK.

VASM requires a small patch in order to work but since the license does not allow redistribution of modifications, I cannot include it, but to summarise in the VideoCore cpu.c file, in translate the handler for for 48 bit arithmetic instructions needs to have the first conditional commented out (the one that checks if the instruction number is less than 32).

Once you applied this patch and built VASM and VLINK, you can use it as shown in the Makefile excerpt here:

CC = clang
CXX = clang++
AS = ../vasm/vasmvidcore_std
LINK = ../vlink/vlink
CFLAGS = -S -O3 -D__VIDEOCORE4__ -no-integrated-as -fno-vectorize -fno-slp-vectorize -emit-llvm -target xcore-none-none-none -nostdlib
ASFLAGS = -Fvobj -quiet
LLC =  ../llvm-vc4/build/bin/llc -O3 --mtriple vc4

$(TARGET_BUILD_DIR)/%.o: %.c $(HEADERS)
    $(CREATE_SUBDIR)
    @echo $(WARN_COLOR)CC $(NO_COLOR)  $@
    @$(CC) $(CFLAGS) $< -o $@.ll

    @echo $(WARN_COLOR)LLC$(NO_COLOR)  $@.ll
    @$(LLC) $@.ll -o $@.s

    @sed -i '/^t.section/d' $@.s
    @sed -i '/^t.bss/d' $@.s
    @sed -i '/^t.align 16/ct.align 2' $@.s
    @echo $(WARN_COLOR)AS $(NO_COLOR)  $@
    @$(AS) $(ASFLAGS) $@.s -o $@

$(TARGET_BOOTCODE): create_build_directory $(OBJ)
    @echo $(WARN_COLOR)LD $(NO_COLOR)  $@
    $(SET_BINUTILS_ENV)
    @$(LINK) $(OBJ) -b rawbin1 -o $(PRODUCT_DIRECTORY)/$@


Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/_cy_vWAl_Rs/LLVM-VideoCore4

Original article

Judge Grants Search Warrant Forcing Woman to Unlock iPhone with Touch ID

touch_id_fingerFor the first time in a federal case, authorities in a Los Angeles courtroom have issued a search warrant forcing a woman to bypass her iPhone’s biometric security using Apple’s Touch ID system (via LA Times). The woman in question — Paytsar Bkhchadzhyan — was arrested due to charges of identity theft and had previous strings of various criminal convictions.

According to jail records, U.S. Magistrate Judge Alicia Rosenberg signed the Touch ID-related search warrant about 45 minutes after Bkhchadzhyan was taken into custody on February 25. By the afternoon of her arrest, the suspect pleaded no contest to the charges of identity theft and gave the court her fingerprint to unlock the iPhone.

Police recovered Bkhchadzhyan’s smartphone at the residence of her boyfriend, Sevak Mesrobian, known to be the member of a local gang, so it’s unclear whether the contents of the device were sought after due to Bkhchadzhyan’s crimes or her proximity to Mesrobian’s gang.

The court’s decision in the case follows the thin rules regarding a person’s Fifth Amendment’s protection against self-incrimination, which relates that numeric passcodes are protected individual privacies, but fingerprints are not. For this reason, some believe new modern laws need to be enacted specifically detailing fingerprint-related security features.

“It isn’t about fingerprints and the biometric readers,” said Susan Brenner, a law professor at the University of Dayton who studies the nexus of digital technology and criminal law, but rather, “the contents of that phone, much of which will be about her, and a lot of that could be incriminating.”

Even with the limited outlines of the inquiry, Brenner said the act of compelling a person in custody to press her finger against a phone breached the Fifth Amendment’s protection against self-incrimination. It forced Bkchadzhyan to testify — without uttering a word — because by moving her finger and unlocking the phone, she authenticated its contents.

Still, others believe the biometric nature of Touch ID might largely follow in line with the 5th Amendment’s prohibition of self-incrimination. “Unlike disclosing passcodes, you are not compelled to speak or say what’s ‘in your mind’ to law enforcement,” Albert Gidari, the director of privacy at Stanford Law School’s Center for Internet and Society, said. “‘Put your finger here’ is not testimonial or self-incriminating.”

This line of thinking flows directly from a 2014 case in Virginia, wherein a judge ruled that a man could not be ordered to present his passcode to the court, because that “entailed revealing knowledge and therefore testifying.” Using Touch ID on his iPhone was ruled legal, however, and compared to providing the court with a key, instead of divulging information known only to him.

Although unrelated, the Los Angeles case follows a couple of months of heated debate between Apple and the FBI, as the government agency attempted to compel Apple into helping it hack into the iPhone of San Bernardino shooter Syed Farook. Eventually the FBI withdrew its lawsuit after finding its own way into the iPhone 5c, which reportedly cost the agency less than $1 million.

Note: Due to the political nature of the discussion regarding this topic, the discussion thread is located in our Politics, Religion, Social Issues forum. All forum members and site visitors are welcome to read and follow the thread, but posting is limited to forum members with at least 100 posts.

How about an auto-destruct wipe finger.

Say you put your middle finger and all your phones content gets wiped.

If you’re arrested for allegedly committing a crime and the courts order you to use your physical key to open a safe deposit box so they can examine the contents, is that legal? It seems like this case would be no different, with a key of a more modern kind being used to access the files.
Well there you go. Privacy is essentially over, as is our fifth amendment right. Not an advocate for criminals but this slippery slope leads to a lot more than criminal persecution.
“Oh wait, was it this finger or that one? I don’t remember…”

I do.
[doublepost=1462205532][/doublepost]
that would be great.

The minute you see the police restart your phone.

with a warrant i see no issue

I do.
[doublepost=1462205532][/doublepost]

How about an auto-destruct wipe finger.

Say you put your middle finger and all your phones content gets wiped.

that would be great.

with a warrant i see no issue
Just keep trying the wrong finger until iOS demands your actual password.
Hmmm, just managed to ‘wrong finger’ my 6s 5 times in about 3 seconds to get to the passcode requirement screen, so it could be possible to screw it up unless the rozzers are on top of their game.

Say you put your middle finger and all your phones content gets wiped.

What an appropriate finger to use!


Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/NkLBr_1TmBI/judge-unlock-iphone-touch-id

Original article

Scaling Down Gracefully with AWS Lambda and HAProxy

But a relatively unusual one of late was this: “How do you scale down your infrastructure without messing with your users’ requests?” Since we™re doing something unconventional and interesting with Lambda and HAProxy to tackle this problem, we’re happy to share our techniques with the DevOps community. (If you’re not really into the whole DevOps thing, you might not like this post all that much.)

The tech stack

At Contentful, we run the systems that provide our API services on Amazon Web Services. The API traffic coming in from the internet is handled by AWS’ Elastic Load Balancer (ELB), which is an easy-to-use, scalable traffic management solution ” but it provides very few knobs to twist. So, once the requests are within our platform, we use the open-source HAProxy software to handle traffic routing and load-balancing.

The problem of lost requests

Our HAProxy is configured by Chef, so it’s aware of the different application components internal to our platform, and also knows which servers they are currently running on. Last year, after streamlining our instance bootstrap process with cloud-init and custom Amazon Machine Images (AMIs) built with Packer, we switched to using Auto Scaling groups in Amazon EC2, which means application servers can appear and disappear depending on the load across the entire server group. With ELB this isn’t a problem since ELB and Auto Scaling are designed to work together; Auto Scaling honors the ELB’s connection-draining settings and allows for a graceful exit of the server being terminated. But with HAProxy, we needed a way to remove an EC2 instance from HAProxy before it was terminated, so that we would not lose customer requests.

Rough sketch of the setup

Hacking the instance lifecycle

This effect could be achieved by interacting locally with every HAProxy process to tell it to disable a backend, requiring extra commands to be run on every instance. But since currently our Chef setup reads the tags of all our EC2 instances to build its map of what should be running where, we realised that we could do this by setting a tag, e.g. remove_from_lb, and adding a little extra Chef code to drop instances with this tag when we periodically build the HAProxy configuration file. By configuring an Auto Scaling Lifecycle Hook on the Auto Scaling Group, we could make it wait when entering the EC2_INSTANCE_TERMINATING phase long enough for Chef first to remove it and reload HAProxy, thus ensuring no additional requests were sent to this server.

To carry out the lifecycle state transition, Auto Scaling Lifecycle Hooks must be configured with a notification target to trigger the action required. This can be an SNS topic or an SQS queue. Therefore, we needed a service that could receive such a notification ” a JSON message containing the instance ID and details about the lifecycle state change ” and add the tag to that instance. This would provide us with a central location to run this task, but we would need to set up a new web service to listen for notifications and do the job for us ” and frankly, we have just enough services to take care of already.

Lambda, the lifesaver

Lambda ensures that no request is left behind

That is where AWS Lambda came in. Lambda is a zero-administration compute platform: it offers a great way to execute stateless code in response to events such as changes in S3 buckets or messages to SNS topics. You configure your Lambda function’s triggers and operating parameters (memory and CPU per invocation), upload your code via the AWS API or console, and Lambda will run your code every time it is triggered (you are billed by seconds of execution time).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
console.log('Loading function');
var aws = require('aws-sdk');
    
exports.handler = function(event, context) {
  var message = JSON.parse(event.Records[0].Sns.Message);
  console.log('Got LifecycleActionToken from SNS:', message.RequestId);
    
  var region = process.env.AWS_REGION;
  var ec2 = new aws.EC2({region: region});
  params = {Resources: [message.EC2InstanceId], Tags: [
    {Key: 'remove_from_lb', Value: 'yes'}
  ]};
  console.log('Tagging instance for removal: ', message.EC2InstanceId);
  ec2.createTags(params, function(err) {
    console.log("Tagging instance", err ? "failure" : "success");
    context.succeed(message.RequestId);
  });
};

We implemented the tag-on-terminating function in 20 lines of Node JS code, and so far this has worked without a hitch.

Without Lambda we would have had to do this from one of our instances, adding more complexity and yet another service we must monitor to ensure correct operation. Lambda provides an easy-to-use, dependable, low-maintenance platform for acting on events, especially those generated inside the AWS environment themselves (S3, SNS, SQS, DynamoDB and Kinesis, with more being added all the time). We have since used it to ship ELB and CloudFront logs to logging aggregation services, invalidate CloudFront objects on changes in S3, and translate SNS notifications to Slack messages (in conjunction with AWS API Gateway).

More about Lambda


Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/xNQ4KPo4voA/

Original article

Audiophile Torrent Site What.CD Fully Pwnable Thanks To Wrecked RNG

Reader mask.of.sanity writes: Users of popular audiophile torrent site What.CD can make themselves administrators to completely compromise the private music site and bypass its notorious download ratio limits thanks to the use of the mt_rand function for password resets, a researcher has found. From the report (edited and condensed):What.CD is the world’s most popular high quality music private torrent site that requires its users to pass an interview testing their knowledge of audio matters before they are granted an account. Users must maintain a high upload to download ratio to continue to download from the site. […] “I reported it a year ago, and they acknowledged it but said ‘don’t worry about it,'” said New-Zealand-based independent security researcher who goes by the alias ss23.


Share on Google+

Read more of this story at Slashdot.


Original URL: http://rss.slashdot.org/~r/Slashdot/slashdot/~3/XY2g-Q_kU0Q/audiophile-torrent-site-whatcd-fully-pwnable-thanks-to-wrecked-rng

Original article

Facebook Messenger to gain privacy-enhancing self-destructing messages

With the ongoing debate about privacy and encryption, the rollout of end-to-end encryption to Facebook-owed WhatsApp came as little surprise. Now Facebook Messenger is set to gain a couple of privacy-enhancing features including self-destructing messages. Already found in other messaging tools such as SnapChat and Telegram, self-destructing messages have been unearthed in Messenger for iOS version 68.0. As you would expect, the feature makes it possible to place a time limit on how long messages are visible for, making it ideal for communicating sensitive information. SEE ALSO: WhatsApp’s end-to-end encryption is not all it’s cracked up to be As reported by VentureBeat,… [Continue Reading]


Original URL: http://feeds.betanews.com/~r/bn/~3/tqTIPaJfHfY/

Original article

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

%d bloggers like this: